From 1837b24fae43f670bfd1b65586d14d71c0094d50 Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Fri, 19 Jul 2024 12:32:10 -0400 Subject: [PATCH 01/14] start initial work on 5.0.0 --- recipes/joltphysics/all/conandata.yml | 3 +++ recipes/joltphysics/all/test_package/CMakeLists.txt | 2 ++ recipes/joltphysics/config.yml | 2 ++ 3 files changed, 7 insertions(+) diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/all/conandata.yml index 3b85494834125..8a3bbec8b4a5d 100644 --- a/recipes/joltphysics/all/conandata.yml +++ b/recipes/joltphysics/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.0.0": + url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v5.0.0.tar.gz" + sha256: "5231953d1b1d5b9cb617facf86341a11337e1cd04456949af6911b917a1646cb" "3.0.1": url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v3.0.1.tar.gz" sha256: "7ebb40bf2dddbcf0515984582aaa197ddd06e97581fd55b98cb64f91b243b8a6" diff --git a/recipes/joltphysics/all/test_package/CMakeLists.txt b/recipes/joltphysics/all/test_package/CMakeLists.txt index 0b69831ca4aa0..60017edbe07d7 100644 --- a/recipes/joltphysics/all/test_package/CMakeLists.txt +++ b/recipes/joltphysics/all/test_package/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) +add_definitions(-DJPH_PROFILE_ENABLED=0 -DJPH_DEBUG_RENDERER=0) + find_package(joltphysics REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/joltphysics/config.yml b/recipes/joltphysics/config.yml index 41bbdfae2300d..f9ce02e050979 100644 --- a/recipes/joltphysics/config.yml +++ b/recipes/joltphysics/config.yml @@ -1,4 +1,6 @@ versions: + "5.0.0": + folder: all "3.0.1": folder: all "2.0.1": From 78cce1d59eba793307120498032259d6a063dbb8 Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Thu, 5 Sep 2024 02:07:23 -0400 Subject: [PATCH 02/14] add version 5.1.0 to sources --- recipes/joltphysics/all/conandata.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/all/conandata.yml index 8a3bbec8b4a5d..63de900150bd2 100644 --- a/recipes/joltphysics/all/conandata.yml +++ b/recipes/joltphysics/all/conandata.yml @@ -1,5 +1,8 @@ sources: - "5.0.0": + "5.1.0": + url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v5.1.0.tar.gz" + sha256: "525c9d6fb79471b3995f9d621c9f843e71470aed286872c4d4065c1f7b7d049a" + "5.0.1": url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v5.0.0.tar.gz" sha256: "5231953d1b1d5b9cb617facf86341a11337e1cd04456949af6911b917a1646cb" "3.0.1": From 2f4afcbf621796f934863d64b7693c7b1f538e86 Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Thu, 5 Sep 2024 02:09:36 -0400 Subject: [PATCH 03/14] update config.yml with new versions --- recipes/joltphysics/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/joltphysics/config.yml b/recipes/joltphysics/config.yml index f9ce02e050979..9f1ac754387b6 100644 --- a/recipes/joltphysics/config.yml +++ b/recipes/joltphysics/config.yml @@ -1,5 +1,7 @@ versions: - "5.0.0": + "5.1.0": + folder: all + "5.0.1": folder: all "3.0.1": folder: all From 2fa7c144f3c0eeb752403062d7cf80fc2720977e Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Wed, 18 Sep 2024 16:43:35 -0400 Subject: [PATCH 04/14] revert: go back to initial cmakelists --- recipes/joltphysics/all/test_package/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/joltphysics/all/test_package/CMakeLists.txt b/recipes/joltphysics/all/test_package/CMakeLists.txt index 60017edbe07d7..0b69831ca4aa0 100644 --- a/recipes/joltphysics/all/test_package/CMakeLists.txt +++ b/recipes/joltphysics/all/test_package/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -add_definitions(-DJPH_PROFILE_ENABLED=0 -DJPH_DEBUG_RENDERER=0) - find_package(joltphysics REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) From 87a44ee6d5237b3b945676bbb3f545452bca7079 Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Sat, 21 Sep 2024 14:32:54 -0400 Subject: [PATCH 05/14] feat: add in all new options for most updated jolt physics version --- recipes/joltphysics/all/conanfile.py | 203 ++++++++++++++++++++------- 1 file changed, 150 insertions(+), 53 deletions(-) diff --git a/recipes/joltphysics/all/conanfile.py b/recipes/joltphysics/all/conanfile.py index ef2cbdfc71184..994e166649d67 100644 --- a/recipes/joltphysics/all/conanfile.py +++ b/recipes/joltphysics/all/conanfile.py @@ -24,18 +24,97 @@ class JoltPhysicsConan(ConanFile): package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], "fPIC": [True, False], - "simd": ["sse", "sse41", "sse42", "avx", "avx2", "avx512"], + + "use_asserts": [True, False], + "double_precision": [True, False], + "generate_debug_symbols": [True, False], + "override_cxx_flags": [True, False], + "cross_platform_deterministic": [True, False], + "cross_compile_arm": [True, False], + "build_shared_libs": [True, False], + "interprocedural_optimization": [True, False], + "floating_point_exceptions_enabled": [True, False], + "cpp_exceptions_enabled": [True, False], + "cpp_rtti_enabled": [True, False], + + "object_layer_bits": [16, 32], + + "use_sse4_1": [True, False], + "use_sse4_2": [True, False], + "use_avx": [True, False], + "use_avx2": [True, False], + "use_avx512": [True, False], + "use_lzcnt": [True, False], + "use_tzcnt": [True, False], + "use_f16c": [True, False], + "use_fmadd": [True, False], + + "use_wasm_simd": [True, False], + "enable_all_warnings": [True, False], + + "track_broadphase_stats": [True, False], + "track_narrowphase_stats": [True, False], + "debug_renderer": [True, False], + "debug_renderer_in_debug_and_release": [True, False], + "debug_renderer_in_distribution": [True, False], + + "profiler": [True, False], + "profiler_in_debug_and_release": [True, False], + "profiler_in_distribution": [True, False], + + "disable_custom_allocator": [True, False], + "use_std_vector": [True, False], + "enable_object_stream": [True, False], + "enable_install": [True, False], "profile": [True, False], } default_options = { - "shared": False, + "build_shared_libs": False, "fPIC": True, - "simd": "sse42", - "debug_renderer": False, - "profile": False, + + "use_asserts": False, + "double_precision": False, + "generate_debug_symbols": True, + "override_cxx_flags": True, + "cross_platform_deterministic": False, + "cross_compile_arm": False, + "build_shared_libs": False, + "interprocedural_optimization": True, + "floating_point_exceptions_enabled": False, + "cpp_exceptions_enabled": False, + "cpp_rtti_enabled": False, + "object_layer_bits": 16, + + "use_sse4_1": True, + "use_sse4_2": True, + "use_avx": True, + "use_avx2": True, + "use_avx512": False, + "use_lzcnt": True, + "use_tzcnt": True, + "use_f16c": True, + "use_fmadd": True, + + "use_wasm_simd": False, + "enable_all_warnings": True, + + "track_broadphase_stats": False, + "track_narrowphase_stats": False, + + "debug_renderer": False, # so long as the following two options are false, this variable comes into effect, this is added as a custom conan option so that you can have custom debug renderer behavior + "debug_renderer_in_debug_and_release": True, + "debug_renderer_in_distribution": False, + + "profiler": False, # so long as the following two options are false, this variable comes into effect, this is added as a custom conan option so that you can have custom profiler behavior + "profiler_in_debug_and_release": True, + "profiler_in_distribution": False, + + "disable_custom_allocator": False, + "use_std_vector": False, + "enable_object_stream": True, + "enable_install": True, } @property @@ -52,37 +131,17 @@ def _compilers_minimum_version(self): "apple-clang": "12", } - @property - def _has_sse41(self): - return self.options.get_safe("simd") in ("sse41", "sse42", "avx", "avx2", "avx512") - - @property - def _has_sse42(self): - return self.options.get_safe("simd") in ("sse42", "avx", "avx2", "avx512") - - @property - def _has_avx(self): - return self.options.get_safe("simd") in ("avx", "avx2", "avx512") - - @property - def _has_avx2(self): - return self.options.get_safe("simd") in ("avx2", "avx512") - - @property - def _has_avx512(self): - return self.options.get_safe("simd") == "avx512" - def export_sources(self): export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.arch not in ("x86", "x86_64"): - del self.options.simd + # if self.settings.arch not in ("x86", "x86_64"): + # del self.options.simd def configure(self): - if self.options.shared: + if self.options.build_shared_libs: self.options.rm_safe("fPIC") def layout(self): @@ -107,7 +166,7 @@ def loose_lt_semver(v1, v2): f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) - if is_msvc(self) and self.options.shared: + if is_msvc(self) and self.options.build_shared_libs: raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") def source(self): @@ -115,6 +174,7 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + # Disable all testing: https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conanfile_attributes.md#options-to-avoid tc.variables["TARGET_UNIT_TESTS"] = False tc.variables["TARGET_HELLO_WORLD"] = False tc.variables["TARGET_PERFORMANCE_TEST"] = False @@ -122,17 +182,53 @@ def generate(self): tc.variables["TARGET_VIEWER"] = False tc.variables["GENERATE_DEBUG_SYMBOLS"] = False tc.variables["TARGET_UNIT_TESTS"] = False - tc.variables["USE_SSE4_1"] = self._has_sse41 - tc.variables["USE_SSE4_2"] = self._has_sse42 - tc.variables["USE_AVX"] = self._has_avx - tc.variables["USE_AVX2"] = self._has_avx2 - tc.variables["USE_AVX512"] = self._has_avx512 + if is_msvc(self): tc.variables["USE_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self) - tc.variables["JPH_DEBUG_RENDERER"] = self.options.debug_renderer - tc.variables["JPH_PROFILE_ENABLED"] = self.options.profile - if Version(self.version) >= "3.0.0": - tc.variables["ENABLE_ALL_WARNINGS"] = False + + tc.variables["USE_ASSERTS"] = self.options.use_asserts + tc.variables["DOUBLE_PRECISION"] = self.options.double_precision + tc.variables["GENERATE_DEBUG_SYMBOLS"] = self.options.generate_debug_symbols + tc.variables["OVERRIDE_CXX_FLAGS"] = self.options.override_cxx_flags + tc.variables["CROSS_PLATFORM_DETERMINISTIC"] = self.options.cross_platform_deterministic + tc.variables["CROSS_COMPILE_ARM"] = self.options.cross_compile_arm + tc.variables["BUILD_SHARED_LIBS"] = self.options.build_shared_libs + tc.variables["INTERPROCEDURAL_OPTIMIZATION"] = self.options.interprocedural_optimization + tc.variables["FLOATING_POINT_EXCEPTIONS_ENABLED"] = self.options.floating_point_exceptions_enabled + tc.variables["CPP_EXCEPTIONS_ENABLED"] = self.options.cpp_exceptions_enabled + tc.variables["CPP_RTTI_ENABLED"] = self.options.cpp_rtti_enabled + tc.variables["OBJECT_LAYER_BITS"] = self.options.object_layer_bits + + # Select X86 processor features to use + tc.variables["USE_SSE4_1"] = self.options.use_sse4_1 + tc.variables["USE_SSE4_2"] = self.options.use_sse4_2 + tc.variables["USE_AVX"] = self.options.use_avx + tc.variables["USE_AVX2"] = self.options.use_avx2 + tc.variables["USE_AVX512"] = self.options.use_avx512 + tc.variables["USE_LZCNT"] = self.options.use_lzcnt + tc.variables["USE_TZCNT"] = self.options.use_tzcnt + tc.variables["USE_F16C"] = self.options.use_f16c + tc.variables["USE_FMADD"] = self.options.use_fmadd + + tc.variables["USE_WASM_SIMD"] = self.options.use_wasm_simd + tc.variables["ENABLE_ALL_WARNINGS"] = self.options.enable_all_warnings + tc.variables["TRACK_BROADPHASE_STATS"] = self.options.track_broadphase_stats + tc.variables["TRACK_NARROWPHASE_STATS"] = self.options.track_narrowphase_stats + + tc.variables["DEBUG_RENDERER_IN_DEBUG_AND_RELEASE"] = self.options.debug_renderer_in_debug_and_release + tc.variables["DEBUG_RENDERER_IN_DISTRIBUTION"] = self.options.debug_renderer_in_distribution + + tc.variables["PROFILER_IN_DEBUG_AND_RELEASE"] = self.options.profiler_in_debug_and_release + tc.variables["PROFILER_IN_DISTRIBUTION"] = self.options.profiler_in_distribution + + tc.variables["DISABLE_CUSTOM_ALLOCATOR"] = self.options.disable_custom_allocator + tc.variables["USE_STD_VECTOR"] = self.options.use_std_vector + tc.variables["ENABLE_OBJECT_STREAM"] = self.options.enable_object_stream + tc.variables["ENABLE_INSTALL"] = self.options.enable_install + + + # if Version(self.version) >= "3.0.0": + # tc.variables["ENABLE_ALL_WARNINGS"] = False tc.generate() def build(self): @@ -148,19 +244,20 @@ def package(self): def package_info(self): self.cpp_info.libs = ["Jolt"] - if self._has_sse41: - self.cpp_info.defines.append("JPH_USE_SSE4_1") - if self._has_sse42: - self.cpp_info.defines.append("JPH_USE_SSE4_2") - if self._has_avx: - self.cpp_info.defines.append("JPH_USE_AVX") - if self._has_avx2: - self.cpp_info.defines.append("JPH_USE_AVX2") - if self._has_avx512: - self.cpp_info.defines.append("JPH_USE_AVX512") - if self.options.debug_renderer: - self.cpp_info.defines.append("JPH_DEBUG_RENDERER") - if self.options.profile: - self.cpp_info.defines.append("JPH_PROFILE_ENABLED") + + # if both options are false + if (not self.options.profiler_in_debug_and_release and not self.options.profiler_in_distribution) { + # but you want custom behavior + if (self.options.profiler) { + self.cpp_info.defines.append("JPH_PROFILE_ENABLED") + } + } + + if (not self.options.debug_renderer_in_debug_and_release and not self.options.debug_renderer_in_distribution) { + if (self.options.debug_renderer) { + self.cpp_info.defines.append("JPH_DEBUG_RENDERER") + } + } + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread"]) From c994ba62d91cdb7cd96a60d243f0d08e05500a09 Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Sat, 21 Sep 2024 14:37:52 -0400 Subject: [PATCH 06/14] fix: use correct if statement syntax --- recipes/joltphysics/all/conandata.yml | 4 ++++ recipes/joltphysics/all/conanfile.py | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/all/conandata.yml index 63de900150bd2..6c4fd9700befa 100644 --- a/recipes/joltphysics/all/conandata.yml +++ b/recipes/joltphysics/all/conandata.yml @@ -12,6 +12,10 @@ sources: url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v2.0.1.tar.gz" sha256: "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af" patches: + # "5.1.0": + # - patch_file: "patches/5.1.0-0001-fix-cmake.patch" + # patch_description: "Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options" + # patch_type: "conan" "3.0.1": - patch_file: "patches/3.0.1-0001-fix-cmake.patch" patch_description: "Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options" diff --git a/recipes/joltphysics/all/conanfile.py b/recipes/joltphysics/all/conanfile.py index 994e166649d67..f8295bb8a240b 100644 --- a/recipes/joltphysics/all/conanfile.py +++ b/recipes/joltphysics/all/conanfile.py @@ -246,18 +246,14 @@ def package_info(self): self.cpp_info.libs = ["Jolt"] # if both options are false - if (not self.options.profiler_in_debug_and_release and not self.options.profiler_in_distribution) { + if (not self.options.profiler_in_debug_and_release and not self.options.profiler_in_distribution): # but you want custom behavior - if (self.options.profiler) { + if (self.options.profiler): self.cpp_info.defines.append("JPH_PROFILE_ENABLED") - } - } - if (not self.options.debug_renderer_in_debug_and_release and not self.options.debug_renderer_in_distribution) { - if (self.options.debug_renderer) { + if (not self.options.debug_renderer_in_debug_and_release and not self.options.debug_renderer_in_distribution): + if (self.options.debug_renderer): self.cpp_info.defines.append("JPH_DEBUG_RENDERER") - } - } if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread"]) From 27b72e5a9252a58614306b17d11473616449756a Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Sat, 21 Sep 2024 14:40:46 -0400 Subject: [PATCH 07/14] feat: add in patch for missing files when running cmake install --- recipes/joltphysics/all/conandata.yml | 8 ++++---- .../all/patches/5.1.0-0001-fix-cmake.patch | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 recipes/joltphysics/all/patches/5.1.0-0001-fix-cmake.patch diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/all/conandata.yml index 6c4fd9700befa..5abe3f10fd337 100644 --- a/recipes/joltphysics/all/conandata.yml +++ b/recipes/joltphysics/all/conandata.yml @@ -12,10 +12,10 @@ sources: url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v2.0.1.tar.gz" sha256: "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af" patches: - # "5.1.0": - # - patch_file: "patches/5.1.0-0001-fix-cmake.patch" - # patch_description: "Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options" - # patch_type: "conan" + "5.1.0": + - patch_file: "patches/5.1.0-0001-fix-cmake.patch" + patch_description: "Fixes missing files ConfigurationString.h and SoftBodyUpdateContext.h when running cmake --install. See: https://github.com/jrouwe/JoltPhysics/commit/304c71912de0944c499d30e8324f3490c86076df" + patch_type: "conan" "3.0.1": - patch_file: "patches/3.0.1-0001-fix-cmake.patch" patch_description: "Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options" diff --git a/recipes/joltphysics/all/patches/5.1.0-0001-fix-cmake.patch b/recipes/joltphysics/all/patches/5.1.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..34b3c88c9258d --- /dev/null +++ b/recipes/joltphysics/all/patches/5.1.0-0001-fix-cmake.patch @@ -0,0 +1,20 @@ +diff --git a/Jolt/Jolt.cmake b/Jolt/Jolt.cmake +index 78a4149a..0bc7a80b 100644 +--- a/Jolt/Jolt.cmake ++++ b/Jolt/Jolt.cmake +@@ -13,6 +13,7 @@ set(JOLT_PHYSICS_SRC_FILES + ${JOLT_PHYSICS_ROOT}/AABBTree/AABBTreeToBuffer.h + ${JOLT_PHYSICS_ROOT}/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h + ${JOLT_PHYSICS_ROOT}/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h ++ ${JOLT_PHYSICS_ROOT}/ConfigurationString.h + ${JOLT_PHYSICS_ROOT}/Core/ARMNeon.h + ${JOLT_PHYSICS_ROOT}/Core/Array.h + ${JOLT_PHYSICS_ROOT}/Core/Atomics.h +@@ -365,6 +366,7 @@ set(JOLT_PHYSICS_SRC_FILES + ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodyShape.h + ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodySharedSettings.cpp + ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodySharedSettings.h ++ ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodyUpdateContext.h + ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodyVertex.h + ${JOLT_PHYSICS_ROOT}/Physics/StateRecorder.h + ${JOLT_PHYSICS_ROOT}/Physics/StateRecorderImpl.cpp From cd8378171865bde0351840d185c931b7f7661826 Mon Sep 17 00:00:00 2001 From: cuppajoeman Date: Sat, 21 Sep 2024 15:03:23 -0400 Subject: [PATCH 08/14] fix: add back shared option --- recipes/joltphysics/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/joltphysics/all/conanfile.py b/recipes/joltphysics/all/conanfile.py index f8295bb8a240b..0f871a0e6685d 100644 --- a/recipes/joltphysics/all/conanfile.py +++ b/recipes/joltphysics/all/conanfile.py @@ -25,6 +25,7 @@ class JoltPhysicsConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], + "shared": [True, False], "use_asserts": [True, False], "double_precision": [True, False], @@ -68,10 +69,10 @@ class JoltPhysicsConan(ConanFile): "use_std_vector": [True, False], "enable_object_stream": [True, False], "enable_install": [True, False], - "profile": [True, False], + # "profile": [True, False], } default_options = { - "build_shared_libs": False, + "shared": False, "fPIC": True, "use_asserts": False, From 4aac0934c2f1781a1819641b3afeeb2987717521 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 21 Nov 2024 08:01:52 +0100 Subject: [PATCH 09/14] Revert changes for 5.x Signed-off-by: Uilian Ries --- .../joltphysics/{all => 3.x}/conandata.yml | 10 - recipes/joltphysics/3.x/conanfile.py | 166 +++++++++++ .../patches/2.0.1-0001-fix-cmake.patch | 0 .../patches/3.0.1-0001-fix-cmake.patch | 0 .../patches/5.1.0-0001-fix-cmake.patch | 0 .../{all => 3.x}/test_package/CMakeLists.txt | 0 .../{all => 3.x}/test_package/conanfile.py | 0 .../test_package/test_package.cpp | 0 .../test_v1_package/CMakeLists.txt | 0 .../{all => 3.x}/test_v1_package/conanfile.py | 0 recipes/joltphysics/all/conanfile.py | 260 ------------------ recipes/joltphysics/config.yml | 8 +- 12 files changed, 168 insertions(+), 276 deletions(-) rename recipes/joltphysics/{all => 3.x}/conandata.yml (55%) create mode 100644 recipes/joltphysics/3.x/conanfile.py rename recipes/joltphysics/{all => 3.x}/patches/2.0.1-0001-fix-cmake.patch (100%) rename recipes/joltphysics/{all => 3.x}/patches/3.0.1-0001-fix-cmake.patch (100%) rename recipes/joltphysics/{all => 3.x}/patches/5.1.0-0001-fix-cmake.patch (100%) rename recipes/joltphysics/{all => 3.x}/test_package/CMakeLists.txt (100%) rename recipes/joltphysics/{all => 3.x}/test_package/conanfile.py (100%) rename recipes/joltphysics/{all => 3.x}/test_package/test_package.cpp (100%) rename recipes/joltphysics/{all => 3.x}/test_v1_package/CMakeLists.txt (100%) rename recipes/joltphysics/{all => 3.x}/test_v1_package/conanfile.py (100%) delete mode 100644 recipes/joltphysics/all/conanfile.py diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/3.x/conandata.yml similarity index 55% rename from recipes/joltphysics/all/conandata.yml rename to recipes/joltphysics/3.x/conandata.yml index 5abe3f10fd337..3b85494834125 100644 --- a/recipes/joltphysics/all/conandata.yml +++ b/recipes/joltphysics/3.x/conandata.yml @@ -1,10 +1,4 @@ sources: - "5.1.0": - url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v5.1.0.tar.gz" - sha256: "525c9d6fb79471b3995f9d621c9f843e71470aed286872c4d4065c1f7b7d049a" - "5.0.1": - url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v5.0.0.tar.gz" - sha256: "5231953d1b1d5b9cb617facf86341a11337e1cd04456949af6911b917a1646cb" "3.0.1": url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v3.0.1.tar.gz" sha256: "7ebb40bf2dddbcf0515984582aaa197ddd06e97581fd55b98cb64f91b243b8a6" @@ -12,10 +6,6 @@ sources: url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v2.0.1.tar.gz" sha256: "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af" patches: - "5.1.0": - - patch_file: "patches/5.1.0-0001-fix-cmake.patch" - patch_description: "Fixes missing files ConfigurationString.h and SoftBodyUpdateContext.h when running cmake --install. See: https://github.com/jrouwe/JoltPhysics/commit/304c71912de0944c499d30e8324f3490c86076df" - patch_type: "conan" "3.0.1": - patch_file: "patches/3.0.1-0001-fix-cmake.patch" patch_description: "Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options" diff --git a/recipes/joltphysics/3.x/conanfile.py b/recipes/joltphysics/3.x/conanfile.py new file mode 100644 index 0000000000000..ef2cbdfc71184 --- /dev/null +++ b/recipes/joltphysics/3.x/conanfile.py @@ -0,0 +1,166 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class JoltPhysicsConan(ConanFile): + name = "joltphysics" + description = ( + "A multi core friendly rigid body physics and collision detection " + "library, written in C++, suitable for games and VR applications." + ) + license = "MIT" + topics = ("physics", "simulation", "physics-engine", "physics-simulation", "rigid-body", "game", "collision") + homepage = "https://github.com/jrouwe/JoltPhysics" + url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "simd": ["sse", "sse41", "sse42", "avx", "avx2", "avx512"], + "debug_renderer": [True, False], + "profile": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "simd": "sse42", + "debug_renderer": False, + "profile": False, + } + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "9.2", # due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429 + "clang": "5", + "apple-clang": "12", + } + + @property + def _has_sse41(self): + return self.options.get_safe("simd") in ("sse41", "sse42", "avx", "avx2", "avx512") + + @property + def _has_sse42(self): + return self.options.get_safe("simd") in ("sse42", "avx", "avx2", "avx512") + + @property + def _has_avx(self): + return self.options.get_safe("simd") in ("avx", "avx2", "avx512") + + @property + def _has_avx2(self): + return self.options.get_safe("simd") in ("avx2", "avx512") + + @property + def _has_avx512(self): + return self.options.get_safe("simd") == "avx512" + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.arch not in ("x86", "x86_64"): + del self.options.simd + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TARGET_UNIT_TESTS"] = False + tc.variables["TARGET_HELLO_WORLD"] = False + tc.variables["TARGET_PERFORMANCE_TEST"] = False + tc.variables["TARGET_SAMPLES"] = False + tc.variables["TARGET_VIEWER"] = False + tc.variables["GENERATE_DEBUG_SYMBOLS"] = False + tc.variables["TARGET_UNIT_TESTS"] = False + tc.variables["USE_SSE4_1"] = self._has_sse41 + tc.variables["USE_SSE4_2"] = self._has_sse42 + tc.variables["USE_AVX"] = self._has_avx + tc.variables["USE_AVX2"] = self._has_avx2 + tc.variables["USE_AVX512"] = self._has_avx512 + if is_msvc(self): + tc.variables["USE_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self) + tc.variables["JPH_DEBUG_RENDERER"] = self.options.debug_renderer + tc.variables["JPH_PROFILE_ENABLED"] = self.options.profile + if Version(self.version) >= "3.0.0": + tc.variables["ENABLE_ALL_WARNINGS"] = False + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "Build")) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["Jolt"] + if self._has_sse41: + self.cpp_info.defines.append("JPH_USE_SSE4_1") + if self._has_sse42: + self.cpp_info.defines.append("JPH_USE_SSE4_2") + if self._has_avx: + self.cpp_info.defines.append("JPH_USE_AVX") + if self._has_avx2: + self.cpp_info.defines.append("JPH_USE_AVX2") + if self._has_avx512: + self.cpp_info.defines.append("JPH_USE_AVX512") + if self.options.debug_renderer: + self.cpp_info.defines.append("JPH_DEBUG_RENDERER") + if self.options.profile: + self.cpp_info.defines.append("JPH_PROFILE_ENABLED") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/joltphysics/all/patches/2.0.1-0001-fix-cmake.patch b/recipes/joltphysics/3.x/patches/2.0.1-0001-fix-cmake.patch similarity index 100% rename from recipes/joltphysics/all/patches/2.0.1-0001-fix-cmake.patch rename to recipes/joltphysics/3.x/patches/2.0.1-0001-fix-cmake.patch diff --git a/recipes/joltphysics/all/patches/3.0.1-0001-fix-cmake.patch b/recipes/joltphysics/3.x/patches/3.0.1-0001-fix-cmake.patch similarity index 100% rename from recipes/joltphysics/all/patches/3.0.1-0001-fix-cmake.patch rename to recipes/joltphysics/3.x/patches/3.0.1-0001-fix-cmake.patch diff --git a/recipes/joltphysics/all/patches/5.1.0-0001-fix-cmake.patch b/recipes/joltphysics/3.x/patches/5.1.0-0001-fix-cmake.patch similarity index 100% rename from recipes/joltphysics/all/patches/5.1.0-0001-fix-cmake.patch rename to recipes/joltphysics/3.x/patches/5.1.0-0001-fix-cmake.patch diff --git a/recipes/joltphysics/all/test_package/CMakeLists.txt b/recipes/joltphysics/3.x/test_package/CMakeLists.txt similarity index 100% rename from recipes/joltphysics/all/test_package/CMakeLists.txt rename to recipes/joltphysics/3.x/test_package/CMakeLists.txt diff --git a/recipes/joltphysics/all/test_package/conanfile.py b/recipes/joltphysics/3.x/test_package/conanfile.py similarity index 100% rename from recipes/joltphysics/all/test_package/conanfile.py rename to recipes/joltphysics/3.x/test_package/conanfile.py diff --git a/recipes/joltphysics/all/test_package/test_package.cpp b/recipes/joltphysics/3.x/test_package/test_package.cpp similarity index 100% rename from recipes/joltphysics/all/test_package/test_package.cpp rename to recipes/joltphysics/3.x/test_package/test_package.cpp diff --git a/recipes/joltphysics/all/test_v1_package/CMakeLists.txt b/recipes/joltphysics/3.x/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/joltphysics/all/test_v1_package/CMakeLists.txt rename to recipes/joltphysics/3.x/test_v1_package/CMakeLists.txt diff --git a/recipes/joltphysics/all/test_v1_package/conanfile.py b/recipes/joltphysics/3.x/test_v1_package/conanfile.py similarity index 100% rename from recipes/joltphysics/all/test_v1_package/conanfile.py rename to recipes/joltphysics/3.x/test_v1_package/conanfile.py diff --git a/recipes/joltphysics/all/conanfile.py b/recipes/joltphysics/all/conanfile.py deleted file mode 100644 index 0f871a0e6685d..0000000000000 --- a/recipes/joltphysics/all/conanfile.py +++ /dev/null @@ -1,260 +0,0 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conan.tools.scm import Version -import os - -required_conan_version = ">=1.53.0" - - -class JoltPhysicsConan(ConanFile): - name = "joltphysics" - description = ( - "A multi core friendly rigid body physics and collision detection " - "library, written in C++, suitable for games and VR applications." - ) - license = "MIT" - topics = ("physics", "simulation", "physics-engine", "physics-simulation", "rigid-body", "game", "collision") - homepage = "https://github.com/jrouwe/JoltPhysics" - url = "https://github.com/conan-io/conan-center-index" - - package_type = "library" - settings = "os", "arch", "compiler", "build_type" - options = { - "fPIC": [True, False], - "shared": [True, False], - - "use_asserts": [True, False], - "double_precision": [True, False], - "generate_debug_symbols": [True, False], - "override_cxx_flags": [True, False], - "cross_platform_deterministic": [True, False], - "cross_compile_arm": [True, False], - "build_shared_libs": [True, False], - "interprocedural_optimization": [True, False], - "floating_point_exceptions_enabled": [True, False], - "cpp_exceptions_enabled": [True, False], - "cpp_rtti_enabled": [True, False], - - "object_layer_bits": [16, 32], - - "use_sse4_1": [True, False], - "use_sse4_2": [True, False], - "use_avx": [True, False], - "use_avx2": [True, False], - "use_avx512": [True, False], - "use_lzcnt": [True, False], - "use_tzcnt": [True, False], - "use_f16c": [True, False], - "use_fmadd": [True, False], - - "use_wasm_simd": [True, False], - "enable_all_warnings": [True, False], - - "track_broadphase_stats": [True, False], - "track_narrowphase_stats": [True, False], - - "debug_renderer": [True, False], - "debug_renderer_in_debug_and_release": [True, False], - "debug_renderer_in_distribution": [True, False], - - "profiler": [True, False], - "profiler_in_debug_and_release": [True, False], - "profiler_in_distribution": [True, False], - - "disable_custom_allocator": [True, False], - "use_std_vector": [True, False], - "enable_object_stream": [True, False], - "enable_install": [True, False], - # "profile": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - - "use_asserts": False, - "double_precision": False, - "generate_debug_symbols": True, - "override_cxx_flags": True, - "cross_platform_deterministic": False, - "cross_compile_arm": False, - "build_shared_libs": False, - "interprocedural_optimization": True, - "floating_point_exceptions_enabled": False, - "cpp_exceptions_enabled": False, - "cpp_rtti_enabled": False, - "object_layer_bits": 16, - - "use_sse4_1": True, - "use_sse4_2": True, - "use_avx": True, - "use_avx2": True, - "use_avx512": False, - "use_lzcnt": True, - "use_tzcnt": True, - "use_f16c": True, - "use_fmadd": True, - - "use_wasm_simd": False, - "enable_all_warnings": True, - - "track_broadphase_stats": False, - "track_narrowphase_stats": False, - - "debug_renderer": False, # so long as the following two options are false, this variable comes into effect, this is added as a custom conan option so that you can have custom debug renderer behavior - "debug_renderer_in_debug_and_release": True, - "debug_renderer_in_distribution": False, - - "profiler": False, # so long as the following two options are false, this variable comes into effect, this is added as a custom conan option so that you can have custom profiler behavior - "profiler_in_debug_and_release": True, - "profiler_in_distribution": False, - - "disable_custom_allocator": False, - "use_std_vector": False, - "enable_object_stream": True, - "enable_install": True, - } - - @property - def _min_cppstd(self): - return "17" - - @property - def _compilers_minimum_version(self): - return { - "Visual Studio": "16", - "msvc": "192", - "gcc": "9.2", # due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429 - "clang": "5", - "apple-clang": "12", - } - - def export_sources(self): - export_conandata_patches(self) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - # if self.settings.arch not in ("x86", "x86_64"): - # del self.options.simd - - def configure(self): - if self.options.build_shared_libs: - self.options.rm_safe("fPIC") - - def layout(self): - cmake_layout(self, src_folder="src") - - def build_requirements(self): - self.tool_requires("cmake/[>=3.16 <4]") - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._min_cppstd) - - def loose_lt_semver(v1, v2): - lv1 = [int(v) for v in v1.split(".")] - lv2 = [int(v) for v in v2.split(".")] - min_length = min(len(lv1), len(lv2)) - return lv1[:min_length] < lv2[:min_length] - - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", - ) - - if is_msvc(self) and self.options.build_shared_libs: - raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") - - def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) - - def generate(self): - tc = CMakeToolchain(self) - # Disable all testing: https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conanfile_attributes.md#options-to-avoid - tc.variables["TARGET_UNIT_TESTS"] = False - tc.variables["TARGET_HELLO_WORLD"] = False - tc.variables["TARGET_PERFORMANCE_TEST"] = False - tc.variables["TARGET_SAMPLES"] = False - tc.variables["TARGET_VIEWER"] = False - tc.variables["GENERATE_DEBUG_SYMBOLS"] = False - tc.variables["TARGET_UNIT_TESTS"] = False - - if is_msvc(self): - tc.variables["USE_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self) - - tc.variables["USE_ASSERTS"] = self.options.use_asserts - tc.variables["DOUBLE_PRECISION"] = self.options.double_precision - tc.variables["GENERATE_DEBUG_SYMBOLS"] = self.options.generate_debug_symbols - tc.variables["OVERRIDE_CXX_FLAGS"] = self.options.override_cxx_flags - tc.variables["CROSS_PLATFORM_DETERMINISTIC"] = self.options.cross_platform_deterministic - tc.variables["CROSS_COMPILE_ARM"] = self.options.cross_compile_arm - tc.variables["BUILD_SHARED_LIBS"] = self.options.build_shared_libs - tc.variables["INTERPROCEDURAL_OPTIMIZATION"] = self.options.interprocedural_optimization - tc.variables["FLOATING_POINT_EXCEPTIONS_ENABLED"] = self.options.floating_point_exceptions_enabled - tc.variables["CPP_EXCEPTIONS_ENABLED"] = self.options.cpp_exceptions_enabled - tc.variables["CPP_RTTI_ENABLED"] = self.options.cpp_rtti_enabled - tc.variables["OBJECT_LAYER_BITS"] = self.options.object_layer_bits - - # Select X86 processor features to use - tc.variables["USE_SSE4_1"] = self.options.use_sse4_1 - tc.variables["USE_SSE4_2"] = self.options.use_sse4_2 - tc.variables["USE_AVX"] = self.options.use_avx - tc.variables["USE_AVX2"] = self.options.use_avx2 - tc.variables["USE_AVX512"] = self.options.use_avx512 - tc.variables["USE_LZCNT"] = self.options.use_lzcnt - tc.variables["USE_TZCNT"] = self.options.use_tzcnt - tc.variables["USE_F16C"] = self.options.use_f16c - tc.variables["USE_FMADD"] = self.options.use_fmadd - - tc.variables["USE_WASM_SIMD"] = self.options.use_wasm_simd - tc.variables["ENABLE_ALL_WARNINGS"] = self.options.enable_all_warnings - tc.variables["TRACK_BROADPHASE_STATS"] = self.options.track_broadphase_stats - tc.variables["TRACK_NARROWPHASE_STATS"] = self.options.track_narrowphase_stats - - tc.variables["DEBUG_RENDERER_IN_DEBUG_AND_RELEASE"] = self.options.debug_renderer_in_debug_and_release - tc.variables["DEBUG_RENDERER_IN_DISTRIBUTION"] = self.options.debug_renderer_in_distribution - - tc.variables["PROFILER_IN_DEBUG_AND_RELEASE"] = self.options.profiler_in_debug_and_release - tc.variables["PROFILER_IN_DISTRIBUTION"] = self.options.profiler_in_distribution - - tc.variables["DISABLE_CUSTOM_ALLOCATOR"] = self.options.disable_custom_allocator - tc.variables["USE_STD_VECTOR"] = self.options.use_std_vector - tc.variables["ENABLE_OBJECT_STREAM"] = self.options.enable_object_stream - tc.variables["ENABLE_INSTALL"] = self.options.enable_install - - - # if Version(self.version) >= "3.0.0": - # tc.variables["ENABLE_ALL_WARNINGS"] = False - tc.generate() - - def build(self): - apply_conandata_patches(self) - cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, "Build")) - cmake.build() - - def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - cmake = CMake(self) - cmake.install() - - def package_info(self): - self.cpp_info.libs = ["Jolt"] - - # if both options are false - if (not self.options.profiler_in_debug_and_release and not self.options.profiler_in_distribution): - # but you want custom behavior - if (self.options.profiler): - self.cpp_info.defines.append("JPH_PROFILE_ENABLED") - - if (not self.options.debug_renderer_in_debug_and_release and not self.options.debug_renderer_in_distribution): - if (self.options.debug_renderer): - self.cpp_info.defines.append("JPH_DEBUG_RENDERER") - - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/joltphysics/config.yml b/recipes/joltphysics/config.yml index 9f1ac754387b6..fc116290225e8 100644 --- a/recipes/joltphysics/config.yml +++ b/recipes/joltphysics/config.yml @@ -1,9 +1,5 @@ versions: - "5.1.0": - folder: all - "5.0.1": - folder: all "3.0.1": - folder: all + folder: 3.x "2.0.1": - folder: all + folder: 3.x From 6fd4b1f3ff055963d9c447740ee08900bb39cf3f Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 21 Nov 2024 08:02:21 +0100 Subject: [PATCH 10/14] Delete test_v1_package --- .../3.x/test_v1_package/CMakeLists.txt | 8 -------- .../3.x/test_v1_package/conanfile.py | 17 ----------------- 2 files changed, 25 deletions(-) delete mode 100644 recipes/joltphysics/3.x/test_v1_package/CMakeLists.txt delete mode 100644 recipes/joltphysics/3.x/test_v1_package/conanfile.py diff --git a/recipes/joltphysics/3.x/test_v1_package/CMakeLists.txt b/recipes/joltphysics/3.x/test_v1_package/CMakeLists.txt deleted file mode 100644 index 0d20897301b68..0000000000000 --- a/recipes/joltphysics/3.x/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package - ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/joltphysics/3.x/test_v1_package/conanfile.py b/recipes/joltphysics/3.x/test_v1_package/conanfile.py deleted file mode 100644 index 38f4483872d47..0000000000000 --- a/recipes/joltphysics/3.x/test_v1_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) From e471d06091215edef60263e76994f496e5b6cc54 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 21 Nov 2024 08:53:40 +0100 Subject: [PATCH 11/14] Add version 5.2.0 Signed-off-by: Uilian Ries --- recipes/joltphysics/5.x/conandata.yml | 4 + recipes/joltphysics/5.x/conanfile.py | 95 +++++++++++++++++++ .../5.x/test_package/CMakeLists.txt | 7 ++ .../joltphysics/5.x/test_package/conanfile.py | 25 +++++ .../5.x/test_package/test_package.cpp | 25 +++++ 5 files changed, 156 insertions(+) create mode 100644 recipes/joltphysics/5.x/conandata.yml create mode 100644 recipes/joltphysics/5.x/conanfile.py create mode 100644 recipes/joltphysics/5.x/test_package/CMakeLists.txt create mode 100644 recipes/joltphysics/5.x/test_package/conanfile.py create mode 100644 recipes/joltphysics/5.x/test_package/test_package.cpp diff --git a/recipes/joltphysics/5.x/conandata.yml b/recipes/joltphysics/5.x/conandata.yml new file mode 100644 index 0000000000000..286fa74fd26ba --- /dev/null +++ b/recipes/joltphysics/5.x/conandata.yml @@ -0,0 +1,4 @@ +sources: + "5.2.0": + url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v5.2.0.tar.gz" + sha256: "f478afe3050c885e21403748e10ab18e3e8df8b0982c540e75f1e078ef8b2c88" diff --git a/recipes/joltphysics/5.x/conanfile.py b/recipes/joltphysics/5.x/conanfile.py new file mode 100644 index 0000000000000..4b4b0d3b8e9cc --- /dev/null +++ b/recipes/joltphysics/5.x/conanfile.py @@ -0,0 +1,95 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, rm +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os + +required_conan_version = ">=2.0.9" + + +class JoltPhysicsConan(ConanFile): + name = "joltphysics" + description = ( + "A multi core friendly rigid body physics and collision detection " + "library, written in C++, suitable for games and VR applications." + ) + license = "MIT" + topics = ("physics", "simulation", "physics-engine", "physics-simulation", "rigid-body", "game", "collision") + homepage = "https://github.com/jrouwe/JoltPhysics" + url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + implements = ["auto_shared_fpic"] + + def layout(self): + cmake_layout(self, src_folder="src") + + def build_requirements(self): + self.tool_requires("cmake/[>=3.20 <4]") + + def validate(self): + check_min_cppstd(self, 17) + + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["TARGET_UNIT_TESTS"] = False + tc.cache_variables["TARGET_HELLO_WORLD"] = False + tc.cache_variables["TARGET_PERFORMANCE_TEST"] = False + tc.cache_variables["TARGET_SAMPLES"] = False + tc.cache_variables["TARGET_VIEWER"] = False + tc.cache_variables["CROSS_PLATFORM_DETERMINISTIC"] = False + tc.cache_variables["INTERPROCEDURAL_OPTIMIZATION"] = False + tc.cache_variables["GENERATE_DEBUG_SYMBOLS"] = False + tc.cache_variables["ENABLE_ALL_WARNINGS"] = False + tc.cache_variables["OVERRIDE_CXX_FLAGS"] = False + tc.cache_variables["DEBUG_RENDERER_IN_DEBUG_AND_RELEASE"] = False + tc.cache_variables["PROFILER_IN_DEBUG_AND_RELEASE"] = False + if is_msvc(self): + tc.cache_variables["USE_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "Build")) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.cmake", os.path.join(self.package_folder, "include", "Jolt")) + + def package_info(self): + self.cpp_info.libs = ["Jolt"] + self.cpp_info.set_property("cmake_file_name", "Jolt") + self.cpp_info.set_property("cmake_target_name", "Jolt::Jolt") + # INFO: The CMake option ENABLE_OBJECT_STREAM is enabled by default and defines JPH_OBJECT_STREAM as public + # https://github.com/jrouwe/JoltPhysics/blob/v5.2.0/Build/CMakeLists.txt#L95C8-L95C28 + self.cpp_info.defines = ["JPH_OBJECT_STREAM"] + # INFO: Public defines exposed in include/Jolt/Jolt.cmake + # https://github.com/jrouwe/JoltPhysics/blob/v5.2.0/Build/CMakeLists.txt#L51 + if self.settings.arch in ["x86_64", "x86"]: + self.cpp_info.defines.extend(["JPH_USE_AVX2", "JPH_USE_AVX", "JPH_USE_SSE4_1", + "JPH_USE_SSE4_2", "JPH_USE_LZCNT", "JPH_USE_TZCNT", + "JPH_USE_F16C", "JPH_USE_FMADD"]) + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/joltphysics/5.x/test_package/CMakeLists.txt b/recipes/joltphysics/5.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..080b63d50fff6 --- /dev/null +++ b/recipes/joltphysics/5.x/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(Jolt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Jolt::Jolt) diff --git a/recipes/joltphysics/5.x/test_package/conanfile.py b/recipes/joltphysics/5.x/test_package/conanfile.py new file mode 100644 index 0000000000000..87901dd77830a --- /dev/null +++ b/recipes/joltphysics/5.x/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/joltphysics/5.x/test_package/test_package.cpp b/recipes/joltphysics/5.x/test_package/test_package.cpp new file mode 100644 index 0000000000000..7a7095256f3dc --- /dev/null +++ b/recipes/joltphysics/5.x/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include + +#include +#include +#include +#include +#include +#include + + +int main() +{ + JPH::RegisterDefaultAllocator(); + + JPH::Factory::sInstance = new JPH::Factory(); + + JPH::RegisterTypes(); + + JPH::TempAllocatorImpl temp_allocator(16); + JPH::JobSystemThreadPool job_system(JPH::cMaxPhysicsJobs, JPH::cMaxPhysicsBarriers, std::thread::hardware_concurrency() - 1); + + delete JPH::Factory::sInstance; + + return EXIT_SUCCESS; +} From d55654def4314714e304f33ea1a2b47ecf3cef40 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 21 Nov 2024 08:54:42 +0100 Subject: [PATCH 12/14] Remove condition for msvc shared Signed-off-by: Uilian Ries --- .../3.x/patches/5.1.0-0001-fix-cmake.patch | 20 ------------------- recipes/joltphysics/5.x/conanfile.py | 3 --- recipes/joltphysics/config.yml | 2 ++ 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 recipes/joltphysics/3.x/patches/5.1.0-0001-fix-cmake.patch diff --git a/recipes/joltphysics/3.x/patches/5.1.0-0001-fix-cmake.patch b/recipes/joltphysics/3.x/patches/5.1.0-0001-fix-cmake.patch deleted file mode 100644 index 34b3c88c9258d..0000000000000 --- a/recipes/joltphysics/3.x/patches/5.1.0-0001-fix-cmake.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/Jolt/Jolt.cmake b/Jolt/Jolt.cmake -index 78a4149a..0bc7a80b 100644 ---- a/Jolt/Jolt.cmake -+++ b/Jolt/Jolt.cmake -@@ -13,6 +13,7 @@ set(JOLT_PHYSICS_SRC_FILES - ${JOLT_PHYSICS_ROOT}/AABBTree/AABBTreeToBuffer.h - ${JOLT_PHYSICS_ROOT}/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h - ${JOLT_PHYSICS_ROOT}/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h -+ ${JOLT_PHYSICS_ROOT}/ConfigurationString.h - ${JOLT_PHYSICS_ROOT}/Core/ARMNeon.h - ${JOLT_PHYSICS_ROOT}/Core/Array.h - ${JOLT_PHYSICS_ROOT}/Core/Atomics.h -@@ -365,6 +366,7 @@ set(JOLT_PHYSICS_SRC_FILES - ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodyShape.h - ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodySharedSettings.cpp - ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodySharedSettings.h -+ ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodyUpdateContext.h - ${JOLT_PHYSICS_ROOT}/Physics/SoftBody/SoftBodyVertex.h - ${JOLT_PHYSICS_ROOT}/Physics/StateRecorder.h - ${JOLT_PHYSICS_ROOT}/Physics/StateRecorderImpl.cpp diff --git a/recipes/joltphysics/5.x/conanfile.py b/recipes/joltphysics/5.x/conanfile.py index 4b4b0d3b8e9cc..d379655790482 100644 --- a/recipes/joltphysics/5.x/conanfile.py +++ b/recipes/joltphysics/5.x/conanfile.py @@ -41,9 +41,6 @@ def build_requirements(self): def validate(self): check_min_cppstd(self, 17) - if is_msvc(self) and self.options.shared: - raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") - def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) diff --git a/recipes/joltphysics/config.yml b/recipes/joltphysics/config.yml index fc116290225e8..2a48b28a6e4c3 100644 --- a/recipes/joltphysics/config.yml +++ b/recipes/joltphysics/config.yml @@ -1,4 +1,6 @@ versions: + "5.2.0": + folder: 5.x "3.0.1": folder: 3.x "2.0.1": From 74c2e2e8266f78f532f37212f66b8be308625cd8 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Thu, 21 Nov 2024 09:02:48 +0100 Subject: [PATCH 13/14] Remove unused import Signed-off-by: Uilian Ries --- recipes/joltphysics/5.x/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/joltphysics/5.x/conanfile.py b/recipes/joltphysics/5.x/conanfile.py index d379655790482..545596f2925de 100644 --- a/recipes/joltphysics/5.x/conanfile.py +++ b/recipes/joltphysics/5.x/conanfile.py @@ -1,5 +1,4 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir, rm From 1460400ca308a4b65dc2f34f4a48ff85fceb62df Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 22 Nov 2024 11:42:14 +0100 Subject: [PATCH 14/14] Reduce more test package Signed-off-by: Uilian Ries --- .../5.x/test_package/test_package.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/recipes/joltphysics/5.x/test_package/test_package.cpp b/recipes/joltphysics/5.x/test_package/test_package.cpp index 7a7095256f3dc..5f0927f9ae8d1 100644 --- a/recipes/joltphysics/5.x/test_package/test_package.cpp +++ b/recipes/joltphysics/5.x/test_package/test_package.cpp @@ -1,25 +1,8 @@ #include - #include -#include -#include -#include -#include -#include -int main() -{ +int main() { JPH::RegisterDefaultAllocator(); - - JPH::Factory::sInstance = new JPH::Factory(); - - JPH::RegisterTypes(); - - JPH::TempAllocatorImpl temp_allocator(16); - JPH::JobSystemThreadPool job_system(JPH::cMaxPhysicsJobs, JPH::cMaxPhysicsBarriers, std::thread::hardware_concurrency() - 1); - - delete JPH::Factory::sInstance; - return EXIT_SUCCESS; }