-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
70 lines (67 loc) · 1.81 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
70
cmake_minimum_required(VERSION 3.4...3.18)
project(gerbertools CXX)
include(GNUInstallDirs)
set (CMAKE_CXX_STANDARD 11)
# Target with all the normal C++ files.
add_library(gerbertools_objlib OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/src/clipper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/coord.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/path.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/plot.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/aperture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/aperture_macro.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/gerber.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ncdrill.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/svg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/pcb.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/netlist.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/obj.cpp
)
set_property(
TARGET gerbertools_objlib
PROPERTY POSITION_INDEPENDENT_CODE ON
)
# target_compile_options(
# gerbertools_objlib
# PUBLIC -Wall -Wextra -pedantic -Werror
# )
target_include_directories(
gerbertools_objlib
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Library.
add_library(
gerbertools SHARED
)
target_link_libraries(
gerbertools
PUBLIC gerbertools_objlib
)
install(
TARGETS gerbertools
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
install (
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING PATTERN "*.hpp*"
)
# Python extension.
add_subdirectory(python/pybind11)
pybind11_add_module(
_gerbertools
${CMAKE_CURRENT_SOURCE_DIR}/src/pymod.cpp
)
target_link_libraries(
_gerbertools
PUBLIC gerbertools_objlib
)
if (PYTHON_EXT)
install(
FILES "$<TARGET_FILE:_gerbertools>"
DESTINATION "${PYTHON_DIR}"
RENAME "${PYTHON_EXT}"
)
endif()