-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
118 lines (102 loc) · 4.26 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
#
# This file is part of the E_Geometry library.
# Copyright (C) 2009-2013 Benjamin Eikel <[email protected]>
# Copyright (C) 2015-2019 Sascha Brandt <[email protected]>
#
# This library is subject to the terms of the Mozilla Public License, v. 2.0.
# You should have received a copy of the MPL along with this library; see the
# file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
#
cmake_minimum_required(VERSION 3.1.0)
project(E_Geometry VERSION 0.3.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set up install directories
include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKECONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/E_Geometry)
add_library(E_Geometry SHARED
E_Box.cpp
ELibGeometry.cpp
E_Frustum.cpp
E_Line3.cpp
E_Matrix3x3.cpp
E_Matrix4x4.cpp
E_Plane.cpp
E_PointOctree.cpp
E_Quaternion.cpp
E_Ray3.cpp
E_Rect.cpp
E_Segment3.cpp
E_Sphere.cpp
E_SRT.cpp
E_Tetrahedron.cpp
E_Triangle.cpp
E_Vec2.cpp
E_Vec3.cpp
E_Vec4.cpp
)
# Dependency to EScript
if(NOT TARGET EScript)
find_package(EScript 0.6.7 REQUIRED NO_MODULE)
endif()
target_link_libraries(E_Geometry LINK_PUBLIC EScript)
# Dependency to Geometry
if(NOT TARGET Geometry)
find_package(Geometry 0.3.0 REQUIRED NO_MODULE)
endif()
target_link_libraries(E_Geometry LINK_PUBLIC Geometry)
if(MSVC)
target_compile_definitions(E_Geometry PRIVATE "EGEOMETRYAPI=__declspec(dllexport)")
target_compile_definitions(E_Geometry INTERFACE "EGEOMETRYAPI=__declspec(dllimport)")
else()
target_compile_definitions(E_Geometry PRIVATE "EGEOMETRYAPI=")
target_compile_definitions(E_Geometry INTERFACE "EGEOMETRYAPI=")
endif()
# Set version of library
set_target_properties(E_Geometry PROPERTIES VERSION ${E_Geometry_VERSION}
SOVERSION ${E_Geometry_VERSION_MAJOR}
POSITION_INDEPENDENT_CODE ON
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
# Install the header files
file(GLOB E_GEOMETRY_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
install(FILES ${E_GEOMETRY_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/E_Geometry COMPONENT headers)
# Install the library
install(TARGETS E_Geometry EXPORT LibraryExport
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtimelibraries
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtimelibraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT developmentlibraries
)
# Set include directories for users of this library
target_include_directories(E_Geometry
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
# Library export
install(EXPORT LibraryExport DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR} FILE E_GeometryTargets.cmake COMPONENT developmentlibraries)
# Create the configuration files
include(CMakePackageConfigHelpers)
configure_package_config_file(E_GeometryConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/E_GeometryConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR}
PATH_VARS CMAKE_INSTALL_CMAKECONFIGDIR
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/E_GeometryConfigVersion.cmake
VERSION ${E_Geometry_VERSION}
COMPATIBILITY SameMajorVersion)
# Install the configuration files
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/E_GeometryConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/E_GeometryConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR} COMPONENT developmentlibraries)
# Packaging
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_NAME "libgeometry${E_Geometry_VERSION_MAJOR}-escript")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "E_Geometry library")
set(CPACK_PACKAGE_VENDOR "Benjamin Eikel; Claudius Jaehn; Ralf Petring; Sascha Brandt")
set(CPACK_PACKAGE_CONTACT "Benjamin Eikel <[email protected]>")
set(CPACK_PACKAGE_VERSION_MAJOR ${E_Geometry_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${E_Geometry_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${E_Geometry_VERSION_PATCH})
set(CPACK_PACKAGE_FILE_NAME "libE_Geometry")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_STRIP_FILES ON)
include(CPack)