-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (38 loc) · 1.58 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.5)
project(pypebble)
set(CMAKE_CXX_STANDARD 17)
# Find python and pybind11 - both are required dependencies
find_package(Python 3.7 REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG)
# Optional build flags
option(CGO_DYLD_ENABLED "Enable CGo Dynamic Linking" OFF)
option(COCKROACH "Enable CockroachDB-specific functionality" OFF)
if(COCKROACH)
message(STATUS "CockroachDB support enabled")
add_compile_definitions("COCKROACH_SUPPORT=1")
endif()
# Submodules
add_subdirectory(pebble_bindings)
# Without this, any build libraries automatically have names "lib{x}.so"
set(CMAKE_SHARED_MODULE_PREFIX "")
# pebblepp library
file(GLOB pebblepp_srcs ${CMAKE_CURRENT_SOURCE_DIR}/pebblepp/*.cpp)
add_library(pebblepp STATIC ${pebblepp_srcs})
target_link_libraries(pebblepp binding_lib)
target_include_directories(pebblepp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# pebtest.out executable
# TODO: Refactor this into a real test using gtest
add_executable(pebtest.out
${CMAKE_CURRENT_SOURCE_DIR}/pebblepp/tests/pebtest.cpp)
target_link_libraries(pebtest.out pebblepp)
target_include_directories(pebtest.out PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# pypebble shared module - modules are intended to be imported at runtime.
file(GLOB pypebble_srcs ${CMAKE_CURRENT_SOURCE_DIR}/pypebble/*.cpp)
add_library(pypebble MODULE ${pypebble_srcs})
target_link_libraries(pypebble
pebblepp
pybind11::module
${Python_LIBRARIES})
target_include_directories(pypebble PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${Python_INCLUDE_DIRS})