Gwyn Ciesla 4 years ago
parent 86fe99c942
commit f105ef2e34

1
.gitignore vendored

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

@ -0,0 +1,156 @@
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,136 +0,0 @@
This fixes the CMake build. Fixed upstream here:
https://code.google.com/p/box2d/source/detail?r=313
This does not use the bundled glew and glfw.
Lubomir Rintel <lkundrak@v3.sk>
diff -urp Box2D-2.3.1/CMakeLists.txt Box2D-2.3.1.fix/CMakeLists.txt
--- Box2D-2.3.1/CMakeLists.txt 2015-02-20 14:14:39.000000000 +0100
+++ Box2D-2.3.1.fix/CMakeLists.txt 2015-02-20 14:31:34.347669244 +0100
@@ -26,8 +26,6 @@ if(BOX2D_BUILD_EXAMPLES)
# Testbed and dependencies.
find_package(OpenGL REQUIRED)
- add_subdirectory(freeglut)
- add_subdirectory(glui)
add_subdirectory(Testbed)
endif(BOX2D_BUILD_EXAMPLES)
diff -urp Box2D-2.3.1/Testbed/CMakeLists.txt Box2D-2.3.1.fix/Testbed/CMakeLists.txt
--- Box2D-2.3.1/Testbed/CMakeLists.txt 2015-02-20 14:14:39.000000000 +0100
+++ Box2D-2.3.1.fix/Testbed/CMakeLists.txt 2015-02-20 14:32:42.322404515 +0100
@@ -1,13 +1,17 @@
# Some flags for Freeglut and GLUI.
-add_definitions( -DFREEGLUT_EXPORTS -DFREEGLUT_STATIC -D_CRT_SECURE_NO_WARNINGS )
+add_definitions( -D_CRT_SECURE_NO_WARNINGS )
# Define the framework files.
set(Testbed_Framework_SRCS
Framework/Main.cpp
- Framework/Render.cpp
- Framework/Render.h
+ Framework/RenderGL3.cpp
+ Framework/RenderGL3.h
Framework/Test.cpp
Framework/Test.h
+ Framework/DebugDraw.cpp
+ Framework/DebugDraw.h
+ Framework/imgui.cpp
+ Framework/imgui.h
)
#define the test files.
@@ -72,7 +76,7 @@ if(APPLE)
# We are not using the Apple's framework version, but X11's
include_directories( /usr/X11/include )
link_directories( /usr/X11/lib )
- set (OPENGL_LIBRARIES GL GLU GLUT X11)
+ set (OPENGL_LIBRARIES GL GLU X11)
elseif(WIN32)
set (ADDITIONAL_LIBRARIES winmm)
endif(APPLE)
@@ -85,8 +89,8 @@ add_executable(Testbed
target_link_libraries (
Testbed
Box2D
- freeglut_static
- glui
+ glfw
+ GLEW
${ADDITIONAL_LIBRARIES}
${OPENGL_LIBRARIES}
)
diff --git a/Testbed/Framework/Test.h b/Testbed/Framework/Test.h
index 7e621d4..bb4cb13 100644
--- a/Testbed/Framework/Test.h
+++ b/Testbed/Framework/Test.h
@@ -25,7 +25,7 @@
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#else
-#include <glew/glew.h>
+#include <GL/glew.h>
#endif
#include <glfw/glfw3.h>
diff --git a/Testbed/Framework/DebugDraw.cpp b/Testbed/Framework/DebugDraw.cpp
index 8299611..2a7da6b 100644
--- a/Testbed/Framework/DebugDraw.cpp
+++ b/Testbed/Framework/DebugDraw.cpp
@@ -21,10 +21,10 @@
#if defined(__APPLE_CC__)
#include <OpenGL/gl3.h>
#else
-#include <glew/glew.h>
+#include <GL/glew.h>
#endif
-#include <glfw/glfw3.h>
+#include <GLFW/glfw3.h>
#include <stdio.h>
#include <stdarg.h>
diff --git a/Testbed/Framework/Main.cpp b/Testbed/Framework/Main.cpp
index b494da9..79e2c05 100644
--- a/Testbed/Framework/Main.cpp
+++ b/Testbed/Framework/Main.cpp
@@ -24,10 +24,10 @@
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#else
-#include <glew/glew.h>
+#include <GL/glew.h>
#endif
-#include <glfw/glfw3.h>
+#include <GLFW/glfw3.h>
#include <stdio.h>
#ifdef _MSC_VER
diff --git a/Testbed/Framework/RenderGL3.cpp b/Testbed/Framework/RenderGL3.cpp
index 4613541..115cb93 100644
--- a/Testbed/Framework/RenderGL3.cpp
+++ b/Testbed/Framework/RenderGL3.cpp
@@ -25,7 +25,7 @@
#ifdef __APPLE__
#include <OpenGL/gl3.h>
#else
-#include <glew/glew.h>
+#include <GL/glew.h>
#include <GL/gl.h>
#endif
diff --git a/Testbed/Framework/Test.h b/Testbed/Framework/Test.h
index bb4cb13..f6c69f3 100644
--- a/Testbed/Framework/Test.h
+++ b/Testbed/Framework/Test.h
@@ -27,7 +27,7 @@
#else
#include <GL/glew.h>
#endif
-#include <glfw/glfw3.h>
+#include <GLFW/glfw3.h>
#include <stdlib.h>

@ -1,17 +1,14 @@
%global __cmake_in_source_build 1
Name: Box2D
Version: 2.3.1
Release: 13%{?dist}
Version: 2.4.0
Release: 1%{?dist}
Summary: A 2D Physics Engine for Games
License: zlib
URL: http://box2d.org/
# "Google Code no longer allows for downloads, therefore you will have to use SVN to get v2.3.1"
# <http://box2d.org/2014/04/box2d-v2-3-1-released/>
# svn checkout http://box2d.googlecode.com/svn/tags/v2.3.1/Box2D Box2D-2.3.1
# (^^^ beware only legacy IP works, IPv6 seems broken)
# tar --exclude .svn -czf Box2D-2.3.1.tar.gz Box2D-2.3.1
Source0: %{name}-%{version}.tar.gz
Patch0: Box2D-2.3.1-cmake.patch
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
@ -35,40 +32,34 @@ we encourage you to give credit to Box2D in your product.
These are the development files.
%prep
%setup -q
%setup -qn box2d-%{version}
%patch0 -p1
%patch1 -p1
rm -rf glew glfw
%build
sed -i 's/\r//' License.txt
sed -i 's/\r//' Readme.txt
pushd Box2D
%cmake -DBOX2D_INSTALL=ON -DBOX2D_BUILD_SHARED=ON ..
%cmake -DBOX2D_INSTALL=ON -DBOX2D_BUILD_SHARED=ON .
make
%install
pushd Box2D
make install DESTDIR=%{buildroot}
find %{buildroot} -name '*.cmake' | xargs rm
find %{buildroot} -name '*.a' | xargs rm
%ldconfig_scriptlets
%files
%doc License.txt
%{_libdir}/*.so.*
%license LICENSE
%{_libdir}/*.so.2*
%files devel
%doc Readme.txt Documentation/
%doc README.md docs/
%{_libdir}/*.so
%{_includedir}/Box2D
%{_includedir}/box2d
%{_libdir}/cmake/box2d/*.cmake
%changelog
* Mon Aug 10 2020 Gwyn Ciesla <gwync@protonmail.com> - 2.4.0-1
- 2.4.0 with patch for cmake shared libs.
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

@ -1 +1 @@
ab0674782d4ef754ea2578a704dc2945 Box2D-2.3.1.tar.gz
SHA512 (Box2D-2.4.0.tar.gz) = ce6f9b2d60343e9b87743d9a6703534e89d74f7e34d357510df965c72ac5fcaea4e4904856c9323fe2896cee9afd0dfc2927c11ea3093d93f2da109218c49fee

Loading…
Cancel
Save