diff options
| author | ruki <[email protected]> | 2024-08-21 15:00:03 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-21 15:00:03 +0800 |
| commit | 2a44d9686c4221185dd4b18afae979790ea0f521 (patch) | |
| tree | f66b5876c83f9b0b954e7d7ead5d46338d901e2e | |
| parent | 8fe3738c9b07f78b67ad4ed978bf6fedec2aeae2 (diff) | |
| parent | b8235aa4a4557fd0c33420fe817f2fa68dd69682 (diff) | |
Merge pull request #5489 from xmake-io/cosmocc
Add cosmocc ci
| -rw-r--r-- | .github/workflows/cosmocc.yml | 60 | ||||
| m--------- | core/src/tbox/tbox | 0 | ||||
| -rw-r--r-- | core/xmake.lua | 24 |
3 files changed, 83 insertions, 1 deletions
diff --git a/.github/workflows/cosmocc.yml b/.github/workflows/cosmocc.yml new file mode 100644 index 000000000..44ef30eec --- /dev/null +++ b/.github/workflows/cosmocc.yml @@ -0,0 +1,60 @@ +name: Cosmocc (x86_64) + +on: + pull_request: + push: + release: + types: [published] + +jobs: + build: + + strategy: + matrix: + os: [macos-12] + arch: [x86_64] + + runs-on: ${{ matrix.os }} + + concurrency: + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Cosmocc-${{ matrix.arch }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Prepare local xmake + run: cp -rf . ../xmake-source + - uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: local#../xmake-source + + - name: Installation + run: | + brew install dmd + brew install dub + + - name: Build + run: | + cd core + xmake f -p linux --cosmocc=y -y -cvD + xmake -v + cd .. + + - name: Tests + run: | + source scripts/srcenv.profile + xmake --version + xmake lua -v -D tests/run.lua + xrepo --version + + - name: Artifact + run: | + brew install gnu-tar + cd core + xmake pack -y --autobuild=n --basename=xmake -f zip -o ../artifacts xmake + cd .. + - uses: actions/upload-artifact@v2 + with: + name: xmake-latest.zip + path: artifacts/xmake.zip diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox -Subproject 553c32406a09e3e0a0a8e8dfed741b4888ba07c +Subproject 57e57a3271ad925936b3fbf37877f9eceb49ee4 diff --git a/core/xmake.lua b/core/xmake.lua index 675d4676f..28bf4f22b 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -48,6 +48,16 @@ if is_mode("coverage") then add_ldflags("-coverage", "-fprofile-arcs", "-ftest-coverage") end +-- set cosmocc toolchain, e.g. xmake f -p linux --cosmocc=y +if has_config("cosmocc") then + add_requires("cosmocc") + set_toolchains("@cosmocc") + set_policy("build.ccache", false) +end + +-- the cosmocc option +option("cosmocc", {default = false, category = "option", description = "Use cosmocc toolchain to build once and run anywhere."}) + -- the runtime option option("runtime") set_default("lua") @@ -68,11 +78,19 @@ option("readline") add_cincludes("stdio.h", "readline/readline.h") add_cfuncs("readline") add_defines("XM_CONFIG_API_HAVE_READLINE") + add_deps("cosmocc") + after_check(function (option) + if option:dep("cosmocc"):enabled() then + option:enable(false) + end + end) option_end() -- the curses option option("curses") set_description("Enable or disable curses library") + add_defines("XM_CONFIG_API_HAVE_CURSES") + add_deps("cosmocc") before_check(function (option) if is_plat("mingw") then option:add("cincludes", "ncursesw/curses.h") @@ -82,7 +100,11 @@ option("curses") option:add("links", "curses") end end) - add_defines("XM_CONFIG_API_HAVE_CURSES") + after_check(function (option) + if option:dep("cosmocc"):enabled() then + option:enable(false) + end + end) option_end() -- the pdcurses option |
