@@ -2,46 +2,9 @@ cmake_minimum_required(VERSION 2.8)
2
2
3
3
include (ExternalProject )
4
4
include (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 )
24
6
25
7
# 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 )
45
8
set (chrono_dep system )
46
9
set (coroutine_dep context system )
47
10
set (context_dep chrono thread )
@@ -53,59 +16,17 @@ set(thread_dep chrono)
53
16
set (timer_dep chrono )
54
17
set (wave_dep chrono date_time filesystem thread )
55
18
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
-
73
19
function (boost_lib_installer req_boost_version req_boost_libs )
74
20
message (STATUS "Boost Lib Installer starting." )
75
21
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} " )
109
30
110
31
# Bootstrap
111
32
if (WIN32 )
@@ -118,8 +39,13 @@ function(boost_lib_installer req_boost_version req_boost_libs)
118
39
file (TO_CMAKE_PATH "${install_dir} /b2" b2_path )
119
40
endif (WIN32 )
120
41
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 )
123
49
if (err )
124
50
message (FATAL_ERROR "Bootstrap error:\n ${err_msg} " )
125
51
endif (err )
@@ -128,11 +54,16 @@ function(boost_lib_installer req_boost_version req_boost_libs)
128
54
endif ()
129
55
130
56
# Process libs
57
+ if (CMAKE_CL_64 EQUAL 1 )
58
+ set (stage_dir stage64 )
59
+ else ()
60
+ set (stage_dir stage32 )
61
+ endif ()
62
+
131
63
get_boots_lib_b2_args ()
132
64
message (STATUS "b2 args: ${b2Args} " )
133
65
134
66
# Resolve dependency tree
135
- list (APPEND req_boost_libs core ) # core dependencies
136
67
foreach (i RANGE 5 )
137
68
foreach (lib ${req_boost_libs} )
138
69
list (APPEND req_boost_libs2 ${lib} )
@@ -145,20 +76,17 @@ function(boost_lib_installer req_boost_version req_boost_libs)
145
76
foreach (lib ${req_boost_libs} )
146
77
message (STATUS "Resolving Boost library: ${lib} " )
147
78
148
- # Init submodule
149
- boost_lib_checkout_submo ("${install_dir} " libs/${lib} )
150
-
151
79
if (EXISTS "${install_dir} /libs/${lib} /build/" )
152
80
# Has source
153
81
set (jam_lib boost_${lib}_jam )
154
82
set (boost_lib boost_${lib} )
155
83
156
84
# Create lib
157
85
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} "
162
90
CONFIGURE_COMMAND ""
163
91
BUILD_COMMAND "${b2_command} " "${b2Args} " --with-${lib}
164
92
INSTALL_COMMAND ""
@@ -182,13 +110,12 @@ function(boost_lib_installer req_boost_version req_boost_libs)
182
110
endif ()
183
111
184
112
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"
187
115
LINKER_LANGUAGE CXX )
188
116
else ()
189
117
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"
192
119
LINKER_LANGUAGE CXX )
193
120
endif ()
194
121
0 commit comments