diff --git a/.github/workflows/Linux_build.yml b/.github/workflows/Linux_build.yml index afc323d79..b914934d7 100644 --- a/.github/workflows/Linux_build.yml +++ b/.github/workflows/Linux_build.yml @@ -65,8 +65,8 @@ jobs: - name: Lint run: ./xb lint --all - build: - name: Build (LLVM ${{ matrix.LLVM_VERSION }}) + build-clang: + name: Build (Clang ${{ matrix.LLVM_VERSION }}) needs: lint runs-on: ubuntu-24.04 strategy: @@ -107,9 +107,48 @@ jobs: path: artifacts if-no-files-found: error +# build-gcc: +# name: Build (GCC ${{ matrix.GCC_VERSION }}) +# needs: lint +# runs-on: ubuntu-24.04 +# strategy: +# fail-fast: false +# matrix: +# GCC_VERSION: [14] +# steps: +# - uses: actions/checkout@main +# with: +# fetch-depth: 0 +# - name: Setup +# run: | +# sudo apt-get -y update +# sudo apt-get -y install mesa-vulkan-drivers valgrind libc++-dev libc++abi-dev libgtk-3-dev libsdl2-dev libvulkan-dev libx11-xcb-dev g++-${{ matrix.GCC_VERSION }} +# ./xb setup +# - name: Build +# env: +# CC: gcc-${{ matrix.GCC_VERSION }} +# CXX: g++-${{ matrix.GCC_VERSION }} +# # AR: ar +# run: ./xb build --config=Release +# - name: Prepare artifacts +# id: prepare_artifacts +# run: | +# if [ $(stat -c %s build/bin/Linux/Release/xenia_canary) -le 100000 ]; then +# echo "::error::Binary is too small." +# fi +# mkdir -p artifacts +# cp -r build/bin/Linux/Release/xenia_canary LICENSE artifacts +# - name: Upload xenia canary artifacts +# if: steps.prepare_artifacts.outcome == 'success' +# uses: actions/upload-artifact@main +# with: +# name: xenia_canary_linux_gcc +# path: artifacts +# if-no-files-found: error + create-release: name: Create release - needs: [lint, build] + needs: [lint, build-clang] #build-gcc if: | github.repository == 'xenia-canary/xenia-canary' && github.event.action != 'pull_request' && diff --git a/premake5.lua b/premake5.lua index 5fee82dde..548140fb9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -32,6 +32,7 @@ defines({ "USE_CPP17", -- Tabulate }) +cdialect("C17") cppdialect("C++20") exceptionhandling("On") rtti("On") @@ -62,12 +63,12 @@ filter("configurations:Checked") "DEBUG", }) -filter({"configurations:Checked", "platforms:Windows"}) +filter({"configurations:Checked", "platforms:Windows"}) -- "toolset:msc" buildoptions({ "/RTCsu", -- Full Run-Time Checks. }) -filter({"configurations:Checked", "platforms:Linux"}) +filter({"configurations:Checked or Debug", "platforms:Linux"}) defines({ "_GLIBCXX_DEBUG", -- libstdc++ debug mode }) @@ -80,10 +81,10 @@ filter("configurations:Debug") "_NO_DEBUG_HEAP=1", }) -filter({"configurations:Debug", "platforms:Linux"}) - defines({ - "_GLIBCXX_DEBUG", -- make dbg symbols work on some distros - }) +--filter({"configurations:Debug", "platforms:Linux"}) +-- defines({ +-- "_GLIBCXX_DEBUG", -- make dbg symbols work on some distros +-- }) filter("configurations:Release") runtime("Release") @@ -93,6 +94,9 @@ filter("configurations:Release") }) optimize("Speed") symbols("Off") + flags({ + "NoBufferSecurityCheck" + }) inlining("Auto") editandcontinue("Off") -- Not using floatingpoint("Fast") - NaN checks are used in some places @@ -102,25 +106,22 @@ filter("configurations:Release") -- (such as constant propagation) emulation as predictable as possible, -- including handling of specials since games make assumptions about them. -filter({"configurations:Release", "platforms:Windows"}) +filter({"configurations:Release", "platforms:Windows"}) -- "toolset:msc" linktimeoptimization("On") symbols("On") - flags({ - "NoBufferSecurityCheck" - }) buildoptions({ "/Gw", "/Ob3", --- "/Qpar", -- TODO: Test this. +-- "/Qpar", -- TODO: Test this. }) filter("platforms:Linux") system("linux") toolset("clang") vectorextensions("AVX2") - buildoptions({ - -- "-mlzcnt", -- (don't) Assume lzcnt is supported. - }) + --buildoptions({ + -- "-mlzcnt", -- (don't) Assume lzcnt is supported. + --}) pkg_config.all("gtk+-x11-3.0") links({ "stdc++fs", @@ -133,15 +134,23 @@ filter("platforms:Linux") filter({"platforms:Linux", "kind:*App"}) linkgroups("On") -filter({"platforms:Linux", "language:C++", "toolset:gcc"}) +filter({"language:C++", "toolset:clang or gcc"}) -- "platforms:Linux" disablewarnings({ - "unused-result", - "deprecated-volatile", "switch", - "deprecated-enum-enum-conversion", + "attributes", }) -filter({"platforms:Linux", "toolset:gcc"}) +filter({"language:C++", "toolset:gcc"}) -- "platforms:Linux" + disablewarnings({ + "unused-result", + "volatile", + "template-id-cdtor", + "return-type", + "deprecated", + }) + +filter("toolset:gcc") -- "platforms:Linux" + removefatalwarnings("All") -- HACK if ARCH == "ppc64" then buildoptions({ "-m32", @@ -151,31 +160,36 @@ filter({"platforms:Linux", "toolset:gcc"}) "-m32", "-mpowerpc64" }) + else + buildoptions({ + "-fpermissive", -- HACK + }) + linkoptions({ + "-fpermissive", -- HACK + }) end -filter({"platforms:Linux", "language:C++", "toolset:clang"}) +filter({"language:C++", "toolset:clang"}) -- "platforms:Linux" disablewarnings({ "deprecated-register", "deprecated-volatile", - "switch", "deprecated-enum-enum-conversion", - "attributes", }) -CLANG_BIN = os.getenv("CC", _OPTIONS["cc"]) or "clang" +CLANG_BIN = os.getenv("CC") or _OPTIONS["cc"] or "clang" if os.istarget("linux") and string.contains(CLANG_BIN, "clang") then if tonumber(string.match(os.outputof(CLANG_BIN.." --version"), "version (%d%d)")) >= 20 then - filter({"platforms:Linux", "language:C++", "toolset:clang"}) + filter({"language:C++", "toolset:clang"}) -- "platforms:Linux" disablewarnings({ - "deprecated-literal-operator", -- Needed only for tabulate + "deprecated-literal-operator", -- Needed only for tabulate "nontrivial-memcall", }) end end ---filter({"platforms:Linux", "language:C++", "toolset:clang", "files:*.cc or *.cpp"}) --- buildoptions({ --- "-stdlib=libstdc++", --- }) +filter({"language:C", "toolset:clang or gcc"}) -- "platforms:Linux" + disablewarnings({ + "implicit-function-declaration", + }) filter("platforms:Android-*") system("android") @@ -200,11 +214,11 @@ filter("platforms:Windows") buildoptions({ "/utf-8", -- 'build correctly on systems with non-Latin codepages'. -- Disable warnings - "/wd4201", -- Nameless struct/unions are ok. + "/wd4201", -- Nameless struct/unions are ok. }) flags({ - "MultiProcessorCompile", -- Multiprocessor compilation. - "NoMinimalRebuild", -- Required for /MP above. + "MultiProcessorCompile", -- Multiprocessor compilation. + "NoMinimalRebuild", -- Required for /MP above. }) defines({