From cb69b8a986b050020e175654a68ca62b6bfb8bc7 Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 4 Jun 2017 20:58:28 +0000 Subject: Build tests on appveyor, the MSVC build. Tests are not actually ran on appveyor for now, since they all fault for some reason. For now, we just build them. Also, some tests are disabled on msvc entirely, because they don't even compile. We'll need to look into those, later. They are disabled using `MSVC_DONT_BUILD`. --- cmake/Dependencies.cmake | 77 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 21 deletions(-) (limited to 'cmake') diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 5ad332bd..b87922a9 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -35,36 +35,71 @@ pkg_use_module(SNDFILE sndfile ) ############################################################################### # -# :: For Windows and other systems lacking pkg-config. +# :: For MSVC Windows builds. +# +# These require specific installation paths of dependencies: +# - libsodium in libsodium/Win32/Release/v140/static +# - pthreads in pthreads-win32/Pre-built.2 +# - check in %PROGRAMFILES%/check # ############################################################################### -if(NOT LIBSODIUM_FOUND) - include_directories(libsodium/include) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # libsodium + # --------- find_library(LIBSODIUM_LIBRARIES - NAMES - sodium - libsodium + NAMES sodium libsodium PATHS - libsodium/Win32/Release/v140/static - libsodium/x64/Release/v140/static + "libsodium/Win32/Release/v140/static" + "libsodium/x64/Release/v140/static" ) if(LIBSODIUM_LIBRARIES) + include_directories("libsodium/include") set(LIBSODIUM_FOUND TRUE) + add_definitions(-DSODIUM_STATIC) + message("libsodium: ${LIBSODIUM_LIBRARIES}") + else() + message(FATAL_ERROR "libsodium libraries not found") endif() - add_definitions(-DSODIUM_STATIC) - message("libsodium: ${LIBSODIUM_LIBRARIES}") -endif() -if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") AND CMAKE_USE_WIN32_THREADS_INIT) - include_directories(pthreads-win32/Pre-built.2/include) - find_library(CMAKE_THREAD_LIBS_INIT - NAMES - pthreadVC2 - PATHS - pthreads-win32/Pre-built.2/lib/x86 - pthreads-win32/Pre-built.2/lib/x64 + # check + # ----- + # + # We look for the check and compat (containing clock_gettime and other POSIX + # functions not present on Windows) libraries in Program Files, since that is + # the default location where cmake installs its packages. + find_library(LIBCHECK_LIBRARIES + NAMES check libcheck + PATHS "$ENV{PROGRAMFILES}/check/lib" + ) + find_library(LIBCOMPAT_LIBRARIES + NAMES compat libcompat + PATHS "$ENV{PROGRAMFILES}/check/lib" ) - add_definitions(-DHAVE_STRUCT_TIMESPEC) - message("libpthreads: ${CMAKE_THREAD_LIBS_INIT}") + if(LIBCHECK_LIBRARIES AND LIBCOMPAT_LIBRARIES) + include_directories("$ENV{PROGRAMFILES}/check/include") + set(CHECK_FOUND TRUE) + set(CHECK_LIBRARIES ${LIBCHECK_LIBRARIES} ${LIBCOMPAT_LIBRARIES}) + message("check: ${CHECK_LIBRARIES}") + else() + message(FATAL_ERROR "check libraries not found") + endif() + + # pthreads + # -------- + if(CMAKE_USE_WIN32_THREADS_INIT) + find_library(CMAKE_THREAD_LIBS_INIT + NAMES pthreadVC2 + PATHS + "pthreads-win32/Pre-built.2/lib/x86" + "pthreads-win32/Pre-built.2/lib/x64" + ) + if(CMAKE_THREAD_LIBS_INIT) + include_directories("pthreads-win32/Pre-built.2/include") + add_definitions(-DHAVE_STRUCT_TIMESPEC) + message("libpthreads: ${CMAKE_THREAD_LIBS_INIT}") + else() + message(FATAL_ERROR "libpthreads libraries not found") + endif() + endif() endif() -- cgit v1.2.3