From 9f80e0a3269f0ffc427a759f81408b39b8141924 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Tue, 16 Apr 2024 21:38:29 +0200 Subject: [PATCH] Link with -Wl,--no-undefined on linux and reenable lto At least now if lto removes something needed, the linker will error out immediately, also other minor premake cleanups --- .github/workflows/ygopro-core.yml | 6 ------ premake5.lua | 15 +++++++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ygopro-core.yml b/.github/workflows/ygopro-core.yml index f938d60a..6967e45d 100644 --- a/.github/workflows/ygopro-core.yml +++ b/.github/workflows/ygopro-core.yml @@ -12,13 +12,7 @@ jobs: env: DEPLOY_BRANCH: travis-core-windows TRAVIS_OS_NAME: windows - VCPKG_ROOT: /c/vcpkg2 - VCPKG_DEFAULT_TRIPLET: x86-windows-static steps: - - name: Set custom env vars - shell: bash - run: | - echo "VCPKG_CACHE_ZIP_URL=$DEPENDENCIES_BASE_URL/installed_x86-windows-static.zip" >> $GITHUB_ENV - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - uses: actions/checkout@v1 diff --git a/premake5.lua b/premake5.lua index cb18743b..3392c656 100644 --- a/premake5.lua +++ b/premake5.lua @@ -7,10 +7,10 @@ local ocgcore_config=function() filter "action:not vs*" buildoptions { "-Wno-unused-parameter", "-pedantic" } - if os.istarget("macosx") then - filter { "files:processor_visit.cpp" } - buildoptions { "-fno-exceptions" } - end + filter "system:linux" + linkoptions { "-Wl,--no-undefined" } + filter { "system:macosx", "files:processor_visit.cpp" } + buildoptions { "-fno-exceptions" } filter {} include "lua" links { "lua" } @@ -29,6 +29,7 @@ if not subproject then configurations { "Debug", "Release" } symbols "On" staticruntime "on" + startproject "ocgcoreshared" if _OPTIONS["oldwindows"] then toolset "v141_xp" @@ -69,6 +70,9 @@ if not subproject then linkoptions { "-mthreads", "-municode", "-static-libgcc", "-static-libstdc++", "-static", "-lpthread" } defines { "UNICODE", "_UNICODE" } + filter { "system:linux" } + linkoptions { "-static-libgcc", "-static-libstdc++" } + local function disableWinXPWarnings(prj) premake.w('false') end @@ -87,7 +91,6 @@ if not subproject then table.insertafter(calls, premake.vstudio.vc2010.globals, vcpkgStaticTriplet202006) return calls end) - startproject "ocgcoreshared" end project "ocgcore" @@ -96,7 +99,7 @@ project "ocgcore" project "ocgcoreshared" kind "SharedLib" - flags "NoImportLib" + flags { "NoImportLib", "LinkTimeOptimization" } targetname "ocgcore" defines "OCGCORE_EXPORT_FUNCTIONS" staticruntime "on"