Skip to content

Commit

Permalink
Code adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 committed Nov 24, 2022
1 parent 8c3f83e commit 0e2aef0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_BACKTRACE:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -149,6 +150,7 @@ jobs:
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=OFF
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_BACKTRACE:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -201,6 +203,7 @@ jobs:
-DTI_WITH_OPENGL:BOOL=OFF
-DTI_WITH_CC:BOOL=OFF
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_BACKTRACE:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -250,6 +253,7 @@ jobs:
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_BACKTRACE:BOOL=ON
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
docker exec --user dev check_clang_tidy /home/dev/taichi/.github/workflows/scripts/check_clang_tidy.sh "$CI_SETUP_CMAKE_ARGS"
env:
CR_PAT: ${{ secrets.GITHUB_TOKEN }}
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
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

build_and_test_cpu_mac:
name: Build and Test macos (CPU)
Expand Down Expand Up @@ -148,6 +148,7 @@ jobs:
-DTI_WITH_CC:BOOL=${{ matrix.with_cc }}
-DTI_WITH_VULKAN:BOOL=ON
-DTI_WITH_C_API=ON
-DTI_WITH_BACKTRACE:BOOL=ON
-DTI_BUILD_TESTS:BOOL=${{ matrix.with_cpp_tests }}
# [DEBUG] Copy this step around to enable debugging inside Github Action instances.
Expand Down Expand Up @@ -211,6 +212,7 @@ jobs:
-DTI_WITH_OPENGL:BOOL=ON
-DTI_WITH_CC:BOOL=ON
-DTI_WITH_VULKAN:BOOL=ON
-DTI_WITH_BACKTRACE:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_C_API=ON
Expand Down Expand Up @@ -293,6 +295,7 @@ jobs:
-DTI_WITH_DX12:BOOL=ON
-DTI_WITH_CC:BOOL=OFF
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_BACKTRACE=ON
-DTI_WITH_C_API=ON
- name: Test
Expand Down Expand Up @@ -353,6 +356,7 @@ jobs:
-DTI_WITH_CC:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_BACKTRACE:BOOL=ON
-DTI_WITH_C_API=ON
- name: Test
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

option(USE_LLD "Use lld (from llvm) linker" OFF)
option(USE_MOLD "Use mold (A Modern Linker)" OFF)
option(TI_WITH_BACKTRACE "Use backward-cpp to print out C++ stack trace upon failure" OFF)

if (USE_LLD)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
Expand Down Expand Up @@ -134,8 +135,7 @@ if (TI_WITH_PYTHON AND NOT ANDROID)
include(cmake/PythonNumpyPybind11.cmake)
endif()

if (TI_BUILD_TESTS)
add_subdirectory(external/googletest EXCLUDE_FROM_ALL)
if (TI_WITH_BACKTRACE)
add_subdirectory(external/backward_cpp)
endif()

Expand All @@ -145,6 +145,7 @@ include(cmake/TaichiCore.cmake)
option(TI_BUILD_TESTS "Build the CPP tests" OFF)

if (TI_BUILD_TESTS)
add_subdirectory(external/googletest EXCLUDE_FROM_ALL)
include(cmake/TaichiTests.cmake)
endif()

Expand Down
5 changes: 4 additions & 1 deletion cmake/TaichiCAPITests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ if (WIN32)
endif()
target_link_libraries(${C_API_TESTS_NAME} PRIVATE taichi_c_api)
target_link_libraries(${C_API_TESTS_NAME} PRIVATE gtest_main)
target_link_libraries(${C_API_TESTS_NAME} PRIVATE ${BACKWARD_ENABLE})

if (TI_WITH_BACKTRACE)
target_link_libraries(${C_API_TESTS_NAME} PRIVATE ${BACKWARD_ENABLE})
endif()

target_include_directories(${C_API_TESTS_NAME}
PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion cmake/TaichiCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ if(TI_WITH_PYTHON)
target_link_options(${CORE_WITH_PYBIND_LIBRARY_NAME} PUBLIC -Wl,--exclude-libs=ALL)
endif()

if (TI_BUILD_TESTS)
if (TI_WITH_BACKTRACE)
# Defined by external/backward-cpp:
# This will add libraries, definitions and include directories needed by backward
# by setting each property on the target.
Expand Down
5 changes: 4 additions & 1 deletion cmake/TaichiTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ if (WIN32)
endif()
target_link_libraries(${TESTS_NAME} PRIVATE taichi_core)
target_link_libraries(${TESTS_NAME} PRIVATE gtest_main)
target_link_libraries(${TESTS_NAME} PRIVATE ${BACKWARD_ENABLE})

if (TI_WITH_BACKTRACE)
target_link_libraries(${TESTS_NAME} PRIVATE ${BACKWARD_ENABLE})
endif()

if (TI_WITH_OPENGL OR TI_WITH_VULKAN)
target_link_libraries(${TESTS_NAME} PRIVATE gfx_runtime)
Expand Down

0 comments on commit 0e2aef0

Please sign in to comment.