You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
4.8 KiB
157 lines
4.8 KiB
From 131b311fe32d328b68c21443a28b08390815e9ac Mon Sep 17 00:00:00 2001
|
|
From: Julien Bernard <julien.bernard@univ-fcomte.fr>
|
|
Date: Fri, 7 Aug 2020 15:24:53 +0200
|
|
Subject: [PATCH 1/2] add install for cmake
|
|
|
|
---
|
|
CMakeLists.txt | 14 ++++++++++++++
|
|
src/CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++++--
|
|
src/box2dConfig.cmake | 3 +++
|
|
3 files changed, 56 insertions(+), 2 deletions(-)
|
|
create mode 100644 src/box2dConfig.cmake
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 92b2c00f9..987d0fb1a 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -5,6 +5,15 @@ project(box2d VERSION 2.4.0)
|
|
|
|
# set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING "" FORCE)
|
|
|
|
+include(GNUInstallDirs)
|
|
+
|
|
+if(NOT CMAKE_CONFIGURATION_TYPES)
|
|
+ if(NOT CMAKE_BUILD_TYPE)
|
|
+ message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
|
|
+ set(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
|
+ endif()
|
|
+endif()
|
|
+
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
add_subdirectory(src)
|
|
@@ -39,3 +48,8 @@ if (BOX2D_BUILD_TESTBED)
|
|
set_property(TARGET testbed PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/testbed")
|
|
endif()
|
|
endif()
|
|
+
|
|
+install(
|
|
+ DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/box2d"
|
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
+)
|
|
diff --git a/src/box2dConfig.cmake b/src/box2dConfig.cmake
|
|
new file mode 100644
|
|
index 000000000..e5f8bc00b
|
|
--- /dev/null
|
|
+++ b/src/box2dConfig.cmake
|
|
@@ -0,0 +1,3 @@
|
|
+get_filename_component(BOX2D_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
|
|
+include("${BOX2D_CMAKE_DIR}/box2dTargets.cmake")
|
|
+include("${BOX2D_CMAKE_DIR}/box2dConfigVersion.cmake")
|
|
|
|
From 82317c288e9052eb3272afd4f4db2a0d5654c69d Mon Sep 17 00:00:00 2001
|
|
From: Julien Bernard <julien.bernard@univ-fcomte.fr>
|
|
Date: Sat, 8 Aug 2020 22:32:01 +0200
|
|
Subject: [PATCH 2/2] install documentation too
|
|
|
|
---
|
|
docs/CMakeLists.txt | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
|
|
index 623bc5e35..edffb4edd 100644
|
|
--- a/docs/CMakeLists.txt
|
|
+++ b/docs/CMakeLists.txt
|
|
@@ -26,3 +26,7 @@ add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}"
|
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs"
|
|
COMMENT "Generating HTML documentation" VERBATIM)
|
|
|
|
+install(
|
|
+ DIRECTORY "${CMAKE_BINARY_DIR}/docs/html"
|
|
+ DESTINATION "${CMAKE_INSTALL_DOCDIR}"
|
|
+)
|
|
--- box2d-2.4.0/src/CMakeLists.txt~ 2020-07-27 01:03:45.000000000 -0500
|
|
+++ box2d-2.4.0/src/CMakeLists.txt 2020-08-10 10:11:13.717443059 -0500
|
|
@@ -95,13 +95,40 @@
|
|
../include/box2d/b2_world_callbacks.h
|
|
../include/box2d/box2d.h)
|
|
|
|
-add_library(box2d STATIC ${BOX2D_SOURCE_FILES} ${BOX2D_HEADER_FILES})
|
|
-target_include_directories(box2d PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
|
+add_library(box2d ${BOX2D_SOURCE_FILES} ${BOX2D_HEADER_FILES})
|
|
+target_include_directories(box2d PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
|
|
target_include_directories(box2d PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
set_target_properties(box2d PROPERTIES
|
|
CXX_STANDARD 11
|
|
CXX_STANDARD_REQUIRED YES
|
|
CXX_EXTENSIONS NO
|
|
+ VERSION ${PROJECT_VERSION}
|
|
+ SOVERSION ${PROJECT_VERSION_MAJOR}
|
|
+)
|
|
+
|
|
+generate_export_header(box2d
|
|
+ BASE_NAME b2
|
|
+ EXPORT_MACRO_NAME B2_API
|
|
+ EXPORT_FILE_NAME b2_api.h
|
|
+ STATIC_DEFINE B2_STATIC
|
|
+)
|
|
+
|
|
+if (NOT BUILD_SHARED_LIBS)
|
|
+ target_compile_definitions(box2d
|
|
+ PUBLIC
|
|
+ B2_STATIC
|
|
+ )
|
|
+endif()
|
|
+
|
|
+target_compile_definitions(box2d
|
|
+ PRIVATE
|
|
+ box2d_EXPORTS
|
|
+)
|
|
+
|
|
+install(
|
|
+ FILES
|
|
+ "${CMAKE_CURRENT_BINARY_DIR}/b2_api.h"
|
|
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/box2d"
|
|
)
|
|
|
|
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "src" FILES ${BOX2D_SOURCE_FILES})
|
|
--- box2d-2.4.0/src/CMakeLists.txt~ 2020-08-10 10:22:41.000000000 -0500
|
|
+++ box2d-2.4.0/src/CMakeLists.txt 2020-08-10 10:28:32.215330614 -0500
|
|
@@ -135,3 +135,35 @@
|
|
|
|
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "src" FILES ${BOX2D_SOURCE_FILES})
|
|
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" PREFIX "include" FILES ${BOX2D_HEADER_FILES})
|
|
+
|
|
+install(
|
|
+ TARGETS box2d
|
|
+ EXPORT box2dTargets
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
+)
|
|
+
|
|
+install(
|
|
+ EXPORT box2dTargets
|
|
+ NAMESPACE box2d::
|
|
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/box2d"
|
|
+)
|
|
+
|
|
+install(
|
|
+ FILES box2dConfig.cmake
|
|
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/box2d"
|
|
+)
|
|
+
|
|
+include(CMakePackageConfigHelpers)
|
|
+
|
|
+write_basic_package_version_file(
|
|
+ "${CMAKE_CURRENT_BINARY_DIR}/box2dConfigVersion.cmake"
|
|
+ VERSION ${PROJECT_VERSION}
|
|
+ COMPATIBILITY SameMajorVersion
|
|
+)
|
|
+
|
|
+install(
|
|
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/box2dConfigVersion.cmake"
|
|
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/box2d"
|
|
+)
|
|
\ No newline at end of file
|