@@ -2,46 +2,9 @@ cmake_minimum_required(VERSION 2.8)
22
33include (ExternalProject)
44include (GetBoostLibB2Args)
5-
6- #boost_lib_checkout_submo("${install_dir}" libs/core)
7- #boost_lib_checkout_submo("${install_dir}" libs/detail)
8- #boost_lib_checkout_submo("${install_dir}" libs/config)
9- #boost_lib_checkout_submo("${install_dir}" libs/preprocessor)
10- #boost_lib_checkout_submo("${install_dir}" libs/mpl)
11- #boost_lib_checkout_submo("${install_dir}" libs/wave)
12- #boost_lib_checkout_submo("${install_dir}" libs/assert)
13- #boost_lib_checkout_submo("${install_dir}" libs/move)
14- #boost_lib_checkout_submo("${install_dir}" libs/static_assert)
15- #boost_lib_checkout_submo("${install_dir}" libs/range)
16- #boost_lib_checkout_submo("${install_dir}" libs/type_traits)
17- #boost_lib_checkout_submo("${install_dir}" libs/iterator)
18- #boost_lib_checkout_submo("${install_dir}" libs/concept_check)
19- #boost_lib_checkout_submo("${install_dir}" libs/utility)
20- #boost_lib_checkout_submo("${install_dir}" libs/throw_exception)
21- #boost_lib_checkout_submo("${install_dir}" libs/predef)
22- #boost_lib_checkout_submo("${install_dir}" libs/exception)
23- #boost_lib_checkout_submo("${install_dir}" libs/smart_ptr)
5+ include (DownloadBoost)
246
257# Known dependencies
26- set (core_dep
27- config
28- detail
29- preprocessor
30- assert
31- move
32- static_assert
33- range
34- type_traits
35- iterator
36- concept_check
37- utility
38- throw_exception
39- predef
40- exception
41- smart_ptr
42- mpl
43- ratio
44- integer)
458set (chrono_dep system )
469set (coroutine_dep context system )
4710set (context_dep chrono thread)
@@ -53,59 +16,17 @@ set(thread_dep chrono)
5316set (timer_dep chrono)
5417set (wave_dep chrono date_time filesystem thread)
5518
56- # Must build list
57- # set(to_build_libs chrono context filesystem graph_parallel iostreams locale mpi
58-
59- function (boost_lib_checkout_submo install_dir submo_path)
60- file (GLOB submo_dir "${install_dir} /${submo_path} /*" )
61- list (LENGTH submo_dir submo_dir_len)
62- if (submo_dir_len EQUAL 0)
63- message (STATUS "Checking out subodule: ${submo_path} " )
64- execute_process (COMMAND "${GIT_EXECUTABLE} " submodule update --recursive --init "${submo_path} " WORKING_DIRECTORY ${install_dir} RESULT_VARIABLE err ERROR_VARIABLE err_msg)
65- if (err)
66- message (FATAL_ERROR "Git error:\n ${err_msg} " )
67- endif (err)
68- else ()
69- message (STATUS "Submodule ${submo_path} is already checked out." )
70- endif ()
71- endfunction (boost_lib_checkout_submo name )
72-
7319function (boost_lib_installer req_boost_version req_boost_libs)
7420 message (STATUS "Boost Lib Installer starting." )
7521
76- # Resolving Git dependency
77- find_package (Git)
78- if (GIT_FOUND)
79- message (STATUS "Git found: ${GIT_EXECUTABLE} " )
80- else (GIT_FOUND)
81- message (FATAL_ERROR "Git is required for Boost library installer." )
82- endif (GIT_FOUND)
83-
84- # Install dir
85- if (WIN32 )
86- set (install_dir $ENV{USERPROFILE} )
87- else (WIN32 )
88- set (install_dir $ENV{HOME} )
89- endif (WIN32 )
90- file (TO_NATIVE_PATH "${install_dir} /.cmake-js/boost/${req_boost_version} " install_dir)
91-
92- message (STATUS "Boost Lib install dir: ${install_dir} " )
93-
94- # Clone
95- if (NOT EXISTS "${install_dir} /.git/" )
96- message (STATUS "Cloning Boost, please stand by ..." )
97- execute_process (COMMAND "${GIT_EXECUTABLE} " clone --branch boost-${req_boost_version} --single-branch --depth 1 https://github.com/boostorg/boost.git "${install_dir} " RESULT_VARIABLE err ERROR_VARIABLE err_msg)
98- if (err)
99- message (FATAL_ERROR "Git error:\n ${err_msg} " )
100- endif (err)
101- else ()
102- message (STATUS "Boost repository exists." )
103- endif ()
104-
105- # Checkout Tools and Musthaves
106- boost_lib_checkout_submo("${install_dir} " tools/build )
107- boost_lib_checkout_submo("${install_dir} " tools/inspect)
108- boost_lib_checkout_submo("${install_dir} " libs/wave) # this is required for some unknown reason for jam
22+ # Download
23+ download_boost("${req_boost_version} " )
24+ get_filename_component (req_boost_version "${install_dir} " NAME )
25+ message (STATUS "Boost path: ${install_dir} " )
26+ message (STATUS "Boost version: ${req_boost_version} " )
27+ string (REGEX MATCH "^([0-9]+)\\ .([0-9]+)\\ ." m "${req_boost_version} " )
28+ set (lib_postfix "${CMAKE_MATCH_1} _${CMAKE_MATCH_2} " )
29+ message (STATUS "Boost library postfix: ${lib_postfix} " )
10930
11031 # Bootstrap
11132 if (WIN32 )
@@ -118,8 +39,13 @@ function(boost_lib_installer req_boost_version req_boost_libs)
11839 file (TO_CMAKE_PATH "${install_dir} /b2" b2_path)
11940 endif (WIN32 )
12041 if (NOT EXISTS "${b2_path} " )
121- message (STATUS "Bootstrapping ..." )
122- execute_process (COMMAND ${bootstrap} WORKING_DIRECTORY ${install_dir} RESULT_VARIABLE err OUTPUT_VARIABLE err_msg OUTPUT_QUIET )
42+ message (STATUS "Invoking ${install_dir} /tools/build/${bootstrap} " )
43+ execute_process (COMMAND "${bootstrap} " WORKING_DIRECTORY "${install_dir} /tools/build" RESULT_VARIABLE err OUTPUT_VARIABLE err_msg OUTPUT_QUIET )
44+ if (err)
45+ message (FATAL_ERROR "Bootstrap error:\n ${err_msg} " )
46+ endif (err)
47+ message (STATUS "Invoking ${install_dir} /${bootstrap} " )
48+ execute_process (COMMAND "${bootstrap} " WORKING_DIRECTORY "${install_dir} " RESULT_VARIABLE err OUTPUT_VARIABLE err_msg OUTPUT_QUIET )
12349 if (err)
12450 message (FATAL_ERROR "Bootstrap error:\n ${err_msg} " )
12551 endif (err)
@@ -128,11 +54,16 @@ function(boost_lib_installer req_boost_version req_boost_libs)
12854 endif ()
12955
13056 # Process libs
57+ if (CMAKE_CL_64 EQUAL 1)
58+ set (stage_dir stage64)
59+ else ()
60+ set (stage_dir stage32)
61+ endif ()
62+
13163 get_boots_lib_b2_args()
13264 message (STATUS "b2 args: ${b2Args} " )
13365
13466 # Resolve dependency tree
135- list (APPEND req_boost_libs core) # core dependencies
13667 foreach (i RANGE 5)
13768 foreach (lib ${req_boost_libs} )
13869 list (APPEND req_boost_libs2 ${lib} )
@@ -145,20 +76,17 @@ function(boost_lib_installer req_boost_version req_boost_libs)
14576 foreach (lib ${req_boost_libs} )
14677 message (STATUS "Resolving Boost library: ${lib} " )
14778
148- # Init submodule
149- boost_lib_checkout_submo("${install_dir} " libs/${lib} )
150-
15179 if (EXISTS "${install_dir} /libs/${lib} /build/" )
15280 # Has source
15381 set (jam_lib boost_${lib} _jam)
15482 set (boost_lib boost_${lib} )
15583
15684 # Create lib
15785 ExternalProject_Add(
158- ${jam_lib}
159- STAMP_DIR ${CMAKE_BINARY_DIR} /boost-${req_boost_version}
160- SOURCE_DIR ${install_dir}
161- BINARY_DIR ${install_dir}
86+ " ${jam_lib} "
87+ STAMP_DIR " ${CMAKE_BINARY_DIR} /boost-${req_boost_version} "
88+ SOURCE_DIR " ${install_dir} "
89+ BINARY_DIR " ${install_dir} "
16290 CONFIGURE_COMMAND ""
16391 BUILD_COMMAND "${b2_command} " "${b2Args} " --with-${lib}
16492 INSTALL_COMMAND ""
@@ -182,13 +110,12 @@ function(boost_lib_installer req_boost_version req_boost_libs)
182110 endif ()
183111
184112 set_target_properties (${boost_lib} PROPERTIES
185- IMPORTED_LOCATION_DEBUG ${install_dir} /stage /lib/libboost_${ComponentLibName} -${CompilerName} -mt-gd-${req_boost_version } .lib
186- IMPORTED_LOCATION ${install_dir} /stage /lib/libboost_${ComponentLibName} -${CompilerName} -mt-${req_boost_version } .lib
113+ IMPORTED_LOCATION_DEBUG " ${install_dir} /${stage_dir} /lib/libboost_${ComponentLibName} -${CompilerName} -mt-gd-${lib_postfix } .lib"
114+ IMPORTED_LOCATION " ${install_dir} /${stage_dir} /lib/libboost_${ComponentLibName} -${CompilerName} -mt-${lib_postfix } .lib"
187115 LINKER_LANGUAGE CXX)
188116 else ()
189117 set_target_properties (${boost_lib} PROPERTIES
190- IMPORTED_LOCATION_DEBUG ${install_dir} /stage/lib/libboost_${ComponentLibName} -mt-gd.a
191- IMPORTED_LOCATION ${install_dir} /stage/lib/libboost_${ComponentLibName} -mt.a
118+ IMPORTED_LOCATION "${install_dir} /${stage_dir} /lib/libboost_${ComponentLibName} -mt.a"
192119 LINKER_LANGUAGE CXX)
193120 endif ()
194121
0 commit comments