diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/ConfigureCVC4.cmake | 13 | ||||
-rw-r--r-- | cmake/Toolchain-mingw64.cmake | 23 |
2 files changed, 35 insertions, 1 deletions
diff --git a/cmake/ConfigureCVC4.cmake b/cmake/ConfigureCVC4.cmake index 18061c778..f60e9043e 100644 --- a/cmake/ConfigureCVC4.cmake +++ b/cmake/ConfigureCVC4.cmake @@ -43,7 +43,18 @@ endif() check_include_file(unistd.h HAVE_UNISTD_H) check_include_file_cxx(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H) -check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) +# For Windows builds check if clock_gettime is available via -lpthread +# (pthread_time.h). +if(CVC4_WINDOWS_BUILD) + set(CMAKE_REQUIRED_FLAGS -pthread) + check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) + unset(CMAKE_REQUIRED_FLAGS) + if(HAVE_CLOCK_GETTIME) + add_c_cxx_flag(-pthread) + endif() +else() + check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) +endif() check_symbol_exists(ffs "strings.h" HAVE_FFS) check_symbol_exists(optreset "getopt.h" HAVE_DECL_OPTRESET) check_symbol_exists(sigaltstack "signal.h" HAVE_SIGALTSTACK) diff --git a/cmake/Toolchain-mingw64.cmake b/cmake/Toolchain-mingw64.cmake new file mode 100644 index 000000000..85c0622ed --- /dev/null +++ b/cmake/Toolchain-mingw64.cmake @@ -0,0 +1,23 @@ +# Toolchain file for building for Windows from Ubuntu. +# +# Use: cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake + +SET(CMAKE_SYSTEM_NAME Windows) + +set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) + +SET(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) +SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) +SET(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) + +# Set target environment path +SET(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) + +# Adjust the default behaviour of the find_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) + +set(CVC4_WINDOWS_BUILD TRUE) |