JoltPhysics: Add version 3.0.0 (#1987)

* JoltPhysics: Add version 3.0.0

* Cleanup

Fixes GENERATE_DEBUG_SYMBOLS
Fixes INTERPROCEDURAL_OPTIMIZATION being set twice

* Update xmake.lua
pull/1996/head
Jérôme Leclercq 2 years ago committed by GitHub
parent 89ae43c789
commit 6e71b4b01a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 74
      packages/j/joltphysics/xmake.lua

@ -5,6 +5,7 @@ package("joltphysics")
add_urls("https://github.com/jrouwe/JoltPhysics/archive/refs/tags/$(version).tar.gz",
"https://github.com/jrouwe/JoltPhysics.git")
add_versions("v3.0.0", "f8d756ae3471a32f2ee7e07475df2f7a34752f0fdd05e9a7ed2e7ce3dcdcd574")
add_versions("v2.0.1", "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af")
-- patches for Android/ARMv7 and VS2019 ARM64 support
add_patches("v2.0.1", "https://github.com/jrouwe/JoltPhysics/commit/27b2c3293ea6bde6e3d6168b11d41c337f1a0913.patch", "43b3d38ea5a01c281ad7b580859acaf0b30eac9a7bdc271a54199fcc88b8d491")
@ -14,7 +15,8 @@ package("joltphysics")
add_configs("cross_platform_deterministic", { description = "Turns on behavior to attempt cross platform determinism", default = false, type = "boolean" })
add_configs("debug_renderer", { description = "Adds support to draw lines and triangles, used to be able to debug draw the state of the world", default = true, type = "boolean" })
add_configs("double_precision", { description = "Compiles the library so that all positions are stored in doubles instead of floats. This makes larger worlds possible", default = false, type = "boolean" })
add_configs("profile", { description = "Turns on the internal profiler", defines = "JPH_PROFILE_ENABLED"})
add_configs("object_layer_bits", {description = "Number of bits to use in ObjectLayer. Can be 16 or 32.", default = "16", type = "string", values = {"16", "32"}})
add_configs("symbols", { description = "When turning this option on, the library will be compiled with debug symbols", default = false, type = "boolean" })
if is_arch("x86", "x64", "x86_64") then
add_configs("inst_avx", { description = "Enable AVX CPU instructions (x86/x64 only)", default = false, type = "boolean" })
@ -36,6 +38,11 @@ package("joltphysics")
end
on_load(function (package)
local version = package:version()
if not version or version:ge("3.0.0") then
package:add("deps", "cmake")
package:add("defines", "JPH_OBJECT_LAYER_BITS=" .. package:config("object_layer_bits"))
end
if package:is_plat("windows") and not package:config("shared") then
package:add("syslinks", "Advapi32")
end
@ -51,24 +58,55 @@ package("joltphysics")
end)
on_install("windows", "mingw", "linux", "macosx", "iphoneos", "android", "wasm", function (package)
os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua")
local configs = {}
configs.cross_platform_deterministic = package:config("cross_platform_deterministic")
configs.debug_renderer = package:config("debug_renderer")
configs.double_precision = package:config("double_precision")
configs.profile = package:config("profile")
if is_arch("x86", "x64", "x86_64") then
configs.inst_avx = package:config("inst_avx")
configs.inst_avx2 = package:config("inst_avx2")
configs.inst_avx512 = package:config("inst_avx512")
configs.inst_f16c = package:config("inst_f16c")
configs.inst_fmadd = package:config("inst_fmadd")
configs.inst_lzcnt = package:config("inst_lzcnt")
configs.inst_sse4_1 = package:config("inst_sse4_1")
configs.inst_sse4_2 = package:config("inst_sse4_2")
configs.inst_tzcnt = package:config("inst_tzcnt")
-- Jolt CMakeLists had no install target/support for custom msvc runtime until 3.0.0
local version = package:version()
if not version or version:ge("3.0.0") then
os.cd("Build")
local configs = {
"-DENABLE_ALL_WARNINGS=OFF",
"-DINTERPROCEDURAL_OPTIMIZATION=OFF",
"-DTARGET_UNIT_TESTS=OFF",
"-DTARGET_HELLO_WORLD=OFF",
"-DTARGET_PERFORMANCE_TEST=OFF",
"-DTARGET_SAMPLES=OFF",
"-DTARGET_VIEWER=OFF",
"-DUSE_STATIC_MSVC_RUNTIME_LIBRARY=OFF"
}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DCROSS_PLATFORM_DETERMINISTIC=" .. (package:config("cross_platform_deterministic") and "ON" or "OFF"))
table.insert(configs, "-DDOUBLE_PRECISION=" .. (package:config("double_precision") and "ON" or "OFF"))
table.insert(configs, "-DGENERATE_DEBUG_SYMBOLS=" .. ((package:debug() or package:config("symbols")) and "ON" or "OFF"))
table.insert(configs, "-DOBJECT_LAYER_BITS=" .. package:config("object_layer_bits"))
table.insert(configs, "-DUSE_AVX=" .. (package:config("inst_avx") and "ON" or "OFF"))
table.insert(configs, "-DUSE_AVX2=" .. (package:config("inst_avx2") and "ON" or "OFF"))
table.insert(configs, "-DUSE_AVX512=" .. (package:config("inst_avx512") and "ON" or "OFF"))
table.insert(configs, "-DUSE_F16C=" .. (package:config("inst_f16c") and "ON" or "OFF"))
table.insert(configs, "-DUSE_FMADD=" .. (package:config("inst_fmadd") and "ON" or "OFF"))
table.insert(configs, "-DUSE_LZCNT=" .. (package:config("inst_lzcnt") and "ON" or "OFF"))
table.insert(configs, "-DUSE_SSE4_1=" .. (package:config("inst_sse4_1") and "ON" or "OFF"))
table.insert(configs, "-DUSE_SSE4_2=" .. (package:config("inst_sse4_2") and "ON" or "OFF"))
table.insert(configs, "-DUSE_TZCNT=" .. (package:config("inst_tzcnt") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
else
os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua")
local configs = {}
configs.cross_platform_deterministic = package:config("cross_platform_deterministic")
configs.debug_renderer = package:config("debug_renderer")
configs.double_precision = package:config("double_precision")
if package:is_arch("x86", "x64", "x86_64") then
configs.inst_avx = package:config("inst_avx")
configs.inst_avx2 = package:config("inst_avx2")
configs.inst_avx512 = package:config("inst_avx512")
configs.inst_f16c = package:config("inst_f16c")
configs.inst_fmadd = package:config("inst_fmadd")
configs.inst_lzcnt = package:config("inst_lzcnt")
configs.inst_sse4_1 = package:config("inst_sse4_1")
configs.inst_sse4_2 = package:config("inst_sse4_2")
configs.inst_tzcnt = package:config("inst_tzcnt")
end
import("package.tools.xmake").install(package, configs)
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)

Loading…
Cancel
Save