|
Boost-Commit : |
From: dgregor_at_[hidden]
Date: 2007-06-10 15:59:34
Author: dgregor
Date: 2007-06-10 15:59:33 EDT (Sun, 10 Jun 2007)
New Revision: 4520
URL: http://svn.boost.org/trac/boost/changeset/4520
Log:
- Introduce static/dynamic runtime variants
- Lots of tweaking to allow us to build Boost from Visual Studio
Text files modified:
sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt | 1
sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostConfig.cmake | 33 +++++++++++++++++++++--
sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostCore.cmake | 55 ++++++++++++++++++++++++++++++---------
3 files changed, 71 insertions(+), 18 deletions(-)
Modified: sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt 2007-06-10 15:59:33 EDT (Sun, 10 Jun 2007)
@@ -75,7 +75,6 @@
boost_add_default_variant(SINGLE_THREADED MULTI_THREADED)
boost_add_default_variant(STATIC_RUNTIME DYNAMIC_RUNTIME)
-
# Extra features used by some libraries
boost_add_extra_variant(PYTHON_NODEBUG PYTHON_DEBUG)
##########################################################################
Modified: sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostConfig.cmake
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostConfig.cmake (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostConfig.cmake 2007-06-10 15:59:33 EDT (Sun, 10 Jun 2007)
@@ -110,7 +110,32 @@
endif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
# Static and dynamic runtime linking options
-if(MSVC)
- set(RUNTIME_STATIC_LINK_FLAGS "/MT")
- set(RUNTIME_DYNAMIC_LINK_FLAGS "/MD")
-endif(MSVC)
\ No newline at end of file
+#if(MSVC)
+# set(STATIC_RUNTIME_COMPILE_FLAGS "/MT")
+# set(DYNAMIC_RUNTIME_COMPILE_FLAGS "/MD")
+#endif(MSVC)
+
+# Setup DEBUG_COMPILE_FLAGS, RELEASE_COMPILE_FLAGS, DEBUG_LINK_FLAGS and
+# and RELEASE_LINK_FLAGS based on the CMake equivalents
+if(CMAKE_CXX_FLAGS_DEBUG)
+ set(DEBUG_COMPILE_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Compilation flags for debug libraries")
+endif(CMAKE_CXX_FLAGS_DEBUG)
+if(CMAKE_CXX_FLAGS_RELEASE)
+ set(RELEASE_COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Compilation flags for release libraries")
+endif(CMAKE_CXX_FLAGS_RELEASE)
+if(CMAKE_SHARED_LINKER_FLAGS_DEBUG)
+ set(DEBUG_LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING "Linker flags for debug libraries")
+endif(CMAKE_SHARED_LINKER_FLAGS_DEBUG)
+if(CMAKE_SHARED_LINKER_FLAGS_RELEASE)
+ set(RELEASE_LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING "Link flags for release libraries")
+endif(CMAKE_SHARED_LINKER_FLAGS_RELEASE)
+
+# For project file generators that have multiple configurations,
+# clear out the built-in C++ compiler and link flags for each of the
+# configurations.
+foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
+ string(TOUPPER ${CONFIG} UCONFIG)
+ set(CMAKE_CXX_FLAGS_${UCONFIG} "" CACHE STRING "Unused by Boost" FORCE)
+ set(CMAKE_SHARED_LINKER_FLAGS_${UCONFIG} "" CACHE STRING "Unused by Boost" FORCE)
+ set(CMAKE_MODULE_LINKER_FLAGS_${UCONFIG} "" CACHE STRING "Unused by Boost" FORCE)
+endforeach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
Modified: sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostCore.cmake
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostCore.cmake (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostCore.cmake 2007-06-10 15:59:33 EDT (Sun, 10 Jun 2007)
@@ -150,12 +150,19 @@
# Linking statically to the runtime library
list_contains(VARIANT_IS_STATIC_RUNTIME STATIC_RUNTIME ${ARGN})
- if (VARIANT_IS_STATIC_RUNTIME)
+ if (VARIANT_IS_STATIC_RUNTIME)
set(VARIANT_TARGET_NAME "${VARIANT_TARGET_NAME}-staticrt")
set(VARIANT_ABI_TAG "${VARIANT_ABI_TAG}s")
endif (VARIANT_IS_STATIC_RUNTIME)
- # TODO: Using debug versions of the standard/runtime support libs
+ # Using the debug version of the runtime library.
+ # With Visual C++, this comes automatically with debug
+ if (MSVC)
+ list_contains(VARIANT_IS_DEBUG DEBUG ${ARGN})
+ if (VARIANT_IS_DEBUG)
+ set(VARIANT_ABI_TAG "${VARIANT_ABI_TAG}g")
+ endif (VARIANT_IS_DEBUG)
+ endif (MSVC)
# Add -pydebug for debug builds of Python
list_contains(VARIANT_IS_PYDEBUG PYTHON_DEBUG ${ARGN})
@@ -164,7 +171,6 @@
set(VARIANT_ABI_TAG "${VARIANT_ABI_TAG}y")
endif (VARIANT_IS_PYDEBUG)
- # TODO: using debug build of Python
# TODO: STLport rather than default library
# TODO: STLport's deprecated iostreams
@@ -240,17 +246,40 @@
set(THIS_VARIANT_LINK_LIBS ${THIS_VARIANT_LINK_LIBS} ${THIS_LIB_${ARG}_LINK_LIBS} ${${ARG}_LINK_LIBS})
endforeach(ARG ${ARGN})
- if (THIS_VARIANT_OKAY)
- # Use the appropriate C++ flags for debug vs. release variants
- list_contains(THIS_LIB_IS_DEBUG "DEBUG" ${ARGN})
- if (THIS_LIB_IS_DEBUG)
- set(THIS_VARIANT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} ${THIS_VARIANT_COMPILE_FLAGS}")
- set(THIS_VARIANT_LINK_FLAGS "${CMAKE_LINK_FLAGS_DEBUG} ${THIS_VARIANT_LINK_FLAGS}")
- else (THIS_LIB_IS_DEBUG)
- set(THIS_VARIANT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELEASE} ${THIS_VARIANT_COMPILE_FLAGS}")
- set(THIS_VARIANT_LINK_FLAGS "${CMAKE_LINK_FLAGS_RELEASE} ${THIS_VARIANT_LINK_FLAGS}")
- endif (THIS_LIB_IS_DEBUG)
+ # Don't build a shared library against a static run-time
+ list_contains(IS_SHARED SHARED ${ARGN})
+ list_contains(IS_STATIC_RUNTIME STATIC_RUNTIME ${ARGN})
+ if (IS_SHARED AND IS_STATIC_RUNTIME)
+ set(THIS_VARIANT_OKAY FALSE)
+ endif (IS_SHARED AND IS_STATIC_RUNTIME)
+
+ # With Visual C++, the dynamic runtime is multi-threaded only
+ list_contains(IS_DYNAMIC_RUNTIME DYNAMIC_RUNTIME ${ARGN})
+ list_contains(IS_SINGLE_THREADED SINGLE_THREADED ${ARGN})
+ if (IS_DYNAMIC_RUNTIME AND IS_SINGLE_THREADED)
+ set(THIS_VARIANT_OKAY FALSE)
+ endif (IS_DYNAMIC_RUNTIME AND IS_SINGLE_THREADED)
+
+ # Visual C++-specific runtime library flags
+ if(MSVC)
+ list_contains(IS_STATIC_RUNTIME STATIC_RUNTIME ${ARGN})
+ list_contains(IS_DEBUG DEBUG ${ARGN})
+ if(IS_DEBUG)
+ if(IS_STATIC_RUNTIME)
+ set(THIS_VARIANT_COMPILE_FLAGS "/MTd ${THIS_VARIANT_COMPILE_FLAGS}")
+ else(IS_STATIC_RUNTIME)
+ set(THIS_VARIANT_COMPILE_FLAGS "/MDd ${THIS_VARIANT_COMPILE_FLAGS}")
+ endif(IS_STATIC_RUNTIME)
+ else(IS_DEBUG)
+ if(IS_STATIC_RUNTIME)
+ set(THIS_VARIANT_COMPILE_FLAGS "/MT ${THIS_VARIANT_COMPILE_FLAGS}")
+ else(IS_STATIC_RUNTIME)
+ set(THIS_VARIANT_COMPILE_FLAGS "/MD ${THIS_VARIANT_COMPILE_FLAGS}")
+ endif(IS_STATIC_RUNTIME)
+ endif(IS_DEBUG)
+ endif(MSVC)
+ if (THIS_VARIANT_OKAY)
# Determine the suffix for this library target
boost_library_variant_target_name(${ARGN})
set(VARIANT_LIBNAME "${LIBNAME}${VARIANT_TARGET_NAME}")
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk