[test-suite] r255614 - cmake: Use custom target to timeit/fpcmp, add timeit-target

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 19:44:03 PST 2015


Author: matze
Date: Mon Dec 14 21:44:03 2015
New Revision: 255614

URL: http://llvm.org/viewvc/llvm-project?rev=255614&view=rev
Log:
cmake: Use custom target to timeit/fpcmp, add timeit-target

When cross compiling we still need to compile timeit/fpcmp for the host
machine. These two are extremely simple C files so adding a custom
command that just runs "cc timeit.c -o timeit" should be fine.

See also the discussion in http://http://reviews.llvm.org/D15004,
the final solution for this problem may involve ExternalProject_Add, so
far I could not get this working (missing install targets in the
subdirectory, no way to build timeit-target into the same directory).
In order to not block cmake/lit progress I will commit the low-tech
solution with custom targets first, as that is better than the current
broken state when crosscompiling. We can still fix this properly later.

Modified:
    test-suite/trunk/cmake/modules/SingleMultiSource.cmake
    test-suite/trunk/tools/CMakeLists.txt

Modified: test-suite/trunk/cmake/modules/SingleMultiSource.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=255614&r1=255613&r2=255614&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/SingleMultiSource.cmake (original)
+++ test-suite/trunk/cmake/modules/SingleMultiSource.cmake Mon Dec 14 21:44:03 2015
@@ -152,7 +152,7 @@ macro(llvm_singlesource)
       append_cflags(${source_exename} CXXFLAGS)
       append_ldflags(${source_exename} LDFLAGS)
       llvm_add_test(${name} ${source_exename})
-      add_dependencies(${source_exename} timeit fpcmp)
+      add_dependencies(${source_exename} timeit timeit-target fpcmp)
     endif()
   endforeach()
 endmacro()
@@ -182,7 +182,7 @@ macro(llvm_multisource)
     append_ldflags(${source_exename} LDFLAGS)
     target_link_libraries(${source_exename} -lm)
     llvm_add_test(${PROG} ${source_exename})
-    add_dependencies(${source_exename} timeit fpcmp)
+    add_dependencies(${source_exename} timeit timeit-target fpcmp)
   endif()
   endif()
 endmacro()

Modified: test-suite/trunk/tools/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/CMakeLists.txt?rev=255614&r1=255613&r2=255614&view=diff
==============================================================================
--- test-suite/trunk/tools/CMakeLists.txt (original)
+++ test-suite/trunk/tools/CMakeLists.txt Mon Dec 14 21:44:03 2015
@@ -1,6 +1,13 @@
 add_executable(timeit-target timeit.c)
 
-# FIXME: These need to be host-compiled, if we're cross compiling.
 # FIXME: Replicate Makefile.tools's logic for determining whether to use fpcmp/fpcmp.sh
-add_executable(fpcmp fpcmp.c)
-add_executable(timeit timeit.c)
+set(TEST_SUITE_HOST_CC "cc" CACHE STRING "C compiler targetting the host")
+mark_as_advanced(TEST_SUITE_HOST_CC)
+add_custom_target(fpcmp
+  COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/fpcmp.c -o ${CMAKE_CURRENT_BINARY_DIR}/fpcmp
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fpcmp.c
+)
+add_custom_target(timeit
+  COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c -o ${CMAKE_CURRENT_BINARY_DIR}/timeit
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c
+)




More information about the llvm-commits mailing list