Skip to content

Commit 4ff6aa5

Browse files
authored
Merge pull request #24 from WingEternal/master
[chore] move headers into THST folder && add cmake install scripts
2 parents d0cfa73 + 1d63453 commit 4ff6aa5

14 files changed

+69
-3
lines changed

CMakeLists.txt

+56-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ endif()
88
project(THST
99
DESCRIPTION "Templated hierarchical spatial trees designed for high performance and hierarchical spatial partitioning use cases."
1010
LANGUAGES CXX
11+
VERSION 0.1.0
12+
HOMEPAGE_URL "https://github.com/tuxalin/THST"
1113
)
1214

1315
add_library(THST INTERFACE)
1416
add_library(THST::THST ALIAS THST)
1517

1618
target_include_directories(THST
1719
INTERFACE
18-
"${PROJECT_SOURCE_DIR}"
20+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
21+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
1922
)
2023

2124
if(CMAKE_VERSION VERSION_GREATER 3.7)
@@ -26,3 +29,55 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
2629
add_subdirectory(test)
2730
endif()
2831

32+
include(GNUInstallDirs)
33+
install(
34+
TARGETS THST
35+
EXPORT THSTTargets
36+
)
37+
38+
include(CMakePackageConfigHelpers)
39+
write_basic_package_version_file(
40+
"THSTConfigVersion.cmake"
41+
VERSION "${PROJECT_VERSION}"
42+
COMPATIBILITY SameMajorVersion
43+
)
44+
configure_package_config_file(
45+
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
46+
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
47+
INSTALL_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake"
48+
)
49+
50+
configure_file(
51+
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}.pc.in"
52+
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
53+
@ONLY
54+
)
55+
56+
export(
57+
EXPORT ${PROJECT_NAME}Targets
58+
FILE ${PROJECT_NAME}Targets.cmake
59+
NAMESPACE THST::
60+
)
61+
62+
export(PACKAGE ${PROJECT_NAME})
63+
64+
install(
65+
EXPORT ${PROJECT_NAME}Targets
66+
FILE ${PROJECT_NAME}Targets.cmake
67+
NAMESPACE THST::
68+
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake
69+
)
70+
71+
install(
72+
FILES
73+
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
74+
"${PROJECT_BINARY_DIR}/THSTConfigVersion.cmake"
75+
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake
76+
)
77+
78+
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
79+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
80+
81+
install(
82+
DIRECTORY ${PROJECT_SOURCE_DIR}/include/THST
83+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

cmake/THST.pc.in

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includedir=@INCLUDE_INSTALL_DIR@
2+
3+
Name: @PROJECT_NAME@
4+
Description: Templated hierarchical spatial trees designed for high-performance and hierarchical spatial partitioning use cases.
5+
Version: @LIB_VERSION_STRING@
6+
URL: https://github.com/tuaxlin/THST
7+
Cflags: -I${includedir}

cmake/THSTConfig.cmake.in

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@PACKAGE_INIT@
2+
3+
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
4+
check_required_components("@PROJECT_NAME@")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/test_quadtree.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <doctest/doctest.h>
2-
#include <QuadTree.h>
2+
#include <THST/QuadTree.h>
33

44
#include <array>
55
#include <iterator>

test/test_rtree.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#define SPATIAL_TREE_ALLOCATOR 2
66

7-
#include <RTree.h>
7+
#include <THST/RTree.h>
88
#include <iostream>
99
#include <numeric>
1010
#include <sstream>

0 commit comments

Comments
 (0)