summaryrefslogtreecommitdiff
path: root/cmake/Dependencies.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Dependencies.cmake')
-rw-r--r--cmake/Dependencies.cmake77
1 files changed, 56 insertions, 21 deletions
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 )
35 35
36############################################################################### 36###############################################################################
37# 37#
38# :: For Windows and other systems lacking pkg-config. 38# :: For MSVC Windows builds.
39#
40# These require specific installation paths of dependencies:
41# - libsodium in libsodium/Win32/Release/v140/static
42# - pthreads in pthreads-win32/Pre-built.2
43# - check in %PROGRAMFILES%/check
39# 44#
40############################################################################### 45###############################################################################
41 46
42if(NOT LIBSODIUM_FOUND) 47if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
43 include_directories(libsodium/include) 48 # libsodium
49 # ---------
44 find_library(LIBSODIUM_LIBRARIES 50 find_library(LIBSODIUM_LIBRARIES
45 NAMES 51 NAMES sodium libsodium
46 sodium
47 libsodium
48 PATHS 52 PATHS
49 libsodium/Win32/Release/v140/static 53 "libsodium/Win32/Release/v140/static"
50 libsodium/x64/Release/v140/static 54 "libsodium/x64/Release/v140/static"
51 ) 55 )
52 if(LIBSODIUM_LIBRARIES) 56 if(LIBSODIUM_LIBRARIES)
57 include_directories("libsodium/include")
53 set(LIBSODIUM_FOUND TRUE) 58 set(LIBSODIUM_FOUND TRUE)
59 add_definitions(-DSODIUM_STATIC)
60 message("libsodium: ${LIBSODIUM_LIBRARIES}")
61 else()
62 message(FATAL_ERROR "libsodium libraries not found")
54 endif() 63 endif()
55 add_definitions(-DSODIUM_STATIC)
56 message("libsodium: ${LIBSODIUM_LIBRARIES}")
57endif()
58 64
59if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") AND CMAKE_USE_WIN32_THREADS_INIT) 65 # check
60 include_directories(pthreads-win32/Pre-built.2/include) 66 # -----
61 find_library(CMAKE_THREAD_LIBS_INIT 67 #
62 NAMES 68 # We look for the check and compat (containing clock_gettime and other POSIX
63 pthreadVC2 69 # functions not present on Windows) libraries in Program Files, since that is
64 PATHS 70 # the default location where cmake installs its packages.
65 pthreads-win32/Pre-built.2/lib/x86 71 find_library(LIBCHECK_LIBRARIES
66 pthreads-win32/Pre-built.2/lib/x64 72 NAMES check libcheck
73 PATHS "$ENV{PROGRAMFILES}/check/lib"
74 )
75 find_library(LIBCOMPAT_LIBRARIES
76 NAMES compat libcompat
77 PATHS "$ENV{PROGRAMFILES}/check/lib"
67 ) 78 )
68 add_definitions(-DHAVE_STRUCT_TIMESPEC) 79 if(LIBCHECK_LIBRARIES AND LIBCOMPAT_LIBRARIES)
69 message("libpthreads: ${CMAKE_THREAD_LIBS_INIT}") 80 include_directories("$ENV{PROGRAMFILES}/check/include")
81 set(CHECK_FOUND TRUE)
82 set(CHECK_LIBRARIES ${LIBCHECK_LIBRARIES} ${LIBCOMPAT_LIBRARIES})
83 message("check: ${CHECK_LIBRARIES}")
84 else()
85 message(FATAL_ERROR "check libraries not found")
86 endif()
87
88 # pthreads
89 # --------
90 if(CMAKE_USE_WIN32_THREADS_INIT)
91 find_library(CMAKE_THREAD_LIBS_INIT
92 NAMES pthreadVC2
93 PATHS
94 "pthreads-win32/Pre-built.2/lib/x86"
95 "pthreads-win32/Pre-built.2/lib/x64"
96 )
97 if(CMAKE_THREAD_LIBS_INIT)
98 include_directories("pthreads-win32/Pre-built.2/include")
99 add_definitions(-DHAVE_STRUCT_TIMESPEC)
100 message("libpthreads: ${CMAKE_THREAD_LIBS_INIT}")
101 else()
102 message(FATAL_ERROR "libpthreads libraries not found")
103 endif()
104 endif()
70endif() 105endif()