-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathboost-cmake.patch
76 lines (76 loc) · 2.35 KB
/
boost-cmake.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e69de29..b53cf7a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -0,0 +1,71 @@
+#CMakeLists.txt for wrapping Boost.Build in a gtk-osx jhbuild environment.
+#Copyright 2018 John Ralls <[email protected]>
+#This file is part of gtk-osx.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details
+
+cmake_minimum_required (VERSION 3.6)
+
+project (boost)
+
+if(NOT LIBRARIES)
+ set(LIBRARIES atomic;date_time;regex;locale;filesystem;system)
+endif()
+
+set(B2_EXE ${CMAKE_SOURCE_DIR}/b2)
+
+add_custom_command (
+ OUTPUT ${B2_EXE}
+ COMMAND ${CMAKE_SOURCE_DIR}/bootstrap.sh
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+
+set(LIB_ARG "")
+foreach(lib ${LIBRARIES})
+ list(APPEND LIB_ARGS --with-${lib})
+endforeach()
+
+add_custom_target(bootstrap DEPENDS ${B2_EXE})
+
+set(BUILD_FLAGS
+ --prefix=${CMAKE_INSTALL_PREFIX}
+ ${LIB_ARGS}
+ --build-dir=${CMAKE_BINARY_DIR} --link-shared
+ toolset=clang-darwin cxxflags=${CMAKE_CXX_FLAGS}
+ cflags=${CMAKE_C_FLAGS} linkflags=${CMAKE_SHARED_LINKER_FLAGS}
+ cxxstd=17
+ install)
+add_custom_target(boost_libs
+ COMMAND ${B2_EXE} ${BUILD_FLAGS}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+
+set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
+
+file(WRITE ${CMAKE_BINARY_DIR}/script1.sh
+ "for i in ${CMAKE_INSTALL_PREFIX}/lib/libboost*.dylib; do\n"
+ "\tinstall_name_tool -id $i $i;\n"
+ "done;\n"
+ "for i in ${CMAKE_INSTALL_PREFIX}/lib/libboost*.dylib; do\n"
+ "\tfor j in ${CMAKE_INSTALL_PREFIX}/lib/libboost*.dylib; do\n"
+ "\t\tinstall_name_tool -change \"@rpath/$(basename $i)\" $i $j;\n"
+ "\tdone;\n"
+ "done\n"
+)
+
+add_custom_target(fix_rpaths ALL
+ COMMAND ${CMAKE_COMMAND_TMP} $ENV{SHELL} ${CMAKE_BINARY_DIR}/script1.sh
+ )
+
+add_dependencies(fix_rpaths boost_libs)
+add_dependencies(boost_libs bootstrap)
+
+install(FILES ${CMAKE_SOURCE_DIR}/LICENSE_1_0.txt
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/boost/)