diff options
Diffstat (limited to 'cmake/Dependencies.cmake')
-rw-r--r-- | cmake/Dependencies.cmake | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake new file mode 100644 index 00000000..5970fde7 --- /dev/null +++ b/cmake/Dependencies.cmake | |||
@@ -0,0 +1,77 @@ | |||
1 | ############################################################################### | ||
2 | # | ||
3 | # :: For UNIX-like systems that have pkg-config. | ||
4 | # | ||
5 | ############################################################################### | ||
6 | |||
7 | include(ModulePackage) | ||
8 | |||
9 | find_package(Threads REQUIRED) | ||
10 | |||
11 | find_library(NSL_LIBRARIES nsl ) | ||
12 | find_library(RT_LIBRARIES rt ) | ||
13 | find_library(SOCKET_LIBRARIES socket ) | ||
14 | |||
15 | # For toxcore. | ||
16 | pkg_use_module(LIBSODIUM libsodium ) | ||
17 | |||
18 | # For toxav. | ||
19 | pkg_use_module(OPUS opus ) | ||
20 | pkg_use_module(VPX vpx ) | ||
21 | |||
22 | # For tox-bootstrapd. | ||
23 | pkg_use_module(LIBCONFIG libconfig ) | ||
24 | |||
25 | # For tox-spectest. | ||
26 | pkg_use_module(MSGPACK msgpack ) | ||
27 | |||
28 | # For av_test. | ||
29 | pkg_use_module(OPENCV opencv ) | ||
30 | pkg_use_module(PORTAUDIO portaudio-2.0) | ||
31 | pkg_use_module(SNDFILE sndfile ) | ||
32 | |||
33 | ############################################################################### | ||
34 | # | ||
35 | # :: For MSVC Windows builds. | ||
36 | # | ||
37 | # These require specific installation paths of dependencies: | ||
38 | # - libsodium in third-party/libsodium/Win32/Release/v140/dynamic | ||
39 | # - pthreads in third-party/pthreads-win32/Pre-built.2 | ||
40 | # | ||
41 | ############################################################################### | ||
42 | |||
43 | if(MSVC) | ||
44 | # libsodium | ||
45 | # --------- | ||
46 | find_library(LIBSODIUM_LIBRARIES | ||
47 | NAMES sodium libsodium | ||
48 | PATHS | ||
49 | "third_party/libsodium/Win32/Release/v140/dynamic" | ||
50 | "third_party/libsodium/x64/Release/v140/dynamic" | ||
51 | ) | ||
52 | if(LIBSODIUM_LIBRARIES) | ||
53 | include_directories("third_party/libsodium/include") | ||
54 | set(LIBSODIUM_FOUND TRUE) | ||
55 | message("libsodium: ${LIBSODIUM_LIBRARIES}") | ||
56 | else() | ||
57 | message(FATAL_ERROR "libsodium libraries not found") | ||
58 | endif() | ||
59 | |||
60 | # pthreads | ||
61 | # -------- | ||
62 | if(CMAKE_USE_WIN32_THREADS_INIT) | ||
63 | find_library(CMAKE_THREAD_LIBS_INIT | ||
64 | NAMES pthreadVC2 | ||
65 | PATHS | ||
66 | "third_party/pthreads-win32/Pre-built.2/lib/x86" | ||
67 | "third_party/pthreads-win32/Pre-built.2/lib/x64" | ||
68 | ) | ||
69 | if(CMAKE_THREAD_LIBS_INIT) | ||
70 | include_directories("third_party/pthreads-win32/Pre-built.2/include") | ||
71 | add_definitions(-DHAVE_STRUCT_TIMESPEC) | ||
72 | message("libpthreads: ${CMAKE_THREAD_LIBS_INIT}") | ||
73 | else() | ||
74 | message(FATAL_ERROR "libpthreads libraries not found") | ||
75 | endif() | ||
76 | endif() | ||
77 | endif() | ||