From ef1f45a3a70394d27e674ba0599ee1354e01fcb7 Mon Sep 17 00:00:00 2001 From: Eric Eide Date: Tue, 23 May 2017 10:52:55 -0600 Subject: [PATCH] On Windows, add `lrand48` sources to Csmith compile. When using CMake to build Csmith on Windows, compile and link with an implementation of `lrand48`. This commit also moves the relevant source files from `runtime/windows` to `src/windows`. Until now, we would distribute the source files but not compile them or link them with Csmith. --- src/CMakeLists.txt | 19 ++++++++++++++++--- {runtime => src}/windows/_rand48.c | 0 {runtime => src}/windows/lrand48.c | 0 {runtime => src}/windows/rand48.h | 0 {runtime => src}/windows/srand48.c | 0 5 files changed, 16 insertions(+), 3 deletions(-) rename {runtime => src}/windows/_rand48.c (100%) rename {runtime => src}/windows/lrand48.c (100%) rename {runtime => src}/windows/rand48.h (100%) rename {runtime => src}/windows/srand48.c (100%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82f10f963..690f8fa2b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,7 +43,7 @@ configure_file("git_version.cpp.in" "git_version.cpp" @ONLY) include_directories(${CMAKE_BINARY_DIR}) include_directories(${PROJECT_SOURCE_DIR}) # needed for gen'ed .cpp files -add_executable(csmith +set(csmith_SOURCES ${CMAKE_BINARY_DIR}/config.h AbsExtension.cpp AbsExtension.h @@ -205,14 +205,27 @@ add_executable(csmith util.cpp util.h ${PROJECT_BINARY_DIR}/git_version.cpp -) + ) +if(WIN32) + include_directories(${PROJECT_SOURCE_DIR}/windows) + list(APPEND csmith_SOURCES + windows/_rand48.c + windows/lrand48.c + windows/rand48.h + windows/srand48.c + ) +endif() + +add_executable(csmith + ${csmith_SOURCES} + ) # target_link_libraries(csmith ...) install(PROGRAMS "${PROJECT_BINARY_DIR}/csmith" DESTINATION "${BIN_DIR}" -) + ) ############################################################################### diff --git a/runtime/windows/_rand48.c b/src/windows/_rand48.c similarity index 100% rename from runtime/windows/_rand48.c rename to src/windows/_rand48.c diff --git a/runtime/windows/lrand48.c b/src/windows/lrand48.c similarity index 100% rename from runtime/windows/lrand48.c rename to src/windows/lrand48.c diff --git a/runtime/windows/rand48.h b/src/windows/rand48.h similarity index 100% rename from runtime/windows/rand48.h rename to src/windows/rand48.h diff --git a/runtime/windows/srand48.c b/src/windows/srand48.c similarity index 100% rename from runtime/windows/srand48.c rename to src/windows/srand48.c