summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2024-01-08 15:15:42 -0500
committerJonathan Bradley <jcb@pikum.xyz>2024-01-08 15:15:42 -0500
commit8e70544b340c8987daca3eb9053f026d4d96c616 (patch)
tree6dd223a6237f31d8b0e76e6ef46964826db6b459
parent3aa95ba29a779d695c2a16905c651be768231212 (diff)
cmake install commands for pke - first pass
-rw-r--r--CMakeLists.txt54
-rw-r--r--editor/CMakeLists.txt5
-rw-r--r--runtime/CMakeLists.txt5
-rw-r--r--src/cmake/Usepke.cmake8
-rw-r--r--src/cmake/pke.pc.cmake11
-rw-r--r--src/cmake/pkeConfig.cmake.in24
-rw-r--r--test/CMakeLists.txt3
7 files changed, 109 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a71a249..16284b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.27)
cmake_policy(SET CMP0135 NEW)
project(pke VERSION 0.0)
+set(PKE_VERSION ${PROJECT_VERSION})
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -105,6 +106,12 @@ set(ImGuiDockedFiles
)
add_library(imguidocked ${ImGuiDockedFiles})
target_include_directories(imguidocked PUBLIC ${imguidocked_SOURCE_DIR})
+install(
+ TARGETS imguidocked
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
find_package(Vulkan REQUIRED)
if (Vulkan_FOUND)
@@ -178,7 +185,8 @@ if(NOT bullet_POPULATED)
set(BUILD_OPENGL3_DEMOS 0 CACHE STRING "" FORCE)
set(BUILD_EXTRAS 0 CACHE STRING "" FORCE)
set(INSTALL_EXTRA_LIBS 0 CACHE STRING "" FORCE)
- set(INSTALL_LIBS 0 CACHE STRING "" FORCE)
+ set(INSTALL_LIBS 1 CACHE STRING "" FORCE)
+ set(INSTALL_CMAKE_FILES 0 CACHE STRING "" FORCE)
set(POSITION_INDEPENDENT_CODE O CACHE BOOL "" FORCE)
FetchContent_Populate(bullet)
add_subdirectory(${bullet_SOURCE_DIR} ${bullet_BINARY_DIR})
@@ -196,6 +204,50 @@ target_link_libraries(pke PUBLIC imguidocked)
add_dependencies(pke shaders)
+# install libs
+set(LIB_DESTINATION "lib")
+set(INCLUDE_INSTALL_DIR "include/pke")
+set(PKGCONFIG_INSTALL_PREFIX "lib/pkgconfig")
+IF(NOT MSVC)
+ configure_file("src/cmake/pke.pc.cmake" ${CMAKE_CURRENT_BINARY_DIR}/pke.pc @ONLY)
+ install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/pke.pc
+ DESTINATION
+ ${PKGCONFIG_INSTALL_PREFIX}
+ )
+ENDIF()
+install(
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/
+ DESTINATION ${INCLUDE_INSTALL_DIR}
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "cmake" EXCLUDE
+)
+install(
+ TARGETS pke
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
+# install cmake files
+set (PKE_CONFIG_CMAKE_PATH lib/cmake/pke )
+# list (APPEND PKE_DEFINITIONS "SOME_VAL")
+list(APPEND PKE_DEFINITIONS "")
+list(APPEND PKE_LIBRARIES pke)
+set(PKE_USE_FILE src/cmake/Usepke.cmake)
+configure_file(src/cmake/pkeConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/pkeConfig.cmake
+ @ONLY ESCAPE_QUOTES
+)
+install(FILES
+ src/cmake/Usepke.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/pkeConfig.cmake
+ DESTINATION ${PKE_CONFIG_CMAKE_PATH}
+)
+
add_subdirectory(editor)
add_subdirectory(runtime)
add_subdirectory(test)
diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt
index eaa72f8..b1f3d64 100644
--- a/editor/CMakeLists.txt
+++ b/editor/CMakeLists.txt
@@ -10,3 +10,8 @@ add_executable(pke_editor
)
target_link_libraries(pke_editor PRIVATE pke)
target_include_directories(pke_editor PRIVATE pke)
+
+install(
+ TARGETS pke_editor
+ RUNTIME DESTINATION bin
+)
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 24349aa..9510970 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -8,3 +8,8 @@ add_executable(pke_runtime
)
target_link_libraries(pke_runtime PRIVATE pke)
target_include_directories(pke_runtime PRIVATE pke)
+
+install(
+ TARGETS pke_runtime
+ RUNTIME DESTINATION bin
+)
diff --git a/src/cmake/Usepke.cmake b/src/cmake/Usepke.cmake
new file mode 100644
index 0000000..b241a3c
--- /dev/null
+++ b/src/cmake/Usepke.cmake
@@ -0,0 +1,8 @@
+#
+# Usepke.cmake
+#
+
+add_definitions ( ${PKE_DEFINITIONS} )
+include_directories ( ${PKE_INCLUDE_DIRS} )
+link_directories ( ${PKE_LIBRARY_DIRS} )
+
diff --git a/src/cmake/pke.pc.cmake b/src/cmake/pke.pc.cmake
new file mode 100644
index 0000000..3fe11ae
--- /dev/null
+++ b/src/cmake/pke.pc.cmake
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIB_DESTINATION@
+includedir=${prefix}/@INCLUDE_INSTALL_DIR@
+
+Name: pke
+Description: pke - Pikul Engine Core Library
+Version: @PKE_VERSION@
+Requires:
+Libs: -L${libdir}
+Cflags: -I${includedir} -I${prefix}/include
diff --git a/src/cmake/pkeConfig.cmake.in b/src/cmake/pkeConfig.cmake.in
new file mode 100644
index 0000000..250b6ab
--- /dev/null
+++ b/src/cmake/pkeConfig.cmake.in
@@ -0,0 +1,24 @@
+#
+# pkeConfig.cmake(.in)
+#
+
+# Use the following variables to compile and link against Bullet:
+# PKE_FOUND - True if pke was found on your system
+# PKE_USE_FILE - The file making pke usable
+# PKE_DEFINITIONS - Definitions needed to build with pke
+# PKE_INCLUDE_DIR - Directory where pke headers can be found
+# PKE_INCLUDE_DIRS - List of directories of pke and it's dependencies
+# PKE_LIBRARIES - List of libraries to link against the pke library
+# PKE_LIBRARY_DIRS - List of directories containing pke' libraries
+# PKE_ROOT_DIR - The base directory of pke
+# PKE_VERSION_STRING - A human-readable string containing the version
+
+set ( PKE_FOUND 1 )
+set ( PKE_USE_FILE "@PKE_USE_FILE@" )
+set ( PKE_DEFINITIONS "@PKE_DEFINITIONS@" )
+set ( PKE_INCLUDE_DIR "@INCLUDE_INSTALL_DIR@" )
+set ( PKE_INCLUDE_DIRS "@INCLUDE_INSTALL_DIR@" )
+set ( PKE_LIBRARIES "@PKE_LIBRARIES@" )
+set ( PKE_LIBRARY_DIRS "@LIB_DESTINATION@" )
+set ( PKE_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" )
+set ( PKE_VERSION_STRING "@PKE_VERSION@" )
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 760756d..7cd4908 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,4 +1,7 @@
include(FetchContent)
+
+set(INSTALL_GTEST OFF)
+set(INSTALL_GMOCK OFF)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/8d51dc50eb7e7698427fed81b85edad0e032112e.zip