From 9ae077d07e8e4345026cd4e1376898e5f293bed6 Mon Sep 17 00:00:00 2001 From: Edo Date: Fri, 8 Dec 2023 16:07:01 +0100 Subject: [PATCH] build(premake): do not hardcode Premake5.lua to use clang (#53) --- .github/workflows/build.yml | 2 +- README.md | 3 ++- premake5.lua | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f9c823..d2f5f87 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,7 +99,7 @@ jobs: version: "5.0.0-beta2" - name: Generate project files - run: premake5 gmake2 + run: premake5 --cc=clang gmake2 - name: Set up problem matching uses: ammaraskar/gcc-problem-matcher@master diff --git a/README.md b/README.md index d8f036f..fd2d679 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,5 @@ This is the master server our clients use. It is based on the DP Master Server ( **IMPORTANT** For Unix systems, you must use Clang to compile this project. You will also be required to install the LLVM C++ Standard library to run this program. -If you need to use another compiler, like GCC, you must use the [Mold](https://github.com/rui314/mold) linker. Additionally, you must tweak the Premake5.lua script as it is hardcoded to use Clang. +If you need to use another compiler, like GCC, you must use the [Mold](https://github.com/rui314/mold) linker. Additionally, you may have to tweak the Premake5.lua script. +I only support a few platforms, for more details see [build.yml](https://github.com/alterware/master-server/blob/master/.github/workflows/build.yml) diff --git a/premake5.lua b/premake5.lua index 8905688..e455a14 100644 --- a/premake5.lua +++ b/premake5.lua @@ -71,16 +71,18 @@ filter { "system:linux", "system:macosx" } filter {} if os.istarget("linux") then - filter { "platforms:arm64" } + filter { "toolset:clang*", "platforms:arm64" } buildoptions "--target=arm64-linux-gnu" linkoptions "--target=arm64-linux-gnu" filter {} - buildoptions "-stdlib=libc++" - linkoptions "-stdlib=libc++" + filter { "toolset:clang*" } + buildoptions "-stdlib=libc++" + linkoptions "-stdlib=libc++" - -- always try to use lld. LD or Gold will not work - linkoptions "-fuse-ld=lld" + -- always try to use lld. LD or Gold will not work + linkoptions "-fuse-ld=lld" + filter {} end filter { "system:macosx", "platforms:arm64" }