Skip to content

Commit

Permalink
ci: xmake with latest 2.9.4 with arm64 supported; fix subsystem issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Aug 30, 2024
1 parent bc48d85 commit ec1e633
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 24 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,11 @@ jobs:
./install_boost.bat
./build.bat boost arm64
# add msbuild to PATH
#- name: Add msbuild to PATH
# uses: microsoft/setup-msbuild@v2

# use this after xmake 2.9.4 released
#- uses: xmake-io/github-action-setup-xmake@v1
# with:
# xmake-version: latest
# actions-cache-folder: '.xmake-cache'
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
actions-cache-folder: '.xmake-cache'

- uses: ilammy/msvc-dev-cmd@v1

Expand All @@ -107,10 +103,6 @@ jobs:
id: build_weasel
shell: cmd
run: |
# after xmake 2.9.4 released, the following 3 lines can be deleted
curl -LO https://github.com/xmake-io/xmake/releases/download/v2.9.3/xmake-master.win64.exe
.\xmake-master.win64.exe /S
set PATH=%PROGRAMFILES%\xmake;%PATH%
.\xbuild.bat arm64 installer
- name: Compress Debug Symbols
Expand Down
2 changes: 1 addition & 1 deletion WeaselDeployer/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target("WeaselDeployer")
set_kind("binary")
add_files("./*.cpp")
add_rules("add_rcfiles", "use_weaselconstants")
add_rules("add_rcfiles", "use_weaselconstants", "subwin")
add_links("imm32", "kernel32", "rime")
add_deps("WeaselIPC", "RimeWithWeasel")
add_files("$(projectdir)/PerMonitorHighDPIAware.manifest")
Expand Down
2 changes: 1 addition & 1 deletion WeaselServer/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target("WeaselServer")
set_kind("binary")
add_files("./*.cpp")
add_rules("add_rcfiles")
add_rules("add_rcfiles", "subwin")
add_links("imm32", "kernel32", "rime")
add_deps("WeaselUI", "WeaselIPC", "RimeWithWeasel", "WeaselIPCServer")

Expand Down
2 changes: 1 addition & 1 deletion WeaselSetup/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target("WeaselSetup")
set_kind("binary")
add_files("./*.cpp")
add_rules("add_rcfiles", "use_weaselconstants")
add_rules("add_rcfiles", "use_weaselconstants", "subwin")
add_links("imm32", "kernel32")

set_policy("windows.manifest.uac", "admin")
Expand Down
1 change: 1 addition & 0 deletions test/TestResponseParser/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ target("TestResponseParser")
set_kind("binary")
add_files("./*.cpp")
add_deps("WeaselIPC", "WeaselIPCServer")
add_rules("subcmd")
before_build(function(target)
local target_dir = path.join(target:targetdir(), target:name())
if not os.exists(target_dir) then
Expand Down
1 change: 1 addition & 0 deletions test/TestWeaselIPC/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ target("TestWeaselIPC")
set_kind("binary")
add_files("./*.cpp")
add_deps("WeaselIPC", "WeaselIPCServer")
add_rules("subcmd")
before_build(function(target)
local target_dir = path.join(target:targetdir(), target:name())
if not os.exists(target_dir) then
Expand Down
27 changes: 18 additions & 9 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set_project("weasel")

-- 定义全局变量
set_xmakever("2.5.1")
set_xmakever("2.9.4")
set_languages("c++17")
add_defines("UNICODE", "_UNICODE")
add_defines("WINDOWS")
Expand All @@ -15,9 +15,8 @@ boost_include_path = boost_root
boost_lib_path = boost_root .. "/stage/lib"
add_includedirs(boost_include_path)
add_linkdirs(boost_lib_path)
add_cxxflags("/utf-8")
add_cxflags("/MP /O2 /Oi /GL /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /external:W3 /Gd /TP /FC")
add_ldflags("/SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT")
add_cxflags("/utf-8 /MP /O2 /Oi /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /external:W3 /Gd /TP /FC")
add_ldflags("/TLBID:1 /DYNAMICBASE /NXCOMPAT")

-- 全局ATL lib路径
local atl_lib_dir = ''
Expand Down Expand Up @@ -49,20 +48,30 @@ add_links("atls", "shell32", "advapi32", "gdi32", "user32", "uuid", "ole32")
includes("WeaselIPC", "WeaselUI", "WeaselTSF", "WeaselIME")

if is_arch("x64") or is_arch("x86") then
includes("RimeWithWeasel", "WeaselIPCServer", "WeaselServer", "WeaselDeployer")
includes("RimeWithWeasel", "WeaselIPCServer", "WeaselServer", "WeaselDeployer")
end

if is_arch("x86") then
includes("WeaselSetup")
includes("WeaselSetup")
end

if is_mode("debug") then
includes("test/TestWeaselIPC")
includes("test/TestResponseParser")
includes("test/TestWeaselIPC")
includes("test/TestResponseParser")
else
add_ldflags("/INCREMENTAL:NO", {force = true})
add_cxflags("/GL")
add_ldflags("/LTCG /INCREMENTAL:NO", {force = true})
end

rule("subcmd")
on_load(function(target)
target:add("ldflags", "/SUBSYSTEM:CONSOLE")
end)
rule("subwin")
on_load(function(target)
target:add("ldflags", "/SUBSYSTEM:WINDOWS")
end)

rule("add_rcfiles")
on_load(function(target)
target:add("files", path.join(target:scriptdir(), "*.rc"),
Expand Down

0 comments on commit ec1e633

Please sign in to comment.