Package: terraphast / 0.0+git20200413.8af2e4c+dfsg-3

dynamic_lib.patch Patch series | download
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Author: Andreas Tille <tille@debian.org>,
        Aaron M. Ucko <ucko@debian.org>
Last-Update: Wed, 20 Oct 2021 09:51:23 +0200
Description: Attempt to create shared library
 This patch is deactivated since the build fails with it.
 Thus we simply stick to the existing static library

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@ Option(TERRAPHAST_ARCH_NATIVE "Use -marc
 #####################################################################
 # build library
 #####################################################################
-add_library(terraces
+set(terraces_sources
 		lib/advanced.cpp
 		lib/bigint.cpp
 		lib/bipartitions.cpp
@@ -74,6 +74,17 @@ add_library(terraces
 		include/terraces/subtree_extraction.hpp
 		include/terraces/trees.hpp
 )
+add_library(terraces_static ${terraces_sources})
+add_library(terraces SHARED ${terraces_sources})
+set_target_properties(terraces PROPERTIES
+        VERSION ${VERSION}
+        SOVERSION ${SOVERSION}
+)
+
+target_include_directories(terraces_static
+		PUBLIC include
+		PRIVATE lib
+)
 target_include_directories(terraces
 		PUBLIC include
 		PRIVATE lib
@@ -83,35 +94,49 @@ if(TERRAPHAST_USE_GMP)
 	find_package(GMP)
 	if(GMP_FOUND)
 		message(STATUS "GMP libraries found")
+		target_link_libraries(terraces_static gmpxx gmp)
 		target_link_libraries(terraces gmpxx gmp)
+		target_compile_definitions(terraces_static PUBLIC USE_GMP)
 		target_compile_definitions(terraces PUBLIC USE_GMP)
 	else()
 		message(FATAL_ERROR "GMP libraries not found! Disable them using -DTERRAPHAST_USE_GMP=OFF")
 	endif()
 endif()
 
-set(terraces_targets terraces)
+set(terraces_targets terraces terraces_static)
 
 if(TERRAPHAST_BUILD_CLIB)
-	add_library(terraces_c
+	add_library(terraces_c_static
 			c_lib/terraces.cpp
 			c_include/terraces/terraces.h
 	)
+	add_library(terraces_c SHARED
+			c_lib/terraces.cpp
+			c_include/terraces/terraces.h
+	)
+	set_target_properties(terraces_c PROPERTIES
+        		VERSION ${VERSION}
+		        SOVERSION ${SOVERSION}
+	)
+	target_include_directories(terraces_c_static PUBLIC c_include)
 	target_include_directories(terraces_c PUBLIC c_include)
+	target_link_libraries(terraces_c_static terraces_static)
 	target_link_libraries(terraces_c terraces)
 	if (NOT TERRAPHAST_USE_GMP)
 		message(FATAL_ERROR "The C library requires the GMP libraries to build! Enable them using -DTERRAPHAST_USE_GMP=ON")
 	endif()
 
-	set(terraces_targets ${terraces_targets} terraces_c)
+	set(terraces_targets ${terraces_targets} terraces_c terraces_c_static)
 endif()
 
 #####################################################################
 # internal compiler flags
 #####################################################################
 if(DEV_ENVIRONMENT AND CMAKE_BUILD_TYPE STREQUAL "Debug")
+	target_compile_definitions(terraces_static PUBLIC _GLIBCXX_DEBUG) # PUBLIC to maintain ABI compatibility
 	target_compile_definitions(terraces PUBLIC _GLIBCXX_DEBUG) # PUBLIC to maintain ABI compatibility
 	if(TERRAPHAST_BUILD_CLIB)
+		target_compile_definitions(terraces_c_static PRIVATE _GLIBCXX_DEBUG) # PRIVATE since no stdlib objects are used
 		target_compile_definitions(terraces_c PRIVATE _GLIBCXX_DEBUG) # PRIVATE since no stdlib objects are used
 	endif()
 endif()
@@ -142,6 +167,8 @@ if(TERRAPHAST_BUILD_APPS)
 	set(terraces_targets ${terraces_targets} app validated_run verbose_run isomorphic reroot subtree tree_gen site_gen nwk_to_dot)
 endif()
 
+set_target_properties(${terraces_targets} PROPERTIES SKIP_BUILD_RPATH TRUE)
+
 #####################################################################
 # build tests
 #####################################################################
@@ -216,12 +243,15 @@ else()
 	endif()
 endif()
 
+target_include_directories(terraces_static PUBLIC "${TERRAPHAST_PLATFORM_INCLUDE}")
 target_include_directories(terraces PUBLIC "${TERRAPHAST_PLATFORM_INCLUDE}")
 if(TERRAPHAST_BUILD_TESTS)
 	target_include_directories(unittests PRIVATE "${TERRAPHAST_PLATFORM_INCLUDE}")
 endif()
+target_compile_options(terraces_static PRIVATE "${TERRAPHAST_COMPILE_FLAGS}")
 target_compile_options(terraces PRIVATE "${TERRAPHAST_COMPILE_FLAGS}")
 if(TERRAPHAST_BUILD_CLIB)
+	target_compile_options(terraces_c_static PRIVATE "${TERRAPHAST_COMPILE_FLAGS}")
 	target_compile_options(terraces_c PRIVATE "${TERRAPHAST_COMPILE_FLAGS}")
 endif()