From 99eb9822b4dfa67f65674eac92f1371dc4be9d31 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 17 Jan 2020 23:53:16 +0300 Subject: support all 4 cmake default configurations --- .appveyor.yml | 5 ++--- .travis.yml | 5 ++--- boost/build/build.py | 15 +++++++++++++-- cmake/build/build.py | 2 ++ cmake/examples/boost/CMakeLists.txt | 3 +++ cmake/examples/dynamic/CMakeLists.txt | 3 +++ cmake/examples/simple/CMakeLists.txt | 3 +++ cmake/examples/static/CMakeLists.txt | 3 +++ 8 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index e12e52f..a11828e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,7 +10,7 @@ environment: python_exe: C:\Python36-x64\python.exe configuration: - - Release + - MinSizeRel platform: - x64 @@ -42,7 +42,7 @@ build_script: - >- "%python_exe%" ./cmake/build/build.py --install C:\install\dynamic - --configuration Release + --configuration RelWithDebInfo -- cmake/examples/dynamic -A x64 - C:\install\dynamic\bin\foo.exe @@ -76,7 +76,6 @@ build_script: - '"%python_exe%" ./boost/build/build.py download --cache . 1.72.0' - >- "%python_exe%" ./boost/build/build.py build - --configuration Debug Release --platform x86 x64 --link shared -- ./boost_1_72_0 diff --git a/.travis.yml b/.travis.yml index 3aaf42a..f9e4144 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ jobs: - >- ./cmake/build/build.py --install "$HOME/install/dynamic" - --configuration Release + --configuration RelWithDebInfo -- cmake/examples/dynamic - LD_LIBRARY_PATH="$HOME/install/dynamic/lib" "$HOME/install/dynamic/bin/foo" - ./.ci/verify_arch.sh "$HOME/install/dynamic/bin/foo" x64 @@ -75,7 +75,6 @@ jobs: - ./boost/build/build.py download --cache . 1.72.0 - >- ./boost/build/build.py build - --configuration Debug Release --platform x86 x64 --link shared -- ./boost_1_72_0 @@ -109,5 +108,5 @@ jobs: - ./.ci/verify_arch.sh "$HOME/install/boost_1_65_0/bin/foo" x64 env: travis_boost_version: 1.65.0 - configuration: Release + configuration: MinSizeRel platform: x64 diff --git a/boost/build/build.py b/boost/build/build.py index 4957e85..fa8475d 100755 --- a/boost/build/build.py +++ b/boost/build/build.py @@ -100,12 +100,23 @@ def _parse_platform(s): class Configuration(Enum): + # AFAIK, Boost only supports debug/release, MinSizeRel and RelWithDebInfo + # are for compatibility with CMake, they map to Release. DEBUG = 'Debug' + MINSIZEREL = 'MinSizeRel' + RELWITHDEBINFO = 'RelWithDebInfo' RELEASE = 'Release' + def normalize(self): + if self is Configuration.MINSIZEREL: + return Configuration.RELEASE + if self is Configuration.RELWITHDEBINFO: + return Configuration.RELEASE + return self + @staticmethod def all(): - return tuple(Configuration) + return set(map(Configuration.normalize, Configuration)) def __str__(self): return self.value @@ -113,7 +124,7 @@ class Configuration(Enum): def _parse_configuration(s): try: - return Configuration(s) + return Configuration(s).normalize() except ValueError: raise argparse.ArgumentTypeError(f'invalid configuration: {s}') diff --git a/cmake/build/build.py b/cmake/build/build.py index e256b72..695489b 100755 --- a/cmake/build/build.py +++ b/cmake/build/build.py @@ -55,6 +55,8 @@ def _run_cmake(cmake_args): class Configuration(Enum): DEBUG = 'Debug' + MINSIZEREL = 'MinSizeRel' + RELWITHDEBINFO = 'RelWithDebInfo' RELEASE = 'Release' def __str__(self): diff --git a/cmake/examples/boost/CMakeLists.txt b/cmake/examples/boost/CMakeLists.txt index b73fcee..8c076c9 100644 --- a/cmake/examples/boost/CMakeLists.txt +++ b/cmake/examples/boost/CMakeLists.txt @@ -9,3 +9,6 @@ add_executable(foo foo.cpp) target_link_libraries(foo PRIVATE Boost::disable_autolinking Boost::filesystem) install(TARGETS foo RUNTIME DESTINATION bin) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + install(FILES "$" DESTINATION bin OPTIONAL) +endif() diff --git a/cmake/examples/dynamic/CMakeLists.txt b/cmake/examples/dynamic/CMakeLists.txt index 1a602d6..4602adb 100644 --- a/cmake/examples/dynamic/CMakeLists.txt +++ b/cmake/examples/dynamic/CMakeLists.txt @@ -11,3 +11,6 @@ add_executable(foo foo.cpp) target_link_libraries(foo PRIVATE baz) install(TARGETS foo baz RUNTIME DESTINATION bin LIBRARY DESTINATION lib) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + install(FILES "$" "$" DESTINATION bin OPTIONAL) +endif() diff --git a/cmake/examples/simple/CMakeLists.txt b/cmake/examples/simple/CMakeLists.txt index 5f42914..4f8859e 100644 --- a/cmake/examples/simple/CMakeLists.txt +++ b/cmake/examples/simple/CMakeLists.txt @@ -7,3 +7,6 @@ include(../../common.cmake) add_executable(foo foo.cpp) install(TARGETS foo RUNTIME DESTINATION bin) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + install(FILES "$" DESTINATION bin OPTIONAL) +endif() diff --git a/cmake/examples/static/CMakeLists.txt b/cmake/examples/static/CMakeLists.txt index 5b76e22..8a6acb8 100644 --- a/cmake/examples/static/CMakeLists.txt +++ b/cmake/examples/static/CMakeLists.txt @@ -11,3 +11,6 @@ add_executable(foo foo.cpp) target_link_libraries(foo PRIVATE bar) install(TARGETS foo bar RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + install(FILES "$" DESTINATION bin OPTIONAL) +endif() -- cgit v1.2.3