-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
146 lines (123 loc) · 4.23 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
cmake_minimum_required(VERSION 2.8.11)
project(pqp)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 3)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
set(
HDRS
src/BV.h
src/PQP.h
src/PQP_Compile.h
src/PQP_Internal.h
src/Tri.h
)
set(
SRCS
src/Build.cpp
src/BV.cpp
src/PQP.cpp
src/TriDist.cpp
)
add_library(PQP STATIC ${HDRS} ${SRCS})
target_include_directories(
PQP
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties(
PQP
PROPERTIES
DEBUG_POSTFIX d
POSITION_INDEPENDENT_CODE ON
VERSION ${VERSION}
)
install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT development)
install(
TARGETS PQP
EXPORT PQP
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime
)
option(BUILD_SAMPLES "Build samples" OFF)
if(BUILD_SAMPLES)
add_executable(sample demos/sample/main.cpp)
target_link_libraries(sample PQP)
find_package(GLUT)
find_package(OpenGL)
find_package(X11)
if(GLUT_FOUND AND OPENGL_FOUND AND X11_FOUND)
configure_file(demos/spinning/bunny.tris bunny.tris COPYONLY)
configure_file(demos/spinning/torus.tris torus.tris COPYONLY)
add_executable(spinning demos/spinning/main.cpp demos/spinning/model.cpp)
target_include_directories(spinning PRIVATE ${GLUT_INCLUDE_DIR} ${X11_INCLUDE_DIR})
target_link_libraries(spinning PQP ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ${X11_LIBRARIES})
configure_file(demos/falling/torus1.path torus1.path COPYONLY)
configure_file(demos/falling/torus1.tris torus1.tris COPYONLY)
configure_file(demos/falling/torus2.path torus2.path COPYONLY)
configure_file(demos/falling/torus2.tris torus2.tris COPYONLY)
add_executable(falling demos/falling/main.cpp demos/falling/model.cpp)
target_include_directories(falling PRIVATE ${GLUT_INCLUDE_DIR} ${X11_INCLUDE_DIR})
target_link_libraries(falling PQP ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ${X11_LIBRARIES})
endif()
endif()
configure_package_config_file(
pqp-config.cmake.in pqp-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PQP-${VERSION}
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/pqp-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PQP-${VERSION}
COMPONENT development
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/pqp-config-version.cmake
VERSION ${VERSION}
COMPATIBILITY ExactVersion
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/pqp-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PQP-${VERSION}
COMPONENT development
)
install(
EXPORT PQP
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PQP-${VERSION}
NAMESPACE PQP::
FILE pqp-export.cmake
COMPONENT development
)
set(CPACK_COMPONENT_DEVELOPMENT_DEPENDS runtime)
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_DEPENDS "libpqp")
set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_NAME "libpqp-dev")
set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_SECTION "libdevel")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://gamma.cs.unc.edu/SSV/")
set(CPACK_DEBIAN_PACKAGE_NAME "libpqp")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "libpqp")
set(CPACK_DEBIAN_RUNTIME_PACKAGE_SECTION "libs")
set(CPACK_NSIS_PACKAGE_NAME "PQP ${VERSION}")
set(CPACK_NSIS_URL_INFO_ABOUT ${CPACK_DEBIAN_PACKAGE_HOMEPAGE})
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_DISPLAY_NAME "PQP ${VERSION}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "PQP-${VERSION}")
set(CPACK_PACKAGE_NAME "pqp")
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_development_PACKAGE_NAME "pqp-devel")
set(CPACK_RPM_development_PACKAGE_REQUIRES "pqp")
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
set(CPACK_RPM_PACKAGE_NAME "pqp")
set(CPACK_RPM_PACKAGE_URL ${CPACK_DEBIAN_PACKAGE_HOMEPAGE})
set(CPACK_RPM_runtime_PACKAGE_NAME "pqp")
if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
endif()
include(CPack)