From 1a83d50a5d9e85934386310c17a14860cc92e75c Mon Sep 17 00:00:00 2001 From: Craig Kolb Date: Tue, 31 May 2022 11:16:34 -0700 Subject: Work around MacOS compilation issue with embed stlib (#2255) - The enable-stdlib-generator project is created with 'kind = StaticLib' to allow the build to work, even though the project doesn't actually create a library. - Unlike some other platforms, MacOs "ar" emits an error if no object files are listed to be added to an archive. This causes enable-stdlib-generator to fail on MacOS. - Changing the project's kind to "SharedLib" works around the issue. Other values for kind do not seem to work around the issue. - Add an optional flag to generatorProject to indicate that kind = "SharedLibrary" should be used, rather than "StaticLibrary" - Add MacOS fix for SharedLibraryUtils::getSharedLibraryFileName(). - Enable embed stdlib in github_macos_build.sh --- premake5.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'premake5.lua') diff --git a/premake5.lua b/premake5.lua index d59c03f90..9b985e29d 100644 --- a/premake5.lua +++ b/premake5.lua @@ -628,7 +628,7 @@ newoption { -- build items needed for other dependencies --- - function generatorProject(name, sourcePath) + function generatorProject(name, sourcePath, isSharedLib) -- We use the `group` command here to specify that the -- next project we create shold be placed into a group -- named "generator" in a generated IDE solution/workspace. @@ -642,9 +642,13 @@ newoption { -- Set up the project, but do NOT add any source files. baseSlangProject(name, sourcePath) - -- For now we just use static lib to force something + -- By default, just use static lib to force something -- to build. - kind "StaticLib" + if isSharedLib then + kind "SharedLib" + else + kind "StaticLib" + end end -- @@ -1222,7 +1226,7 @@ standardProject("slang-rt", "source/slang-rt") end if enableEmbedStdLib then - generatorProject("embed-stdlib-generator", nil) + generatorProject("embed-stdlib-generator", nil, true) -- We include these, even though they are not really part of the dummy -- build, so that the filters below can pick up the appropriate locations. -- cgit v1.2.3