Skip to content

Commit 41d067c

Browse files
committed
cmake: Copy HashProgramOutput.sh to build dir
This avoids needing to reference the test-suite source directory when running benchmarks. llvm-svn: 341256
1 parent f74601f commit 41d067c

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

cmake/modules/SingleMultiSource.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ endfunction()
6161

6262
macro(llvm_test_verify_hash_program_output _file)
6363
llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
64-
${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${_file}
64+
${CMAKE_BINARY_DIR}/tools/HashProgramOutput.sh ${_file}
6565
)
6666
endmacro()
6767

cmake/modules/TestSuite.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ endfunction()
8585
# usually do not need to call this directly when using `llvm_test_executable`
8686
# or `llvm_test_library`.
8787
function(test_suite_add_build_dependencies target)
88-
add_dependencies(${target} build-timeit build-timeit-target build-fpcmp)
88+
add_dependencies(${target}
89+
build-HashProgramOutput.sh
90+
build-fpcmp
91+
build-timeit
92+
build-timeit-target
93+
)
8994
endfunction()
9095

9196
# Internal function that transforms a list of flags to a string and appends

tools/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Note that we have to compile fpcmp and timeit for the host machine even when
2-
# cross compiling to a different target. We use custom rules doing "cc file.c"
3-
# as an ad-hoc solution for now. A proper solution would probably be based on
4-
# ExternalProject_Add(); See also http://reviews.llvm.org/D15004
2+
# cross compiling to a different target. We use custom rules doing a simple
3+
# "cc file.c".
54

65
include(Host)
76

87
llvm_add_host_executable(build-fpcmp fpcmp fpcmp.c)
98

9+
add_custom_command(
10+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh
11+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh
12+
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh
13+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../HashProgramOutput.sh
14+
)
15+
add_custom_target(build-HashProgramOutput.sh DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh)
16+
1017
option(TEST_SUITE_USE_PERF "Use perf (timeit.sh) instead of timeit.c" OFF)
1118
if(TEST_SUITE_USE_PERF)
1219
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timeit

0 commit comments

Comments
 (0)