Skip to content

Commit 81573de

Browse files
committed
[Project] Set lib copy for python as cmake option
1 parent e922fc4 commit 81573de

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
55
project(cubool LANGUAGES CXX)
66

77
# Exposed to the user build options
8-
option(CUBOOL_WITH_CUDA "Build library with cuda backend (default)" ON)
9-
option(CUBOOL_WITH_SEQUENTIAL "Build library with cpu sequential backend (fallback)" ON)
10-
option(CUBOOL_WITH_NAIVE "Build library with naive and naive-shared dense matrix multiplication" OFF)
11-
option(CUBOOL_BUILD_TESTS "Build project unit-tests with gtest" ON)
8+
option(CUBOOL_WITH_CUDA "Build library with cuda backend (default)" ON)
9+
option(CUBOOL_WITH_SEQUENTIAL "Build library with cpu sequential backend (fallback)" ON)
10+
option(CUBOOL_WITH_NAIVE "Build library with naive and naive-shared dense matrix multiplication" OFF)
11+
option(CUBOOL_BUILD_TESTS "Build project unit-tests with gtest" ON)
12+
option(CUBOOL_COPY_TO_PY_PACKAGE "Copy compiled shared library into python package folder (for package use purposes)" ON)
1213

1314
set(CUBOOL_VERSION_MAJOR 1)
1415
set(CUBOOL_VERSION_MINOR 0)

cubool/CMakeLists.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,16 @@ if (CUBOOL_BUILD_TESTS)
178178
add_subdirectory(tests)
179179
endif()
180180

181-
# todo: Different platforms has specific naming conventions
182-
set(LIBRARY_FILE_NAME "libcubool.so")
183-
184-
# Copy cubool library after build
185-
add_custom_command(
186-
TARGET cubool POST_BUILD
187-
COMMAND "${CMAKE_COMMAND}" -E
188-
copy
189-
"${CMAKE_BINARY_DIR}/cubool/${LIBRARY_FILE_NAME}"
190-
"${CMAKE_BINARY_DIR}/python/pycubool"
191-
COMMENT "Copy cubool lib into python folder")
181+
# Copy cubool library after build if allowed
182+
if (CUBOOL_COPY_TO_PY_PACKAGE)
183+
# todo: Different platforms has specific naming conventions
184+
set(LIBRARY_FILE_NAME "libcubool.so")
185+
186+
add_custom_command(
187+
TARGET cubool POST_BUILD
188+
COMMAND "${CMAKE_COMMAND}" -E
189+
copy
190+
"${CMAKE_BINARY_DIR}/cubool/${LIBRARY_FILE_NAME}"
191+
"${CMAKE_BINARY_DIR}/python/pycubool"
192+
COMMENT "Copy cubool compiled lib into python folder")
193+
endif()

0 commit comments

Comments
 (0)