-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
61 lines (50 loc) · 2.33 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
# This file should be used as a template for creating new projects with Python
# wrapping using the CMake tools
# ##############################################################################
# To create your own project, replace "wrap_example" with the actual name of
# your project
cmake_minimum_required(VERSION 3.9)
# If you change the project name, you also need to change the folder name of
# `python/wrap_example_py`
project(wrap_example CXX C)
set(CXX_STANDARD 11)
# ##############################################################################
# Set the python version
set(WRAP_PYTHON_VERSION
"Default"
CACHE STRING "The Python version to use for wrapping")
# ##############################################################################
# Find the gtwrap package so we have access to the wrapper
find_package(gtwrap)
# ##############################################################################
# Add the local source directory for CMake Ensure that local folder is searched
# before library folders
include_directories(BEFORE "${PROJECT_SOURCE_DIR}")
# ##############################################################################
# Build static library from common sources
add_library(${PROJECT_NAME} SHARED src/greeting.h src/greeting.cpp)
target_link_libraries(${PROJECT_NAME})
# ##############################################################################
# Install library
install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)
# ##############################################################################
# Build Pybind wrapper.
# This is our in-house wrapper project which parses an interface file
# to generate the wrapper.
# Installing it follows the standard CMake process.
# CMake flag to wrap this project.
option(WRAP_EXAMPLE_BUILD_PYTHON "Build the Python wrapper" ON)
# Set the version for the project. Needed for setup.py.
set(WRAP_EXAMPLE_VERSION_STRING 1.0.0) # Needed for generating setup.py
if(WRAP_EXAMPLE_BUILD_PYTHON)
add_subdirectory(python)
endif()
message("========== Configuration Options ==========")
message(STATUS "Project: ${PROJECT_NAME}")
message(STATUS "Build Python: ${WRAP_EXAMPLE_BUILD_PYTHON}")
message(STATUS "Python Version: ${WRAP_PYTHON_VERSION}")
message("===========================================")