-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
31 lines (24 loc) · 1.21 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
cmake_minimum_required(VERSION 3.4...3.18)
project(pyhbst LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ version selection") # or 11, 14, 17, 20
set(CMAKE_CXX_STANDARD_REQUIRED ON) # optional, ensure standard is supported
set(CMAKE_CXX_EXTENSIONS OFF) # optional, keep compiler extensions off
set(BUILD_WITH_MARCH_NATIVE OFF CACHE BOOL "Enable architecture-aware optimization (-march=native)")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -O2")
if(BUILD_WITH_MARCH_NATIVE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=native -march=native")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -mtune=native -march=native")
message(STATUS "Architecture-aware optimization (-march=native): ENABLED")
else()
message(STATUS "Architecture-aware optimization (-march=native): DISABLED")
endif()
option(PYTHON_BUILD "Turn python build on" ON)
add_subdirectory(extern/pybind11)
set(PY_ALL_HEADER_FILES
srrg_hbst/types/binary_match.hpp
srrg_hbst/types/binary_matchable.hpp
srrg_hbst/types/binary_node.hpp
srrg_hbst/types/binary_tree.hpp)
pybind11_add_module(pyhbst pyhbst.cc ${PY_ALL_HEADER_FILES})
target_compile_definitions(pyhbst PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})