-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
48 lines (34 loc) · 1.28 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
cmake_minimum_required(VERSION 3.18)
project(clipper2c LANGUAGES CXX)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CLIPPER2_UTILS OFF)
set(CLIPPER2_EXAMPLES OFF)
set(CLIPPER2_TESTS OFF)
set(CLIPPER2_USINGZ "OFF" CACHE STRING "Preempt cache default of USINGZ (only binding 2d)")
add_definitions(-D_HAS_EXCEPTIONS=0) # disable exceptions for STL
option(BUILD_SHARED_LIBS OFF)
add_compile_options(-fPIC)
add_subdirectory(vendor/Clipper2/CPP)
# Build svg from utils without forced static linking (altered from Clipper2 CMakeLists.txt)
set(CLIPPER2_SVG_INC
vendor/Clipper2/CPP/Utils/clipper.svg.h
)
set(CLIPPER2_SVG_SRC
vendor/Clipper2/CPP/Utils/clipper.svg.cpp
)
add_library(Clipper2svg ${CLIPPER2_SVG_INC} ${CLIPPER2_SVG_SRC})
target_link_libraries(Clipper2svg PUBLIC Clipper2)
set_target_properties(Clipper2svg PROPERTIES FOLDER Libraries)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(Clipper2svg PRIVATE -Wno-unused-variable -Wno-unused-function)
endif()
# C Bindings
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
add_library(clipper2c ${SOURCE_FILES})
target_link_libraries(
clipper2c
PRIVATE Clipper2 Clipper2svg
)
target_include_directories(clipper2c PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_compile_features(clipper2c PRIVATE cxx_std_17)