Skip to content

Commit

Permalink
improve tools.cmake for wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Sep 11, 2024
1 parent 25e1d8a commit 921793c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions xmake/modules/package/tools/cmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ end
-- get configs for wasm
function _get_configs_for_wasm(package, configs, opt)
opt = opt or {}
local envs = {}
local emsdk = find_emsdk()
assert(emsdk and emsdk.emscripten, "emscripten not found!")
local emscripten_cmakefile = find_file("Emscripten.cmake", path.join(emsdk.emscripten, "cmake/Modules/Platform"))
Expand All @@ -613,12 +614,14 @@ function _get_configs_for_wasm(package, configs, opt)
end

-- avoid find and add system include/library path
-- @see https://github.com/xmake-io/xmake/issues/2037
-- https://github.com/xmake-io/xmake/issues/5577
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH")
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH")
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH")
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER")
-- @see https://github.com/xmake-io/xmake/issues/5577
-- https://github.com/emscripten-core/emscripten/issues/13310
envs.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "NEVER"
_get_configs_for_generic(package, configs, opt)
_insert_configs_from_envs(configs, envs, opt)
end

-- get configs for cross
Expand Down

0 comments on commit 921793c

Please sign in to comment.