Skip to content

Commit

Permalink
[misc] Output "taichi_cpp_tests.exe" to the "bin" folder on Windows (#…
Browse files Browse the repository at this point in the history
…2515)

* [misc] Place "taichi_cpp_tests" in "bin" folder

* restrict to windows and add docs

* minor fix

* Update docs/lang/articles/contribution/writing_cpp_tests.md

Co-authored-by: Ye Kuang <[email protected]>

* Apply review

Co-authored-by: Ye Kuang <[email protected]>
  • Loading branch information
xumingkuan and k-ye authored Jul 13, 2021
1 parent 6235a52 commit d2a139a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmake/TaichiTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ include_directories(
)

add_executable(${TESTS_NAME} ${TAICHI_TESTS_SOURCE})
if (WIN32)
# Output the executable to bin/ instead of build/Debug/...
set(TESTS_OUTPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set_target_properties(${TESTS_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTS_OUTPUT_DIR})
set_target_properties(${TESTS_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${TESTS_OUTPUT_DIR})
set_target_properties(${TESTS_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${TESTS_OUTPUT_DIR})
set_target_properties(${TESTS_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${TESTS_OUTPUT_DIR})
set_target_properties(${TESTS_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${TESTS_OUTPUT_DIR})
endif()
target_link_libraries(${TESTS_NAME} taichi_isolated_core)
target_link_libraries(${TESTS_NAME} gtest_main)

Expand Down
5 changes: 5 additions & 0 deletions docs/lang/articles/contribution/writing_cpp_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ make
./taichi_cpp_tests
```

:::note
On Windows, `taichi_cpp_tests.exe` will be placed inside the `%TAICHI_REPO_DIR%\bin` directory,
so you can directly run it after adding the directory to `PATH` in [Setting up Taichi for development](dev_install.md#setting-up-taichi-for-development-3).
:::

:::note
Consider polishing the CPP test infrastructure:

Expand Down

0 comments on commit d2a139a

Please sign in to comment.