Skip to content

Commit

Permalink
fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yong He committed Sep 28, 2022
1 parent 2af5591 commit 2a63321
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 25 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/release-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ jobs:
platform: ['x64']
targetPlatform: ['x64', 'aarch64']
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'
fetch-depth: '0'
- name: Build release project
id: build
run: |
echo "starting to build..."
export CC=${{matrix.compiler}}
export CONFIGURATION=${{matrix.configuration}}
export ARCH=${{matrix.platform}}
export TARGETARCH=${{matrix.targetPlatform}}
echo "building..."
source ./github_macos_build.sh
- name: "Import signing certificate"
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
Expand Down Expand Up @@ -46,21 +61,6 @@ jobs:
brew install mitchellh/gon/gon
security find-identity -v
brew install coreutils
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'
fetch-depth: '0'
- name: Build release project
id: build
run: |
echo "starting to build..."
export CC=${{matrix.compiler}}
export CONFIGURATION=${{matrix.configuration}}
export ARCH=${{matrix.platform}}
export TARGETARCH=${{matrix.targetPlatform}}
echo "building..."
source ./github_macos_build.sh
- name: Sign binaries
env:
IDENTITY_ID: d6ada82a113e4204aaad914e1013e9548ffd30d0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: |
.\premake.bat vs2019 --arch=x64 --ignore-deps=slang-llvm,slang-glslang --no-progress=true
MSBuild.exe slang.sln -v:m -m -property:Configuration=Release -property:Platform=x64 -property:WindowsTargetPlatformVersion=10.0.19041.0
.\premake.bat vs2019 --arch=${{matrix.platform}} --ignore-deps=slang-llvm,slang-glslang --no-progress=true --skip-source-generation=true
.\premake.bat vs2019 --arch=${{matrix.platform}} --ignore-deps=slang-llvm,slang-glslang --no-progress=true --skip-source-generation=true --deploy-slang-llvm=false --deploy-slang-glslang=false
# Do the premake for the actual target, downloading dependencies if necessary
- name: premake
if: ${{ matrix.platform != 'aarch64' }}
Expand Down
18 changes: 17 additions & 1 deletion github_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@ chmod u+x premake5
git describe --tags | sed -e "s/\(.*\)/\#define SLANG_TAG_VERSION \"\1\"/" > slang-tag-version.h
cat slang-tag-version.h

if [[ "" == "${TARGETARCH}" ]]; then
TARGETARCH=${ARCH}
fi

if [[ "${ARCH}" != "${TARGETARCH}" ]]; then

# Create the makefile
./premake5 gmake --cc=${CC} --enable-embed-stdlib=true --arch=${ARCH} --deps=true --no-progress=true

# Build the configuration
make config=${CONFIGURATION}_x64 -j`nproc`
make config=${CONFIGURATION}_${ARCH} -j`nproc`

# Create the makefile
./premake5 gmake --cc=${CC} --enable-embed-stdlib=true --arch=${TARGETARCH} --deps=true --no-progress=true --skip-source-generation=true --deploy-slang-llvm=false --deploy-slang-glslang=false

else
# Create the makefile
./premake5 gmake --cc=${CC} --enable-embed-stdlib=true --arch=${TARGETARCH} --deps=true --no-progress=true
fi

# Build the configuration
make config=${CONFIGURATION}_${TARGETARCH} -j`nproc`

17 changes: 16 additions & 1 deletion github_macos_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,25 @@ chmod u+x premake5
git describe --tags | sed -e "s/\(.*\)/\#define SLANG_TAG_VERSION \"\1\"/" > slang-tag-version.h
cat slang-tag-version.h

if [[ "" == "${TARGETARCH}" ]]; then
TARGETARCH=${ARCH}
fi

if [[ "${ARCH}" != "${TARGETARCH}" ]]; then

# Create the makefile
./premake5 gmake --cc=${CC} --enable-xlib=false --enable-embed-stdlib=true --arch=${ARCH} --deps=true --no-progress=true

# Build the configuration
make config=${CONFIGURATION}_x64 -j`sysctl -n hw.ncpu`
make config=${CONFIGURATION}_${ARCH} -j`sysctl -n hw.ncpu`

# Create the makefile
./premake5 gmake --cc=${CC} --enable-xlib=false --enable-embed-stdlib=true --arch=${TARGETARCH} --deps=true --no-progress=true --skip-source-generation=true --deploy-slang-llvm=false --deploy-slang-glslang=false

else
# Create the makefile
./premake5 gmake --cc=${CC} --enable-xlib=false --enable-embed-stdlib=true --arch=${TARGETARCH} --deps=true --no-progress=true
fi

# Build the configuration
make config=${CONFIGURATION}_${TARGETARCH} -j`sysctl -n hw.ncpu`
45 changes: 38 additions & 7 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,29 @@ newoption {
allowed = { { "true", "True"}, { "false", "False" } }
}

newoption {
trigger = "skip-source-generation",
description = "(Optional) If true will skip source generation steps.",
value = "bool",
default = "false",
allowed = { { "true", "True"}, { "false", "False" } }
}

newoption {
trigger = "deploy-slang-llvm",
description = "(Optional) If true will copy slang-llvm to output directory.",
value = "bool",
default = "true",
allowed = { { "true", "True"}, { "false", "False" } }
}
newoption {
trigger = "deploy-slang-glslang",
description = "(Optional) If true will copy slang-glslang to output directory.",
value = "bool",
default = "true",
allowed = { { "true", "True"}, { "false", "False" } }
}

buildLocation = _OPTIONS["build-location"]
executeBinary = (_OPTIONS["execute-binary"] == "true")
buildGlslang = (_OPTIONS["build-glslang"] == "true")
Expand All @@ -177,7 +200,9 @@ newoption {
enableProfile = (_OPTIONS["enable-profile"] == "true")
enableEmbedStdLib = (_OPTIONS["enable-embed-stdlib"] == "true")
enableXlib = (_OPTIONS["enable-xlib"] == "true")
enableExperimental = (_OPTIONS["enable-experimental-projects"] == "true")
skipSourceGeneration = (_OPTIONS["skip-source-generation"] == "true")
deployLLVM = (_OPTIONS["deploy-slang-llvm"] == "true")
deployGLSLang = (_OPTIONS["deploy-slang-glslang"] == "true")

-- If stdlib embedding is enabled, disable stdlib source embedding by default
disableStdlibSource = enableEmbedStdLib
Expand Down Expand Up @@ -1181,6 +1206,8 @@ tool "slangd"
buildinputs { builddir .. "/slang-embed" .. getExecutableSuffix() }
end

if not skipSourceGeneration then

generatorProject("run-generators", nil)

-- We make 'source/slang' the location of the source, to make paths to source
Expand Down Expand Up @@ -1323,7 +1350,7 @@ tool "slangd"
buildinputs { "%{cfg.targetdir}/slangc-bootstrap" .. executableSuffix }
buildcommands { '"%{cfg.targetdir}/slangc-bootstrap" -archive-type riff-lz4 -save-stdlib-bin-source "%{file.directory}/slang-stdlib-generated.h"' }
end

end -- not skipSourceGeneration

--
-- TODO: Slang's current `Makefile` build does some careful incantations
Expand Down Expand Up @@ -1360,7 +1387,9 @@ tool "slangd"

if enableEmbedStdLib then
-- We only have this dependency if we are embedding stdlib
dependson { "embed-stdlib-generator" }
if not skipSourceGeneration then
dependson { "embed-stdlib-generator" }
end
else
-- Disable StdLib embedding
defines { "SLANG_WITHOUT_EMBEDDED_STD_LIB" }
Expand Down Expand Up @@ -1395,12 +1424,14 @@ tool "slangd"
-- to generate. We do this by executing the run-generators 'dummy' project
-- which produces the appropriate source

dependson { "run-generators" }

if not skipSourceGeneration then
dependson { "run-generators" }
end

-- If we have slang-llvm copy it
local slangLLVMPath = deps:getProjectRelativePath("slang-llvm", "../../..")

if slangLLVMPath then
if slangLLVMPath and deployLLVM then
filter { "system:linux or macosx or windows" }
local sharedLibName = slangUtil.getSharedLibraryFileName(targetInfo, "slang-llvm")
postbuildcommands {
Expand All @@ -1412,7 +1443,7 @@ tool "slangd"

-- 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
if not buildGlslang and slangGlslangPath~=nil and deployGLSLang then
filter { "system:linux or macosx or windows" }
local sharedLibName = slangUtil.getSharedLibraryFileName(targetInfo, "slang-glslang")
postbuildcommands {
Expand Down

0 comments on commit 2a63321

Please sign in to comment.