Skip to content

Commit 7bca7bf

Browse files
authored
build: migrate to XMake build system (#5)
* build: use xmake * build: edit build flags * build: add github actions
1 parent 96fc42d commit 7bca7bf

File tree

15 files changed

+78
-132
lines changed

15 files changed

+78
-132
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,76 @@ name: Build
22

33
on:
44
push:
5+
paths:
6+
- '**.cpp'
7+
- '**.cc'
8+
- '**.cxx'
9+
- '**.c'
10+
- '**.hpp'
11+
- '**.hh'
12+
- '**.hxx'
13+
- '**.h'
14+
- '.github/workflows/build.yml'
15+
- '**/xmake.lua'
516
pull_request:
617
release:
7-
types:
8-
- released
18+
types:
19+
- created
920
workflow_dispatch:
1021

1122
jobs:
1223
build:
1324
name: Build
1425
runs-on: windows-latest
1526
steps:
16-
- name: Get version if release
27+
- uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Setup XMake
32+
uses: xmake-io/github-action-setup-xmake@v1
33+
with:
34+
xmake-version: latest
35+
actions-cache-folder: ".xmake-cache"
36+
37+
- name: Get version from tag if release
1738
if: github.event_name == 'release'
1839
run: echo "VERSION=${{ github.ref_name }}" | sed 's/=v/=/' >> $env:GITHUB_ENV
1940

20-
- name: Set default version if not release
21-
if: github.event_name != 'release'
22-
run: echo "VERSION=0.0.0" >> $env:GITHUB_ENV
23-
24-
- name: Checkout the repository
25-
uses: actions/checkout@v3
41+
- name: "Get Previous tag if not release"
42+
id: previoustag
43+
uses: "WyriHaximus/github-action-get-previous-tag@v1"
2644
with:
27-
submodules: true
45+
fallback: 0.0.0
46+
47+
- name: Set pseudo version if not release
48+
if: github.event_name != 'release'
49+
run: |
50+
$date = (Get-Date -Format "yyyyMMddHHmmss")
51+
$commit = git rev-parse --short HEAD
52+
$previous_tag = "${{ steps.previoustag.outputs.tag }}"
53+
echo "VERSION=$previous_tag-$date-$commit" >> $env:GITHUB_ENV
2854
2955
- name: Build PreLoader
3056
run: |
31-
mkdir -p build
32-
cd build
33-
cmake ..
34-
cmake --build . --config Release -j
57+
xmake f -p windows -m release -a x64 -y
58+
xmake -w -y
3559
3660
- name: Upload build
3761
uses: actions/upload-artifact@v3
3862
with:
3963
name: preloader-${{ env.VERSION }}-windows-amd64
40-
path: build/Release/PreLoader.dll
64+
path: build/windows/x64/release/PreLoader.dll
4165

4266
- name: Upload PDB file
4367
uses: actions/upload-artifact@v3
4468
with:
4569
name: preloader-${{ env.VERSION }}-windows-amd64-pdb
46-
path: build/Release/PreLoader.pdb
70+
path: build/windows/x64/release/PreLoader.pdb
4771

4872
upload-to-release:
4973
name: Upload to release
50-
needs:
74+
needs:
5175
- build
5276
runs-on: ubuntu-latest
5377
if: github.event_name == 'release'
@@ -57,7 +81,7 @@ jobs:
5781

5882
- name: Download artifacts
5983
uses: actions/download-artifact@v3
60-
84+
6185
- name: Upload release assets
6286
uses: softprops/action-gh-release@v1
6387
with:

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55

66
# Visual Studio Code related
77
/.vscode
8-
/build
98

109
# Idea related
1110
/.idea
1211
/cmake-build-*
1312

1413
# Clangd cache
1514
/.cache
15+
16+
# XMake
17+
/.xmake
18+
/build
19+
/CMakeLists.txt

.gitmodules

Lines changed: 0 additions & 19 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 0 additions & 52 deletions
This file was deleted.

include/pl/utils/FakeSymbol.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <optional>
44
#include <string>
55

6-
#include <MicrosoftDemangle.h>
6+
#include <demangler/MicrosoftDemangle.h>
77

88
namespace pl::fake_symbol {
99

include/pl/utils/Logger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ inline void loadLoggerConfig() {
6262
#define LOG(color1, color2, prefix) \
6363
LOG_PREFIX(prefix, color1, color2); \
6464
std::string str = fmt::format("[PreLoader] ", fmt::localtime(_time64(0))); \
65-
str += fmt::format(formatStr, args...); \
65+
str += fmt::format(fmt::runtime(formatStr), args...); \
6666
str.append(1, '\n');
6767

6868
template <typename... Args>

lib/demangler

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/detours/CMakeLists.txt

Lines changed: 0 additions & 33 deletions
This file was deleted.

lib/detours/detours

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/fmt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)