Skip to content

Commit be6bd27

Browse files
authored
Port tools/timeit.c for Windows (#50)
This patch implements timeit timing tool found at tools/timeit.c for Windows. It is required for compile time and run time calculations by the llvm-testsuite. At this moment llvm testsuite tests can not be compiled with clang-cl MSVC combination however we have also made required modifications to the cmake files to enable building timeit on windows with clang-cl/cl. In developer console with MSVC following command can be used to successfully build this code: set CC=c:\work\llvm-dev\build\bin\clang-cl.exe set CXX=c:\work\llvm-dev\build\bin\clang-cl.exe cmake -G Ninja -DTEST_SUITE_SUBDIRS= ..\llvm-test-suite Phabricator Review: https://reviews.llvm.org/D153263
1 parent 9ca97f5 commit be6bd27

File tree

2 files changed

+397
-34
lines changed

2 files changed

+397
-34
lines changed

cmake/modules/Host.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
set(TEST_SUITE_HOST_CC "cc" CACHE STRING "C compiler targetting the host")
1+
2+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT TEST_SUITE_HOST_CC)
3+
set(TEST_SUITE_HOST_CC "clang" CACHE STRING "C compiler targetting the host")
4+
else()
5+
set(TEST_SUITE_HOST_CC "cc" CACHE STRING "C compiler targetting the host")
6+
endif()
7+
28
mark_as_advanced(TEST_SUITE_HOST_CC)
39

410
function(llvm_add_host_executable targetname exename)
@@ -22,6 +28,11 @@ function(llvm_add_host_executable targetname exename)
2228
list(APPEND _objs ${_objfile})
2329
endforeach ()
2430

31+
# Append ".exe" to the executable name on Windows
32+
if(WIN32)
33+
set(exename "${exename}.exe")
34+
endif()
35+
2536
add_custom_command(OUTPUT ${exename}
2637
COMMAND ${TEST_SUITE_HOST_CC} ${_objs}
2738
-o "${CMAKE_CURRENT_BINARY_DIR}/${exename}" ${_arg_LDFLAGS}

0 commit comments

Comments
 (0)