Commit 13ce3f0 1 parent 489205c commit 13ce3f0 Copy full SHA for 13ce3f0
File tree 7 files changed +35
-5
lines changed
7 files changed +35
-5
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ jobs:
103
103
docker exec --user dev check_clang_tidy /home/dev/taichi/.github/workflows/scripts/check_clang_tidy.sh "$CI_SETUP_CMAKE_ARGS"
104
104
env :
105
105
CR_PAT : ${{ secrets.GITHUB_TOKEN }}
106
- CI_SETUP_CMAKE_ARGS : -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON
106
+ CI_SETUP_CMAKE_ARGS : -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=ON -DTI_BUILD_TESTS:BOOL=ON -DTI_WITH_BACKTRACE:BOOL=ON
107
107
108
108
build_and_test_cpu_mac :
109
109
name : Build and Test macos (CPU)
@@ -148,6 +148,7 @@ jobs:
148
148
-DTI_WITH_CC:BOOL=${{ matrix.with_cc }}
149
149
-DTI_WITH_VULKAN:BOOL=ON
150
150
-DTI_WITH_C_API=ON
151
+ -DTI_WITH_BACKTRACE:BOOL=ON
151
152
-DTI_BUILD_TESTS:BOOL=${{ matrix.with_cpp_tests }}
152
153
153
154
# [DEBUG] Copy this step around to enable debugging inside Github Action instances.
@@ -211,6 +212,7 @@ jobs:
211
212
-DTI_WITH_OPENGL:BOOL=ON
212
213
-DTI_WITH_CC:BOOL=ON
213
214
-DTI_WITH_VULKAN:BOOL=ON
215
+ -DTI_WITH_BACKTRACE:BOOL=ON
214
216
-DTI_BUILD_TESTS:BOOL=ON
215
217
-DTI_WITH_C_API=ON
216
218
@@ -293,6 +295,7 @@ jobs:
293
295
-DTI_WITH_DX12:BOOL=ON
294
296
-DTI_WITH_CC:BOOL=OFF
295
297
-DTI_BUILD_TESTS:BOOL=ON
298
+ -DTI_WITH_BACKTRACE=ON
296
299
-DTI_WITH_C_API=ON
297
300
298
301
- name : Test
@@ -353,6 +356,7 @@ jobs:
353
356
-DTI_WITH_CC:BOOL=OFF
354
357
-DTI_WITH_VULKAN:BOOL=ON
355
358
-DTI_BUILD_TESTS:BOOL=ON
359
+ -DTI_WITH_BACKTRACE:BOOL=ON
356
360
-DTI_WITH_C_API=ON
357
361
358
362
- name : Test
Original file line number Diff line number Diff line change 62
62
[submodule "external/DirectX-Headers "]
63
63
path = external/DirectX-Headers
64
64
url = https://github.com/microsoft/DirectX-Headers.git
65
+ [submodule "external/backward_cpp "]
66
+ path = external/backward_cpp
67
+ url = https://github.com/bombela/backward-cpp.git
Original file line number Diff line number Diff line change @@ -55,8 +55,14 @@ if(CCACHE_PROGRAM)
55
55
set (CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM} " )
56
56
endif ()
57
57
58
+ # This compiles all the libraries with -fPIC, which is critical to link a static
59
+ # library into a shared lib.
60
+ set (CMAKE_POSITION_INDEPENDENT_CODE ON )
61
+
62
+
58
63
option (USE_LLD "Use lld (from llvm) linker" OFF )
59
64
option (USE_MOLD "Use mold (A Modern Linker)" OFF )
65
+ option (TI_WITH_BACKTRACE "Use backward-cpp to print out C++ stack trace upon failure" OFF )
60
66
61
67
if (USE_LLD)
62
68
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld" )
@@ -122,6 +128,11 @@ option(TI_WITH_PYTHON "Build with Python language binding" ON)
122
128
if (TI_WITH_PYTHON AND NOT ANDROID)
123
129
include (cmake/PythonNumpyPybind11.cmake)
124
130
endif ()
131
+
132
+ if (TI_WITH_BACKTRACE)
133
+ add_subdirectory (external/backward_cpp)
134
+ endif ()
135
+
125
136
include (cmake/TaichiCXXFlags.cmake)
126
137
include (cmake/TaichiCore.cmake)
127
138
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ endif()
26
26
target_link_libraries (${C_API_TESTS_NAME} PRIVATE taichi_c_api)
27
27
target_link_libraries (${C_API_TESTS_NAME} PRIVATE gtest_main)
28
28
29
+ if (TI_WITH_BACKTRACE)
30
+ target_link_libraries (${C_API_TESTS_NAME} PRIVATE ${BACKWARD_ENABLE} )
31
+ endif ()
32
+
29
33
target_include_directories (${C_API_TESTS_NAME}
30
34
PRIVATE
31
35
${PROJECT_SOURCE_DIR}
Original file line number Diff line number Diff line change @@ -119,10 +119,6 @@ if (TI_WITH_CC)
119
119
list (APPEND TAICHI_CORE_SOURCE ${TAICHI_CC_SOURCE} )
120
120
endif ()
121
121
122
- # This compiles all the libraries with -fPIC, which is critical to link a static
123
- # library into a shared lib.
124
- set (CMAKE_POSITION_INDEPENDENT_CODE ON )
125
-
126
122
set (CORE_LIBRARY_NAME taichi_core)
127
123
add_library (${CORE_LIBRARY_NAME} OBJECT ${TAICHI_CORE_SOURCE} )
128
124
@@ -432,6 +428,13 @@ if(TI_WITH_PYTHON)
432
428
target_link_options (${CORE_WITH_PYBIND_LIBRARY_NAME} PUBLIC -Wl,--exclude -libs=ALL )
433
429
endif ()
434
430
431
+ if (TI_WITH_BACKTRACE)
432
+ # Defined by external/backward-cpp:
433
+ # This will add libraries, definitions and include directories needed by backward
434
+ # by setting each property on the target.
435
+ target_link_libraries (${CORE_WITH_PYBIND_LIBRARY_NAME} PRIVATE ${BACKWARD_ENABLE} )
436
+ endif ()
437
+
435
438
if (TI_WITH_GGUI)
436
439
target_compile_definitions (${CORE_WITH_PYBIND_LIBRARY_NAME} PRIVATE -DTI_WITH_GGUI)
437
440
target_link_libraries (${CORE_WITH_PYBIND_LIBRARY_NAME} PRIVATE taichi_ui_vulkan)
Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ endif()
60
60
target_link_libraries (${TESTS_NAME} PRIVATE taichi_core)
61
61
target_link_libraries (${TESTS_NAME} PRIVATE gtest_main)
62
62
63
+ if (TI_WITH_BACKTRACE)
64
+ target_link_libraries (${TESTS_NAME} PRIVATE ${BACKWARD_ENABLE} )
65
+ endif ()
66
+
63
67
if (TI_WITH_OPENGL OR TI_WITH_VULKAN)
64
68
target_link_libraries (${TESTS_NAME} PRIVATE gfx_runtime)
65
69
endif ()
You can’t perform that action at this time.
0 commit comments