@@ -37,6 +37,8 @@ cmake_minimum_required ( VERSION 2.8.12 )
37
37
38
38
project ( graphblas )
39
39
40
+ include ( GNUInstallDirs )
41
+
40
42
if ( CMAKE_VERSION VERSION_GREATER "3.0" )
41
43
cmake_policy ( SET CMP0042 NEW )
42
44
endif ( )
@@ -51,20 +53,20 @@ endif ( )
51
53
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
52
54
53
55
# include directories for both graphblas and graphblasdemo libraries
54
- include_directories ( Source /Template Include Demo/Include )
56
+ include_directories ( Source /Template Source Source / Generated Include Demo/Include )
55
57
56
58
# check which compiler is being used. If you need to make
57
59
# compiler-specific modifications, here is the place to do it.
58
60
if ("${CMAKE_C_COMPILER_ID} " STREQUAL "GNU" )
59
61
# cmake 2.8 workaround: gcc needs to be told to do ANSI C11.
60
62
# cmake 3.0 doesn't have this problem.
61
- set (CMAKE_C_FLAGS "-std=c11 -lm" )
63
+ set (CMAKE_C_FLAGS "-std=c11 -lm -fopenmp " )
62
64
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
63
65
message (FATAL_ERROR "gcc version must be at least 4.9" )
64
66
endif ( )
65
67
elseif ("${CMAKE_C_COMPILER_ID} " STREQUAL "Intel" )
66
68
# options for icc: also needs -std=c11
67
- set (CMAKE_C_FLAGS "-std=c11" )
69
+ set (CMAKE_C_FLAGS "-std=c11 -fopenmp " )
68
70
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0)
69
71
message (FATAL_ERROR "icc version must be at least 18.0" )
70
72
endif ( )
@@ -77,19 +79,51 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
77
79
# options for MicroSoft Visual Studio
78
80
endif ( )
79
81
80
- # create the graphblas library. Requires ANSI C11
81
- file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" )
82
+ # create the dynamic graphblas library. Requires ANSI C11
83
+ file ( GLOB GRAPHBLAS_SOURCES "Source/*.c" "Source/Generated/*.c" )
82
84
add_library ( graphblas SHARED ${GRAPHBLAS_SOURCES} )
83
- SET_TARGET_PROPERTIES ( graphblas PROPERTIES VERSION 1.1.0
85
+ SET_TARGET_PROPERTIES ( graphblas PROPERTIES VERSION 1.1.2
84
86
SOVERSION 1
85
87
C_STANDARD_REQUIRED 11
86
88
PUBLIC_HEADER "Include/GraphBLAS.h" )
87
89
set_property ( TARGET graphblas PROPERTY C_STANDARD 11 )
88
90
91
+ # create the static graphblas library. Requires ANSI C11
92
+ add_library ( graphblas_static STATIC ${GRAPHBLAS_SOURCES} )
93
+ SET_TARGET_PROPERTIES ( graphblas_static PROPERTIES VERSION 1.1.2
94
+ OUTPUT_NAME graphblas
95
+ POSITION_INDEPENDENT_CODE OFF
96
+ SOVERSION 1
97
+ C_STANDARD_REQUIRED 11
98
+ PUBLIC_HEADER "Include/GraphBLAS.h" )
99
+ set_property ( TARGET graphblas_static PROPERTY C_STANDARD 11 )
100
+
101
+ # Notes from Sebastien Villemot ([email protected] ):
102
+ # SOVERSION policy: if a binary compiled against the old version of the shared
103
+ # library needs recompiling in order to work with the new version, then a
104
+ # SO_VERSION increase # is needed. Otherwise not. Examples of the changes that
105
+ # require a SO_VERSION increase:
106
+ #
107
+ # - a public function or static variable is removed
108
+ # - the prototype of a public function changes
109
+ # - the integer value attached to a public #define or enum changes
110
+ # - the fields of a public structure are modified
111
+ #
112
+ # Examples of changes that do not require a SO_VERSION increase:
113
+ #
114
+ # - a new public function or static variable is added
115
+ # - a private function or static variable is removed or modified
116
+ # - changes in the internals of a structure that is opaque to the calling
117
+ # program (i.e. is only a pointer manipulated through public functions of
118
+ # the library)
119
+ # - a public enum is extended (by adding a new item at the end, but without
120
+ # changing the already existing items)
121
+
89
122
# graphblas installation location
90
- install ( TARGETS graphblas
91
- LIBRARY DESTINATION /usr/local/lib
92
- PUBLIC_HEADER DESTINATION /usr/local/include )
123
+ install ( TARGETS graphblas graphblas_static
124
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
125
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
126
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
93
127
94
128
# Demo library
95
129
file ( GLOB DEMO_SOURCES "Demo/Source/*.c" )
@@ -98,7 +132,13 @@ SET_TARGET_PROPERTIES ( graphblasdemo PROPERTIES
98
132
C_STANDARD_REQUIRED 11 )
99
133
set_property ( TARGET graphblasdemo PROPERTY C_STANDARD 11 )
100
134
101
- target_link_libraries ( graphblasdemo graphblas )
135
+ add_library ( graphblasdemo_static STATIC ${DEMO_SOURCES} )
136
+ SET_TARGET_PROPERTIES ( graphblasdemo_static PROPERTIES
137
+ C_STANDARD_REQUIRED 11 )
138
+ set_property ( TARGET graphblasdemo_static PROPERTY C_STANDARD 11 )
139
+
140
+ target_link_libraries ( graphblasdemo m graphblas )
141
+ target_link_libraries ( graphblasdemo_static graphblas_static )
102
142
103
143
# Demo programs
104
144
add_executable ( bfs_demo "Demo/Program/bfs_demo.c" )
0 commit comments