Repository navigation
Improve build scripts #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f3f3517
d7a2e2d
131d683
a154c24
c0acc92
7a4940e
5cda3dd
92c08d1
841c4e9
8e70363
b554846
035dea8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,40 @@ | ||
| string(COMPARE EQUAL "${GTEST_INCLUDE_DIR}" "" no_gtest_incl_dir) | ||
| string(COMPARE EQUAL "${GTEST_LIB_DIR}" "" no_gtest_lib_dir) | ||
|
|
||
| if(${no_gtest_incl_dir} OR ${no_gtest_lib_dir}) | ||
| message(WARNING | ||
| "GTest is needed to test PyDPPL's backend test cases. Pass in \ | ||
| -DGTEST_INCLUDE_DIR and -DGTEST_LIB_DIR when you configure Cmake if\ | ||
| you wish to run PyDPPL backend tests." | ||
| ) | ||
| else() | ||
| # We need thread support for gtest | ||
| find_package(Threads REQUIRED) | ||
|
|
||
| set(CMAKE_CTEST_COMMAND ctest -V) | ||
|
|
||
| # Emulate autotools like make check target to build tests | ||
| add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) | ||
| enable_testing() | ||
|
|
||
| include_directories(${GTEST_INCLUDE_DIR}) | ||
| include_directories(../include) | ||
|
|
||
| link_directories(${GTEST_LIB_DIR}) | ||
|
|
||
| set(PYDPPL_BACKEND_TEST_CASES | ||
| test_sycl_kernel_interface | ||
| test_sycl_platform_interface | ||
| test_sycl_program_interface | ||
| test_sycl_queue_interface | ||
| test_sycl_queue_manager | ||
| find_package(GTest REQUIRED) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question. I was not sure if the macro is smart enough to look under conda prefix.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have tested on Linux. It works fine.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On my system I have
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. So to get it to work, I need |
||
|
|
||
| # We need thread support for gtest | ||
| find_package(Threads REQUIRED) | ||
|
|
||
| set(CMAKE_CTEST_COMMAND ctest -V) | ||
|
|
||
| # Emulate autotools like make check target to build tests | ||
| add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) | ||
| enable_testing() | ||
|
|
||
| include_directories(${GTEST_INCLUDE_DIR}) | ||
| include_directories(../include) | ||
|
|
||
| link_directories(${GTEST_LIB_DIR}) | ||
|
|
||
| set(PYDPPL_BACKEND_TEST_CASES | ||
| test_sycl_kernel_interface | ||
| test_sycl_platform_interface | ||
| # test_sycl_program_interface | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: commented. |
||
| test_sycl_queue_interface | ||
| test_sycl_queue_manager | ||
| ) | ||
|
|
||
| # Copy the spir-v input files to test build directory | ||
| set(spirv-test-files | ||
| multi_kernel.spv | ||
| ) | ||
| foreach(tf ${spirv-test-files}) | ||
| file(COPY ${tf} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
| endforeach() | ||
|
|
||
| foreach(TEST_CASE ${PYDPPL_BACKEND_TEST_CASES}) | ||
| add_executable(${TEST_CASE} EXCLUDE_FROM_ALL ${TEST_CASE}.cpp) | ||
| target_link_libraries( | ||
| ${TEST_CASE} ${CMAKE_THREAD_LIBS_INIT} GTest::GTest DPPLSyclInterface | ||
| ) | ||
|
|
||
| # Copy the spir-v input files to test build directory | ||
| set(spirv-test-files | ||
| multi_kernel.spv | ||
| ) | ||
| foreach(tf ${spirv-test-files}) | ||
| file(COPY ${tf} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
| endforeach() | ||
|
|
||
| foreach(TEST_CASE ${PYDPPL_BACKEND_TEST_CASES}) | ||
| add_executable(${TEST_CASE} EXCLUDE_FROM_ALL ${TEST_CASE}.cpp) | ||
| target_link_libraries( | ||
| ${TEST_CASE} ${CMAKE_THREAD_LIBS_INIT} gtest DPPLSyclInterface | ||
| ) | ||
| add_test(NAME ${TEST_CASE} COMMAND ${TEST_CASE}) | ||
| add_dependencies(check ${TEST_CASE}) | ||
| endforeach() | ||
| endif() | ||
| add_test(NAME ${TEST_CASE} COMMAND ${TEST_CASE}) | ||
| add_dependencies(check ${TEST_CASE}) | ||
| endforeach() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these macros search in the conda prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.