forked from fairtide/aeron-python
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
69 lines (55 loc) · 1.97 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required(VERSION 3.7)
project(aeron-python)
set(PYTHON_VERSION 3 CACHE STRING "Target version of python")
message(STATUS "Requested python version: ${PYTHON_VERSION}")
set(RELEASE_VERSION unknown CACHE STRING "Target release version")
message(STATUS "Release version: ${RELEASE_VERSION}")
# register modules
include(CTest)
include(ExternalProject)
set(CMAKE_CXX_STANDARD 14)
add_definitions(-Wno-unknown-attributes -fvisibility=hidden -fPIC)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
set(RT_LIBRARY "rt")
endif()
# find boost
find_package(Boost COMPONENTS system REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
# find python
find_package(Python 3.9...<3.10 COMPONENTS Interpreter Development)
if (PYTHON_FOUND)
message(STATUS "Found Python interpreter: ${PYTHON_VERSION}")
else ()
message(FATAL_ERROR "Python not found!")
endif ()
include_directories(${Python_INCLUDE_DIRS})
message(STATUS "Python include path: " ${Python_INCLUDE_DIRS})
# setup CMake to run tests
enable_testing()
# include subdirectories
add_subdirectory(external)
add_subdirectory(sources)
add_subdirectory(tests)
# define package build targets
add_custom_target(build-package
COMMAND
tar -cvf ${CMAKE_BINARY_DIR}/aeron_python.tar
sources
external
tests
CMakeLists.txt
LICENSE
README.md
setup.py
PKG-INFO
COMMAND gzip ${CMAKE_BINARY_DIR}/aeron_python.tar
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_custom_target(build-wheel
COMMAND
${CMAKE_COMMAND} -E env
CMAKE=${CMAKE_COMMAND}
CC=${CMAKE_C_COMPILER}
CXX=${CMAKE_CXX_COMPILER}
${Python_EXECUTABLE} setup.py bdist_wheel -d ${CMAKE_BINARY_DIR} -b ${CMAKE_BINARY_DIR}/wheel_build
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")