Skip to content

Commit

Permalink
Put debug symbols in releases
Browse files Browse the repository at this point in the history
Closes #5267
  • Loading branch information
expipiplus1 committed Oct 23, 2024
1 parent 3ef0d51 commit f515561
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 28 deletions.
12 changes: 9 additions & 3 deletions .github/actions/common-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ runs:
# Some useful variables
config=${{inputs.config}}
Config=$(echo "${{inputs.config}}" | sed 's/debug/Debug/;s/release/Release/')
bin_dir=$(pwd)/build/$Config/bin
lib_dir=$(pwd)/build/$Config/lib
cmake_config=$(echo "${{inputs.config}}" | sed '
s/^debug$/Debug/
s/^release$/Release/
s/^releaseWithDebugInfo$/RelWithDebInfo/
s/^minSizeRelease$/MinSizeRel/
')
bin_dir=$(pwd)/build/$cmake_config/bin
lib_dir=$(pwd)/build/$cmake_config/lib
echo "config=$config" >> "$GITHUB_ENV"
echo "cmake_config=$cmake_config" >> "$GITHUB_ENV"
echo "bin_dir=$bin_dir" >> "$GITHUB_ENV"
echo "lib_dir=$lib_dir" >> "$GITHUB_ENV"
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
os: [linux, macos, windows]
config: [debug, release]
config: [debug, releaseWithDebugInfo]
compiler: [gcc, clang, cl]
platform: [x86_64, aarch64, wasm]
exclude:
Expand Down Expand Up @@ -54,14 +54,14 @@ jobs:
# quick or full conditionally otherwise
- test-category: smoke
- { os: windows, test-category: quick }
- { config: release, test-category: full }
- { config: releaseWithDebugInfo, test-category: full }
# default not full gpu tests
- full-gpu-tests: false
# The runners don't have a GPU by default except for the self-hosted ones
- has-gpu: false
# Self-hosted aarch64 build
- os: linux
config: release
config: releaseWithDebugInfo
compiler: gcc
platform: aarch64
test-category: smoke
Expand All @@ -70,7 +70,7 @@ jobs:
has-gpu: true
# Self-hosted full gpu build
- os: windows
config: release
config: releaseWithDebugInfo
compiler: cl
platform: x86_64
test-category: full
Expand Down Expand Up @@ -109,13 +109,13 @@ jobs:
cmake --workflow --preset generators --fresh
mkdir generators
cmake --install build --prefix generators --component generators
emcmake cmake -DSLANG_GENERATORS_PATH=generators/bin --preset emscripten -G "Ninja" -DSLANG_SLANG_LLVM_FLAVOR=DISABLE
cmake --build --preset emscripten --target slang
[ -f "build.em/Release/lib/libslang.a" ]
[ -f "build.em/Release/lib/libcompiler-core.a" ]
[ -f "build.em/Release/lib/libcore.a" ]
emcmake cmake -DSLANG_GENERATORS_PATH=generators/bin --preset emscripten -DSLANG_SLANG_LLVM_FLAVOR=DISABLE
cmake --build --preset emscripten --config "$cmake_config" --target slang
[ -f "build.em/$cmake_config/lib/libslang.a" ]
[ -f "build.em/$cmake_config/lib/libcompiler-core.a" ]
[ -f "build.em/$cmake_config/lib/libcore.a" ]
else
if [[ "${{ matrix.os }}" =~ "windows" && "${{ matrix.config }}" != "release" ]]; then
if [[ "${{ matrix.os }}" =~ "windows" && "${{ matrix.config }}" != "release" && "${{ matrix.config }}" != "releaseWithDebugInfo" ]]; then
# Doing a debug build will try to link against a release built llvm, this
# is a problem on Windows, so make slang-llvm in release build and use
# that as though it's a fetched binary via these presets.
Expand All @@ -127,7 +127,7 @@ jobs:
"-DCMAKE_COMPILE_WARNING_AS_ERROR=${{matrix.warnings-as-errors}}"
cmake --workflow --preset "${{matrix.config}}"
else
# Otherwise, use the system llvm we have just build or got from the
# Otherwise, use the "system" llvm we have just build or got from the
# cache in the setup phase
cmake --preset default --fresh \
-DSLANG_SLANG_LLVM_FLAVOR=USE_SYSTEM_LLVM \
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-linux-glibc-2-17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
cd /home/app
git config --global --add safe.directory /home/app
cmake --preset default --fresh -DSLANG_SLANG_LLVM_FLAVOR=DISABLE -DSLANG_EMBED_STDLIB=1
cmake --build --preset release
cpack --preset release -G ZIP
cpack --preset release -G TGZ
cmake --build --preset releaseWithDebugInfo
cpack --preset releaseWithDebugInfo -G ZIP
cpack --preset releaseWithDebugInfo -G TGZ
- name: Package Slang
id: package
Expand All @@ -38,15 +38,15 @@ jobs:
version=${triggering_ref#v}
base=$(pwd)/slang-${version}-linux-x86_64-glibc-2.17
sudo mv "$(pwd)/build/dist-release/slang.zip" "${base}.zip"
sudo mv "$(pwd)/build/dist-releaseWithDebugInfo/slang.zip" "${base}.zip"
echo "SLANG_BINARY_ARCHIVE_ZIP=${base}.zip" >> "$GITHUB_OUTPUT"
sudo mv "$(pwd)/build/dist-release/slang.tar.gz" "${base}.tar.gz"
sudo mv "$(pwd)/build/dist-releaseWithDebugInfo/slang.tar.gz" "${base}.tar.gz"
echo "SLANG_BINARY_ARCHIVE_TAR=${base}.tar.gz" >> "$GITHUB_OUTPUT"
- name: File check
run: |
find "build/dist-release" -print0 ! -iname '*.md' ! -iname '*.h' -type f | xargs -0 file
find "build/dist-releaseWithDebugInfo" -print0 ! -iname '*.md' ! -iname '*.h' -type f | xargs -0 file
- name: UploadBinary
uses: softprops/action-gh-release@v1
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [linux, macos, windows]
config: [release]
config: [releaseWithDebugInfo]
platform: [x86_64, aarch64]
test-category: [smoke]
include:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
run: |
cmake --workflow --preset generators --fresh
mkdir build-platform-generators
cmake --install build --config Release --component generators --prefix build-platform-generators
cmake --install build --config $cmake_config --component generators --prefix build-platform-generators
- name: Change dev tools to host arch (windows)
uses: ilammy/msvc-dev-cmd@v1
Expand All @@ -80,8 +80,8 @@ jobs:
- name: Build Slang
run: |
if [[ "${{ matrix.os }}" == "windows" && "${{ matrix.config }}" != "release" ]]; then
echo "Please see ci.yml for the steps to make debug builds work on Windows" >&2
if [[ "${{ matrix.os }}" == "windows" && "${{ matrix.config }}" != "release" && "${{ matrix.config }}" != "releaseWithDebugInfo" ]]; then
echo "Please see ci.yml for the steps to make non-release builds work on Windows" >&2
exit 1
fi
Expand Down Expand Up @@ -169,8 +169,8 @@ jobs:
mkdir ./ttmp
unzip "${base}.zip" -d ./ttmp
/bin/cp -rf build/Release/bin/* ./ttmp/bin/
/bin/cp -rf build/Release/lib/* ./ttmp/lib/
/bin/cp -rf build/$cmake_config/bin/* ./ttmp/bin/
/bin/cp -rf build/$cmake_config/lib/* ./ttmp/lib/
rm ${base}.zip
rm ${base}.tar.gz
cd ./ttmp
Expand Down
35 changes: 33 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{
"name": "emscripten",
"description": "Emscripten-based Wasm build",
"generator": "ninja",
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/build.em",
"cacheVariables": {
"SLANG_SLANG_LLVM_FLAVOR": "DISABLE",
Expand All @@ -34,7 +34,8 @@
"description": "Options specific for MSVC",
"cacheVariables": {
"CMAKE_C_FLAGS_INIT": "-D_ITERATOR_DEBUG_LEVEL=0 /MP",
"CMAKE_CXX_FLAGS_INIT": "-D_ITERATOR_DEBUG_LEVEL=0 /MP"
"CMAKE_CXX_FLAGS_INIT": "-D_ITERATOR_DEBUG_LEVEL=0 /MP",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
},
{
Expand Down Expand Up @@ -86,6 +87,11 @@
"configurePreset": "default",
"configuration": "Release"
},
{
"name": "releaseWithDebugInfo",
"configurePreset": "default",
"configuration": "RelWithDebInfo"
},
{
"name": "emscripten",
"configurePreset": "emscripten",
Expand Down Expand Up @@ -132,6 +138,14 @@
],
"packageDirectory": "dist-release"
},
{
"name": "releaseWithDebugInfo",
"inherits": "base",
"configurations": [
"RelWithDebInfo"
],
"packageDirectory": "dist-releaseWithDebugInfo"
},
{
"name": "debug",
"inherits": "base",
Expand Down Expand Up @@ -194,6 +208,23 @@
}
]
},
{
"name": "releaseWithDebugInfo",
"steps": [
{
"type": "configure",
"name": "default"
},
{
"type": "build",
"name": "releaseWithDebugInfo"
},
{
"type": "package",
"name": "releaseWithDebugInfo"
}
]
},
{
"name": "generators",
"steps": [
Expand Down

0 comments on commit f515561

Please sign in to comment.