Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
45 lines (40 loc) · 1.63 KB
/
Copy pathCMakeLists.txt
File metadata and controls
45 lines (40 loc) · 1.63 KB
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
cmake_minimum_required(VERSION 3.18)
project(boostree LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# scikit-build-core sets Release/-O3 by default. Add LTO; do NOT add
# -march=native or any ISA flags here — wheels must run on any CPU
# matching the platform tag, not just the build runner's
include(CheckIPOSupported)
check_ipo_supported(RESULT _has_ipo)
# Boost.Geometry headers are vendored under third_party/boost (run
# scripts/vendor_boost.py to refresh from a Boost source tree). The
# rare developer who wants to use a system Boost can set
# BOOSTREE_USE_SYSTEM_BOOST=ON
option(BOOSTREE_USE_SYSTEM_BOOST "Build against system Boost.Geometry" OFF)
if(BOOSTREE_USE_SYSTEM_BOOST)
find_package(Boost 1.75 REQUIRED)
set(_boost_inc ${Boost_INCLUDE_DIRS})
else()
set(_boost_inc ${PROJECT_SOURCE_DIR}/third_party/boost)
endif()
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
find_package(OpenMP COMPONENTS CXX)
pybind11_add_module(_core src/_core.cc)
target_include_directories(_core PRIVATE ${_boost_inc})
if(_has_ipo)
set_property(TARGET _core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if(OpenMP_CXX_FOUND)
target_link_libraries(_core PRIVATE OpenMP::OpenMP_CXX)
target_compile_definitions(_core PRIVATE BOOSTREE_HAS_OPENMP=1)
message(STATUS "OpenMP enabled (parallel batched queries)")
else()
message(STATUS "OpenMP not found — batched queries will run serial")
endif()
install(TARGETS _core LIBRARY DESTINATION boostree)