Skip to content

Commit 6d32569

Browse files
authored
Fix debug build and enable CI check for it (#439)
- Fix TBB debug library name - Add full debug build under testing on CI
1 parent eaa10b0 commit 6d32569

File tree

3 files changed

+151
-1
lines changed

3 files changed

+151
-1
lines changed

.github/workflows/main.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,55 @@ jobs:
8989
with:
9090
name: ubuntu-gcc-install-${{ matrix.os }}
9191
path: ubuntu-gcc-install-${{ matrix.os }}.tar.gz
92+
ubuntu-gcc-build-debug:
93+
needs:
94+
- clang-format
95+
- python-lint
96+
runs-on: ${{ matrix.os }}
97+
strategy:
98+
matrix:
99+
os: ["ubuntu-24.04"]
100+
steps:
101+
- uses: actions/checkout@v4
102+
with:
103+
submodules: recursive
104+
- name: Setup environment
105+
run: |
106+
sudo apt-get update
107+
sudo apt-get install --no-install-recommends -y gcc-14 g++-14 ninja-build libmpich-dev libomp-dev valgrind
108+
python3 -m pip install -r requirements.txt
109+
- name: ccache
110+
uses: hendrikmuhs/[email protected]
111+
with:
112+
key: ${{ runner.os }}-gcc
113+
create-symlink: true
114+
max-size: 1G
115+
- name: CMake configure
116+
run: >
117+
cmake -S . -B build
118+
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
119+
-G Ninja
120+
-D CMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=install
121+
env:
122+
CC: gcc-14
123+
CXX: g++-14
124+
- name: Build project
125+
run: |
126+
cmake --build build --parallel
127+
env:
128+
CC: gcc-14
129+
CXX: g++-14
130+
- name: Install project
131+
run: |
132+
cmake --build build --target install
133+
- name: Archive installed package
134+
run: |
135+
tar -czvf ubuntu-gcc-debug-install-${{ matrix.os }}.tar.gz -C install .
136+
- name: Upload installed package
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: ubuntu-gcc-debug-install-${{ matrix.os }}
140+
path: ubuntu-gcc-debug-install-${{ matrix.os }}.tar.gz
92141
ubuntu-gcc-test:
93142
needs:
94143
- ubuntu-gcc-build
@@ -539,6 +588,51 @@ jobs:
539588
with:
540589
name: macos-clang-sanitizer-install
541590
path: macos-clang-sanitizer-install.tar.gz
591+
macos-clang-build-debug:
592+
needs:
593+
- clang-format
594+
- python-lint
595+
runs-on: macOS-latest
596+
steps:
597+
- uses: actions/checkout@v4
598+
with:
599+
submodules: recursive
600+
- name: Setup environment
601+
run: |
602+
brew update-reset
603+
brew install ninja mpich llvm
604+
brew install libomp
605+
brew link libomp --overwrite --force
606+
brew install openssl
607+
brew link openssl --overwrite --force
608+
- name: ccache
609+
uses: hendrikmuhs/[email protected]
610+
with:
611+
key: ${{ runner.os }}-clang
612+
create-symlink: true
613+
max-size: 1G
614+
- name: CMake configure
615+
run: >
616+
cmake -S . -B build
617+
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
618+
-G Ninja -DCMAKE_C_FLAGS="-I$(brew --prefix)/opt/libomp/include"
619+
-DCMAKE_CXX_FLAGS="-I$(brew --prefix)/opt/libomp/include"
620+
-D CMAKE_BUILD_TYPE=DEBUG
621+
-DCMAKE_INSTALL_PREFIX=install
622+
- name: Build project
623+
run: |
624+
cmake --build build --parallel
625+
- name: Install project
626+
run: |
627+
cmake --build build --target install
628+
- name: Archive installed package
629+
run: |
630+
tar -czvf macos-clang-debug-install.tar.gz -C install .
631+
- name: Upload installed package
632+
uses: actions/upload-artifact@v4
633+
with:
634+
name: macos-clang-debug-install
635+
path: macos-clang-debug-install.tar.gz
542636
macos-clang-test:
543637
needs:
544638
- macos-clang-build
@@ -684,6 +778,55 @@ jobs:
684778
with:
685779
name: windows-msvc-install
686780
path: windows-msvc-install.zip
781+
windows-msvc-build-debug:
782+
needs:
783+
- clang-format
784+
- python-lint
785+
runs-on: windows-latest
786+
defaults:
787+
run:
788+
shell: bash
789+
steps:
790+
- uses: actions/checkout@v4
791+
with:
792+
submodules: recursive
793+
- name: Add msbuild to PATH
794+
uses: microsoft/setup-msbuild@v2
795+
with:
796+
vs-version: 'latest'
797+
- name: Setup MPI
798+
uses: mpi4py/setup-mpi@v1
799+
with:
800+
mpi: msmpi
801+
- name: Setup ccache
802+
uses: Chocobo1/setup-ccache-action@v1
803+
with:
804+
windows_compile_environment: msvc
805+
- name: Setup ninja
806+
uses: seanmiddleditch/gha-setup-ninja@v6
807+
- name: Setup MSVC for Ninja again
808+
uses: ilammy/msvc-dev-cmd@v1
809+
- name: CMake configure
810+
shell: bash
811+
run: >
812+
cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
813+
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
814+
-D CMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=install
815+
- name: Build project
816+
shell: bash
817+
run: |
818+
cmake --build build --config Debug --parallel
819+
- name: Install project
820+
run: |
821+
cmake --build build --target install
822+
- name: Archive installed package
823+
run: Compress-Archive -Path install -DestinationPath windows-msvc-debug-install.zip
824+
shell: pwsh
825+
- name: Upload installed package
826+
uses: actions/upload-artifact@v4
827+
with:
828+
name: windows-msvc-debug-install
829+
path: windows-msvc-debug-install.zip
687830
windows-msvc-test:
688831
needs:
689832
- windows-msvc-build

cmake/onetbb.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ ExternalProject_Add(ppc_onetbb
2525
)
2626
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ppc_onetbb/install/"
2727
DESTINATION "${CMAKE_INSTALL_PREFIX}")
28+
29+
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
30+
if(cmake_build_type_lower STREQUAL "debug")
31+
set(PPC_TBB_LIB_NAME tbb_debug)
32+
else()
33+
set(PPC_TBB_LIB_NAME tbb)
34+
endif()

tasks/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ foreach(TASK_TYPE ${LIST_OF_TASKS})
7878
add_dependencies(${EXEC_FUNC} ppc_onetbb)
7979
target_link_directories(${EXEC_FUNC} PUBLIC ${CMAKE_BINARY_DIR}/ppc_onetbb/install/lib)
8080
if(NOT MSVC)
81-
target_link_libraries(${EXEC_FUNC} PUBLIC tbb)
81+
target_link_libraries(${EXEC_FUNC} PUBLIC ${PPC_TBB_LIB_NAME})
8282
endif()
8383

8484
target_link_directories(stb_image INTERFACE ${CMAKE_SOURCE_DIR}/3rdparty/stb)

0 commit comments

Comments
 (0)