Gwyn Ciesla 4 years ago
parent df41230f99
commit f1ea5c788c

1
.gitignore vendored

@ -1,3 +1,4 @@
/Box2D_v2.2.1.zip
/Box2D-2.3.1.tar.gz
/Box2D-2.4.0.tar.gz
/Box2D-2.4.1.tar.gz

@ -1,156 +0,0 @@
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

File diff suppressed because it is too large Load Diff

@ -1,14 +1,12 @@
%global __cmake_in_source_build 1
Name: Box2D
Version: 2.4.0
Version: 2.4.1
Release: 1%{?dist}
Summary: A 2D Physics Engine for Games
License: zlib
URL: http://box2d.org/
Source0: https://github.com/erincatto/box2d/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: 630.patch
Patch1: 631.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake libXi-devel glew-devel glfw-devel
@ -33,8 +31,6 @@ These are the development files.
%prep
%setup -qn box2d-%{version}
%patch0 -p1
%patch1 -p1
rm -rf glew glfw
%build
@ -57,6 +53,9 @@ make install DESTDIR=%{buildroot}
%{_libdir}/cmake/box2d/*.cmake
%changelog
* Mon Oct 19 2020 Gwyn Ciesla <gwync@protonmail.com> - 2.4.1-1
- 2.4.1
* Mon Aug 10 2020 Gwyn Ciesla <gwync@protonmail.com> - 2.4.0-1
- 2.4.0 with patch for cmake shared libs.

@ -1 +1 @@
SHA512 (Box2D-2.4.0.tar.gz) = ce6f9b2d60343e9b87743d9a6703534e89d74f7e34d357510df965c72ac5fcaea4e4904856c9323fe2896cee9afd0dfc2927c11ea3093d93f2da109218c49fee
SHA512 (Box2D-2.4.1.tar.gz) = d900f925b77906777719c91488bdc5e2df1ad1f4a8ca39a574229f5e57070e3a843bdd7530e817112605fde6d82145c872d8afdfc65b84531a73199098c81162

Loading…
Cancel
Save