diff options
author | Matthias Braun <matze@braunis.de> | 2018-08-31 21:06:25 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2018-08-31 21:06:25 +0000 |
commit | 1cbf47c89068519c2e144a405544693c9d63f087 (patch) | |
tree | 45863592ae27cd7fdd7d69575297b52c1a2385b6 | |
parent | e2a3e6933a7309c8533695221edc687595ebc71c (diff) |
cmake: Copy HashProgramOutput.sh to build dir
This avoids needing to reference the test-suite source directory when
running benchmarks.
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@341256 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | cmake/modules/SingleMultiSource.cmake | 2 | ||||
-rw-r--r-- | cmake/modules/TestSuite.cmake | 7 | ||||
-rw-r--r-- | tools/CMakeLists.txt | 13 |
3 files changed, 17 insertions, 5 deletions
diff --git a/cmake/modules/SingleMultiSource.cmake b/cmake/modules/SingleMultiSource.cmake index f9ce47a9..7473a92c 100644 --- a/cmake/modules/SingleMultiSource.cmake +++ b/cmake/modules/SingleMultiSource.cmake @@ -61,7 +61,7 @@ endfunction() macro(llvm_test_verify_hash_program_output _file) llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${_file} + ${CMAKE_BINARY_DIR}/tools/HashProgramOutput.sh ${_file} ) endmacro() diff --git a/cmake/modules/TestSuite.cmake b/cmake/modules/TestSuite.cmake index fc571524..c69a4abc 100644 --- a/cmake/modules/TestSuite.cmake +++ b/cmake/modules/TestSuite.cmake @@ -85,7 +85,12 @@ endfunction() # usually do not need to call this directly when using `llvm_test_executable` # or `llvm_test_library`. function(test_suite_add_build_dependencies target) - add_dependencies(${target} build-timeit build-timeit-target build-fpcmp) + add_dependencies(${target} + build-HashProgramOutput.sh + build-fpcmp + build-timeit + build-timeit-target + ) endfunction() # Internal function that transforms a list of flags to a string and appends diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 28193c70..686f405a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,12 +1,19 @@ # Note that we have to compile fpcmp and timeit for the host machine even when -# cross compiling to a different target. We use custom rules doing "cc file.c" -# as an ad-hoc solution for now. A proper solution would probably be based on -# ExternalProject_Add(); See also http://reviews.llvm.org/D15004 +# cross compiling to a different target. We use custom rules doing a simple +# "cc file.c". include(Host) llvm_add_host_executable(build-fpcmp fpcmp fpcmp.c) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh + COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../HashProgramOutput.sh +) +add_custom_target(build-HashProgramOutput.sh DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh) + option(TEST_SUITE_USE_PERF "Use perf (timeit.sh) instead of timeit.c" OFF) if(TEST_SUITE_USE_PERF) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timeit |