From 505860911a562f25a8ada1bc294786c3a63b848f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 15 Feb 2022 15:47:45 -0500 Subject: Add OSX LLVM JIT support (#2130) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. * Fixes to make compile on OSX. * Add github build for OSX. * Make premake generator a utility. * Fix osx compilation issue. * More fixes for OSX build. * OSX fix due to ambiguity around size_t and integer types. * Disable xlib on build on osx. * Use 'prebuildcommands' to make prebuild make utility projects do something. * Small fixes for premake so utility works on linux/osx. * Another hack to try and make generators run when 'utility' * Fix typo in macos.yml. * Revert premake to old style, and disable stdlib embedding on OSX. * OSX testing. * Fix pipe handling for OSX. * Enable testing on OSX. * Small fix because uname -p is not x64 on darwin. * Use glslang from slang-binaries for OSX. * Add slang-llvm on OSX. * Upgrade slang-llvm. * Update slang-llvm for OSX JIT fix. * slang llvm 26 * Upgrade slang-llvm. * Use slangUtil to get shared library filename. * Use fixed slang-binaries. * Another small fix. * Rename linux build for clarity. --- .github/workflows/c-cpp.yml | 34 ---------------------------------- .github/workflows/linux.yml | 34 ++++++++++++++++++++++++++++++++++ deps/target-deps.json | 10 +++++----- external/slang-binaries | 2 +- premake5.lua | 29 +++++++---------------------- 5 files changed, 47 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/c-cpp.yml create mode 100644 .github/workflows/linux.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml deleted file mode 100644 index e848b8170..000000000 --- a/.github/workflows/c-cpp.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: C/C++ CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - configuration: ['debug', 'release'] - compiler: ['gcc', 'clang'] - platform: ['x64'] - steps: - - uses: actions/checkout@v2.3.4 - with: - submodules: 'true' - fetch-depth: '0' - - name: build - run: - CC=${{matrix.compiler}} - CONFIGURATION=${{matrix.configuration}} - ARCH=${{matrix.platform}} - source ./github_build.sh - - name: test - run: - CONFIGURATION=${{matrix.configuration}} - CC=${{matrix.compiler}} - ARCH=${{matrix.platform}} - source ./github_test.sh \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 000000000..d9d0a7b66 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,34 @@ +name: Linux Build CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + configuration: ['debug', 'release'] + compiler: ['gcc', 'clang'] + platform: ['x64'] + steps: + - uses: actions/checkout@v2.3.4 + with: + submodules: 'true' + fetch-depth: '0' + - name: build + run: + CC=${{matrix.compiler}} + CONFIGURATION=${{matrix.configuration}} + ARCH=${{matrix.platform}} + source ./github_build.sh + - name: test + run: + CONFIGURATION=${{matrix.configuration}} + CC=${{matrix.compiler}} + ARCH=${{matrix.platform}} + source ./github_test.sh \ No newline at end of file diff --git a/deps/target-deps.json b/deps/target-deps.json index 3f43fe662..1b7a61f55 100644 --- a/deps/target-deps.json +++ b/deps/target-deps.json @@ -4,14 +4,14 @@ "dependencies" : [ { "name" : "slang-llvm", - "baseUrl" : "https://github.com/shader-slang/slang-llvm/releases/download/v13.x-22/", + "baseUrl" : "https://github.com/shader-slang/slang-llvm/releases/download/v13.x-27/", "optional" : true, "packages" : { - "windows-x86_64" : { "type" : "url", "path" : "slang-llvm-13.x-22-win64.zip" }, - "windows-x86" : { "type": "url", "path" : "slang-llvm-13.x-22-win32.zip" }, - "linux-x86_64" : { "type": "url", "path" : "slang-llvm-v13.x-22-linux-x86_64-release.zip" }, - "macosx-x86_64" : { "type": "url", "path" : "slang-llvm-v13.x-22-macosx-x86_64-release.zip" } + "windows-x86_64" : { "type" : "url", "path" : "slang-llvm-13.x-27-win64.zip" }, + "windows-x86" : { "type": "url", "path" : "slang-llvm-13.x-27-win32.zip" }, + "linux-x86_64" : { "type": "url", "path" : "slang-llvm-v13.x-27-linux-x86_64-release.zip" }, + "macosx-x86_64" : { "type": "url", "path" : "slang-llvm-v13.x-27-macosx-x86_64-release.zip" } } }, { diff --git a/external/slang-binaries b/external/slang-binaries index 8324a9309..d5d689343 160000 --- a/external/slang-binaries +++ b/external/slang-binaries @@ -1 +1 @@ -Subproject commit 8324a9309a60a8f9472abd0ce91f6122c6404535 +Subproject commit d5d689343969ba752f921f57f59f68806ea93c26 diff --git a/premake5.lua b/premake5.lua index cbe062617..d5a9d102a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1333,36 +1333,21 @@ newoption { local slangLLVMPath = deps:getProjectRelativePath("slang-llvm", "../../..") if slangLLVMPath then - - filter { "system:windows" } - postbuildcommands { - "{COPY} " .. slangLLVMPath .."/bin/" .. targetName .. "/release/slang-llvm.dll %{cfg.targetdir}" - } - - filter { "system:linux" } + filter { "system:linux or macosx or windows" } + local sharedLibName = slangUtil.getSharedLibraryFileName(targetInfo, "slang-llvm") postbuildcommands { - "{COPY} " .. slangLLVMPath .. "/bin/" .. targetName .. "/release/libslang-llvm.so %{cfg.targetdir}" + "{COPY} " .. slangLLVMPath .."/bin/" .. targetName .. "/release/" .. sharedLibName .. " %{cfg.targetdir}" } end -- If we are not building glslang from source, then be -- sure to copy a binary copy over to the output directory if not buildGlslang then - filter { "system:windows" } - postbuildcommands { - "{COPY} ../../../external/slang-binaries/bin/" .. targetName .. "/slang-glslang.dll %{cfg.targetdir}" - } - - filter { "system:linux" } - postbuildcommands { - "{COPY} ../../../external/slang-binaries/bin/" .. targetName .. "/libslang-glslang.so %{cfg.targetdir}" - } - - filter { "system:macosx" } + filter { "system:linux or macosx or windows" } + local sharedLibName = slangUtil.getSharedLibraryFileName(targetInfo, "slang-glslang") postbuildcommands { - "{COPY} ../../../external/slang-binaries/bin/" .. targetName .. "/libslang-glslang.dylib %{cfg.targetdir}" - } - + "{COPY} ../../../external/slang-binaries/bin/" .. targetName .. "/" .. sharedLibName .. " %{cfg.targetdir}" + } end filter {"configurations:debug"} -- cgit v1.2.3