-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
72 lines (61 loc) · 1.87 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
71
72
cmake_minimum_required(VERSION 3.12)
set(ignoreMe "${SBT}") # sbt-jni defines -DSBT
set(MAKE_COLOR_MAKEFILE ON)
# Define project and related variables
# (required by sbt-jni) please use semantic versioning
#
project (pdaljni)
set(PROJECT_VERSION_MAJOR 2)
set(PROJECT_VERSION_MINOR 8)
set(PROJECT_VERSION_PATCH 0)
set(PDAL_LIB_NAME pdalcpp)
if (APPLE)
set(CMAKE_MACOSX_RPATH ON)
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "@rpath;/usr/local/lib;/opt/homebrew/lib;/opt/local/lib")
endif ()
if (NOT PDAL_BUILD)
set(CMAKE_CXX_FLAGS "-std=c++14")
endif()
# Setup JNI
find_package(JNI REQUIRED)
if (JNI_FOUND)
message (STATUS "JNI include directories: ${JNI_INCLUDE_DIRS}")
endif()
if (NOT PDAL_BUILD)
find_package(PDAL 2.0.0 REQUIRED CONFIG)
endif()
# Include directories
include_directories(.)
include_directories(include)
include_directories(${JNI_INCLUDE_DIRS})
if (APPLE)
include_directories(/usr/local/opt/libxml2/include/libxml2)
else ()
include_directories(/usr/include/libxml2)
endif ()
# Sources
file(GLOB LIB_SRC
"*.c"
"*.cc"
"*.cpp"
)
# Setup installation targets
# (required by sbt-jni) major version should always be appended to library name
#
set (LIB_NAME ${PROJECT_NAME}.${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
if (PDAL_BUILD)
PDAL_ADD_LIBRARY(${LIB_NAME} ${LIB_SRC})
target_link_libraries(${LIB_NAME} PUBLIC
${PDAL_BASE_LIB_NAME}
${PDAL_UTIL_LIB_NAME})
target_include_directories(${LIB_NAME} PRIVATE
${PROJECT_BINARY_DIR}/../../../include)
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${PDAL_LIB_INSTALL_DIR})
else ()
add_library(${LIB_NAME} SHARED ${LIB_SRC})
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION . OPTIONAL)
target_link_libraries(${LIB_NAME} PRIVATE ${PDAL_LIB_NAME})
endif ()