Skip to content

Commit c151172

Browse files
committed
improve cmake for ninja
1 parent 014838d commit c151172

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

tests/projects/cuda/console/xmake.lua

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ target("cuda_console")
66
add_files("src/*.cu")
77

88
-- generate SASS code for each SM architecture
9-
add_cugencodes("sm_35", "sm_37", "sm_50", "sm_52", "sm_60", "sm_61", "sm_70", "sm_75")
9+
-- add_cugencodes("sm_35", "sm_37", "sm_50", "sm_52", "sm_60", "sm_61", "sm_70", "sm_75")
1010

11-
-- generate PTX code from the highest SM architecture to guarantee forward-compatibility
12-
add_cugencodes("compute_75")
1311

1412

xmake/modules/package/tools/cmake.lua

+5-9
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,6 @@ function _get_configs_for_mingw(package, configs, opt)
601601
if is_subhost("windows") and opt.cmake_generator ~= "Ninja" then
602602
envs.CMAKE_MAKE_PROGRAM = _get_mingw32_make(package)
603603
end
604-
if opt.cmake_generator == "Ninja" then
605-
envs.CMAKE_MAKE_PROGRAM = "ninja"
606-
end
607604
_fix_cxx_compiler_cmake(package, envs)
608605
_insert_configs_from_envs(configs, envs, opt)
609606
end
@@ -618,12 +615,7 @@ function _get_configs_for_wasm(package, configs, opt)
618615
assert(emscripten_cmakefile, "Emscripten.cmake not found!")
619616
table.insert(configs, "-DCMAKE_TOOLCHAIN_FILE=" .. emscripten_cmakefile)
620617
if is_subhost("windows") then
621-
if opt.cmake_generator == "Ninja" then
622-
local ninja = _get_ninja(package)
623-
if ninja then
624-
table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja)
625-
end
626-
else
618+
if opt.cmake_generator ~= "Ninja" then
627619
local mingw_make = _get_mingw32_make(package)
628620
if mingw_make then
629621
table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. mingw_make)
@@ -783,6 +775,10 @@ function _get_configs_for_generator(package, configs, opt)
783775
table.insert(configs, "-DCMAKE_JOB_POOL_LINK:STRING=link")
784776
table.insert(configs, ("-DCMAKE_JOB_POOLS:STRING=compile=%s;link=%s"):format(jobs, linkjobs))
785777
end
778+
local ninja = _get_ninja(package)
779+
if ninja then
780+
table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja)
781+
end
786782
end
787783
elseif package:is_plat("mingw") and is_subhost("msys") then
788784
table.insert(configs, "-G")

0 commit comments

Comments
 (0)