diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-10-01 03:57:03 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-10-01 03:57:03 +0200 |
commit | aa3583916131f21b6a936cd88c4b74a21151644f (patch) | |
tree | 845aa6e2ccd8320345dafb24f4e4657d8b164389 | |
parent | 0fa500a6d78cf6fd1d75d8db8ae28065bc2e36df (diff) |
Only enable modularized build if forced
The two boolean command line variables that control this are:
force_modules
force_std_modules
32 files changed, 49 insertions, 185 deletions
diff --git a/build/root.build b/build/root.build index 5129a40..839e423 100644 --- a/build/root.build +++ b/build/root.build @@ -2,15 +2,14 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -using cxx.guess - -if ($force_modules != true && $cxx.id == 'clang') - cxx.features.modules = false - cxx.std = experimental +cxx.features.modules = ($force_modules == true) using cxx +if ($force_modules == true && !$cxx.features.modules) + fail 'c++ compiler does not support modules' + mxx{*}: extension = mxx hxx{*}: extension = hxx ixx{*}: extension = ixx diff --git a/libbutl/buildfile b/libbutl/buildfile index ccf8908..d3ec87b 100644 --- a/libbutl/buildfile +++ b/libbutl/buildfile @@ -4,8 +4,11 @@ int_libs = -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +if ($force_std_modules == true) { + #@@ MOD is it really an interface dependency? I guess if we re-export + # then it is? Or maybe it is special? + # import int_libs += libstd-modules%liba{std-modules} cxx.poptions += -D__cpp_lib_modules } diff --git a/tests/base64/buildfile b/tests/base64/buildfile index 535b9dc..bb27f11 100644 --- a/tests/base64/buildfile +++ b/tests/base64/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/build/root.build b/tests/build/root.build index 6c98ba9..85724d4 100644 --- a/tests/build/root.build +++ b/tests/build/root.build @@ -2,15 +2,22 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -using cxx.guess - -if ($force_modules != true && $cxx.id == 'clang') - cxx.features.modules = false - cxx.std = experimental +cxx.features.modules = ($force_modules == true) using cxx +if ($force_modules == true && !$cxx.features.modules) + fail 'c++ compiler does not support modules' + +if ($force_std_modules == true) +{ + import stdmod_lib = libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} +else + stdmod_lib = + hxx{*}: extension = hxx cxx{*}: extension = cxx diff --git a/tests/cpfile/buildfile b/tests/cpfile/buildfile index 41275fa..3482fe7 100644 --- a/tests/cpfile/buildfile +++ b/tests/cpfile/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/curl/buildfile b/tests/curl/buildfile index dae375b..9040203 100644 --- a/tests/curl/buildfile +++ b/tests/curl/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/dir-iterator/buildfile b/tests/dir-iterator/buildfile index 7f83e4f..361100d 100644 --- a/tests/dir-iterator/buildfile +++ b/tests/dir-iterator/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/fdstream/buildfile b/tests/fdstream/buildfile index 6028f3f..c036673 100644 --- a/tests/fdstream/buildfile +++ b/tests/fdstream/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/link/buildfile b/tests/link/buildfile index 17e3eac..1180505 100644 --- a/tests/link/buildfile +++ b/tests/link/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/manifest-parser/buildfile b/tests/manifest-parser/buildfile index 2a89e29..fafb3d8 100644 --- a/tests/manifest-parser/buildfile +++ b/tests/manifest-parser/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/manifest-roundtrip/buildfile b/tests/manifest-roundtrip/buildfile index 5cd296f..19678d8 100644 --- a/tests/manifest-roundtrip/buildfile +++ b/tests/manifest-roundtrip/buildfile @@ -3,12 +3,7 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs exe{driver}: test.roundtrip = manifest diff --git a/tests/manifest-serializer/buildfile b/tests/manifest-serializer/buildfile index df633ae..3111d6e 100644 --- a/tests/manifest-serializer/buildfile +++ b/tests/manifest-serializer/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/mventry/buildfile b/tests/mventry/buildfile index d9af3a2..3e58110 100644 --- a/tests/mventry/buildfile +++ b/tests/mventry/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/openssl/buildfile b/tests/openssl/buildfile index 08b0878..f78d532 100644 --- a/tests/openssl/buildfile +++ b/tests/openssl/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/pager/buildfile b/tests/pager/buildfile index d7d0123..67b14fa 100644 --- a/tests/pager/buildfile +++ b/tests/pager/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/path-entry/buildfile b/tests/path-entry/buildfile index e6515ae..635246c 100644 --- a/tests/path-entry/buildfile +++ b/tests/path-entry/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/path/buildfile b/tests/path/buildfile index aa39b2d..d48fcbe 100644 --- a/tests/path/buildfile +++ b/tests/path/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/prefix-map/buildfile b/tests/prefix-map/buildfile index 140fda9..f24743c 100644 --- a/tests/prefix-map/buildfile +++ b/tests/prefix-map/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/process-run/buildfile b/tests/process-run/buildfile index 5200af7..0802c8e 100644 --- a/tests/process-run/buildfile +++ b/tests/process-run/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/process/buildfile b/tests/process/buildfile index 2ecc915..c0fc49d 100644 --- a/tests/process/buildfile +++ b/tests/process/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/progress/buildfile b/tests/progress/buildfile index d8cb6d6..e7031ee 100644 --- a/tests/progress/buildfile +++ b/tests/progress/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/regex/buildfile b/tests/regex/buildfile index ae7e2c3..07bcd6f 100644 --- a/tests/regex/buildfile +++ b/tests/regex/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/sendmail/buildfile b/tests/sendmail/buildfile index a854e89..773efe0 100644 --- a/tests/sendmail/buildfile +++ b/tests/sendmail/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/sha256/buildfile b/tests/sha256/buildfile index fb490d0..1d6cece 100644 --- a/tests/sha256/buildfile +++ b/tests/sha256/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/small-vector/buildfile b/tests/small-vector/buildfile index 16d61f8..3d4d1b4 100644 --- a/tests/small-vector/buildfile +++ b/tests/small-vector/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/standard-version/buildfile b/tests/standard-version/buildfile index eb30733..57fd517 100644 --- a/tests/standard-version/buildfile +++ b/tests/standard-version/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/strcase/buildfile b/tests/strcase/buildfile index efe8442..0c34da7 100644 --- a/tests/strcase/buildfile +++ b/tests/strcase/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/string-parser/buildfile b/tests/string-parser/buildfile index 4613df1..b279250 100644 --- a/tests/string-parser/buildfile +++ b/tests/string-parser/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/tab-parser/buildfile b/tests/tab-parser/buildfile index eb30733..57fd517 100644 --- a/tests/tab-parser/buildfile +++ b/tests/tab-parser/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/target-triplet/buildfile b/tests/target-triplet/buildfile index 7dec846..a2cc548 100644 --- a/tests/target-triplet/buildfile +++ b/tests/target-triplet/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/timestamp/buildfile b/tests/timestamp/buildfile index c554fc3..a0aecb8 100644 --- a/tests/timestamp/buildfile +++ b/tests/timestamp/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/wildcard/buildfile b/tests/wildcard/buildfile index 90e8b58..4ec6488 100644 --- a/tests/wildcard/buildfile +++ b/tests/wildcard/buildfile @@ -3,11 +3,6 @@ # license : MIT; see accompanying LICENSE file import libs = libbutl%lib{butl} - -if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) -{ - import libs += libstd-modules%liba{std-modules} - cxx.poptions += -D__cpp_lib_modules -} +libs += $stdmod_lib exe{driver}: {hxx cxx}{*} $libs test{testscript} |