@@ -13,6 +13,24 @@ if (CUBOOL_WITH_CUDA)
13
13
message (STATUS "Add CUDA backend for GPGPU computations" )
14
14
endif ()
15
15
16
+ set (TARGET_NAME cubool )
17
+ set (TARGET_FILE_NAME )
18
+ set (DEFINES_LIST )
19
+
20
+ # Platform checks
21
+ if (APPLE )
22
+ list (APPEND DEFINES_LIST CUBOOL_PLATFORM_MACOS )
23
+ set (TARGET_FILE_NAME "lib${TARGET_NAME} .dylib" )
24
+ elseif (UNIX )
25
+ list (APPEND DEFINES_LIST CUBOOL_PLATFORM_LINUX )
26
+ set (TARGET_FILE_NAME "lib${TARGET_NAME} .so" )
27
+ elseif (WIN32 )
28
+ list (APPEND DEFINES_LIST CUBOOL_PLATFORM_WIN )
29
+ set (TARGET_FILE_NAME "${TARGET_NAME} .dll" )
30
+ else ()
31
+ message (FATAL_ERROR "Platform not specified" )
32
+ endif ()
33
+
16
34
# Library sources
17
35
set (CUBOOL_SOURCES
18
36
sources /core/config.hpp
@@ -27,8 +45,7 @@ set(CUBOOL_SOURCES
27
45
sources /utils/exclusive_scan.hpp
28
46
sources /utils/timer.hpp
29
47
sources /utils/csr_utils.cpp
30
- sources /utils/csr_utils.hpp
31
- )
48
+ sources /utils/csr_utils.hpp )
32
49
33
50
set (CUBOOL_C_API_SOURCES
34
51
include /cubool/cubool.h
@@ -139,6 +156,11 @@ target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUA
139
156
set_target_properties (cubool PROPERTIES CXX_STANDARD 17 )
140
157
set_target_properties (cubool PROPERTIES CXX_STANDARD_REQUIRED ON )
141
158
159
+ # Platform defines
160
+ foreach (DEFINE ${DEFINES_LIST} )
161
+ target_compile_definitions (cubool PUBLIC ${DEFINE} )
162
+ endforeach ()
163
+
142
164
# Cuda specifics
143
165
if (CUBOOL_WITH_CUDA )
144
166
set_target_properties (cubool PROPERTIES CUDA_STANDARD 14 )
@@ -171,14 +193,13 @@ endif()
171
193
172
194
# Copy cubool library after build if allowed
173
195
if (CUBOOL_COPY_TO_PY_PACKAGE )
174
- # todo: Different platforms has specific naming conventions
175
- set (LIBRARY_FILE_NAME "libcubool.so" )
196
+ set (LIBRARY_FILE_NAME ${TARGET_FILE_NAME} )
176
197
177
198
add_custom_command (
178
199
TARGET cubool POST_BUILD
179
200
COMMAND "${CMAKE_COMMAND} " -E
180
201
copy
181
202
"${CMAKE_BINARY_DIR} /cubool/${LIBRARY_FILE_NAME} "
182
203
"${CMAKE_BINARY_DIR} /python/pycubool"
183
- COMMENT "Copy cubool compiled lib into python folder" )
204
+ COMMENT "Copy ${LIBRARY_FILE_NAME} compiled lib into python folder" )
184
205
endif ()
0 commit comments