Skip to content

Commit

Permalink
Link with -Wl,--no-undefined on linux and reenable lto
Browse files Browse the repository at this point in the history
At least now if lto removes something needed, the linker will error out immediately, also other minor premake cleanups
  • Loading branch information
edo9300 committed Apr 16, 2024
1 parent 35e0d2e commit 9f80e0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ygopro-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -29,6 +29,7 @@ if not subproject then
configurations { "Debug", "Release" }
symbols "On"
staticruntime "on"
startproject "ocgcoreshared"

if _OPTIONS["oldwindows"] then
toolset "v141_xp"
Expand Down Expand Up @@ -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('<XPDeprecationWarning>false</XPDeprecationWarning>')
end
Expand All @@ -87,7 +91,6 @@ if not subproject then
table.insertafter(calls, premake.vstudio.vc2010.globals, vcpkgStaticTriplet202006)
return calls
end)
startproject "ocgcoreshared"
end

project "ocgcore"
Expand All @@ -96,7 +99,7 @@ project "ocgcore"

project "ocgcoreshared"
kind "SharedLib"
flags "NoImportLib"
flags { "NoImportLib", "LinkTimeOptimization" }
targetname "ocgcore"
defines "OCGCORE_EXPORT_FUNCTIONS"
staticruntime "on"
Expand Down

0 comments on commit 9f80e0a

Please sign in to comment.