fix assimp for old version (#2994)

* fix assimp for old version

* Update xmake.lua
pull/2995/head
ruki 1 year ago committed by GitHub
parent fb077c505b
commit dd835e9cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      packages/a/assimp/xmake.lua

@ -99,18 +99,17 @@ package("assimp")
table.insert(configs, "-DASSIMP_BUILD_ASSIMP_TOOLS=OFF")
end
if not package:gitref() and package:version():lt("v5.2.4") then
-- ASSIMP_WARNINGS_AS_ERRORS is not supported before v5.2.4
-- ASSIMP_WARNINGS_AS_ERRORS maybe does not work for some old versions
for _, cmakefile in ipairs(table.join("CMakeLists.txt", os.files("**/CMakeLists.txt"))) do
if package:is_plat("windows") then
io.replace("code/CMakeLists.txt", "TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX)", "", {plain = true})
io.replace(cmakefile, "/W4 /WX", "", {plain = true})
else
io.replace("code/CMakeLists.txt", "TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)", "", {plain = true})
io.replace(cmakefile, "-Werror", "", {plain = true})
end
end
if not package:gitref() and package:version():eq("v5.2.5") then
-- Remove /WX from CMakeLists for MSVC: https://github.com/assimp/assimp/pull/5183
io.replace("CMakeLists.txt", "ADD_COMPILE_OPTIONS(/bigobj /W4 /WX )", "ADD_COMPILE_OPTIONS(/bigobj)", {plain = true})
io.replace("CMakeLists.txt", "ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX)", "ADD_COMPILE_OPTIONS(/MP /bigobj)", {plain = true})
-- fix cmake_install failed
if not package:gitref() and package:version():ge("v5.3.0") and package:is_plat("windows") and package:is_debug() then
io.replace("code/CMakeLists.txt", "IF(GENERATOR_IS_MULTI_CONFIG)", "IF(TRUE)", {plain = true})
end
if package:is_plat("mingw") and package:version():lt("v5.1.5") then
-- CMAKE_COMPILER_IS_MINGW has been removed: https://github.com/assimp/assimp/pull/4311

Loading…
Cancel
Save