diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-09-24 20:29:25 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-09-24 22:25:49 +0000 |
commit | bfd288c196cfacda78d4b702c1540a0172ef5521 (patch) | |
tree | aa7f42b97abd62f583f8eefc0e07741009671ca3 /cmake/Dependencies.cmake | |
parent | d5d6e3f60f22aee2735cb80db407c201a00e357b (diff) |
Revert "Improve cmake build for MSVC."
This reverts commit f87f8719d02a9adbc9413256fe22958267cfefee.
Diffstat (limited to 'cmake/Dependencies.cmake')
-rw-r--r-- | cmake/Dependencies.cmake | 77 |
1 files changed, 49 insertions, 28 deletions
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index c641e094..5970fde7 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake | |||
@@ -5,44 +5,19 @@ | |||
5 | ############################################################################### | 5 | ############################################################################### |
6 | 6 | ||
7 | include(ModulePackage) | 7 | include(ModulePackage) |
8 | include(SimpleFindPackage) | ||
9 | |||
10 | if (MSVC) | ||
11 | set(THREADS_USE_PTHREADS_WIN32 1) | ||
12 | endif() | ||
13 | 8 | ||
14 | find_package(Threads REQUIRED) | 9 | find_package(Threads REQUIRED) |
15 | 10 | ||
16 | if (MSVC) | ||
17 | set_property(TARGET Threads::Threads APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "HAVE_STRUCT_TIMESPEC") | ||
18 | endif() | ||
19 | |||
20 | find_library(NSL_LIBRARIES nsl ) | 11 | find_library(NSL_LIBRARIES nsl ) |
21 | find_library(RT_LIBRARIES rt ) | 12 | find_library(RT_LIBRARIES rt ) |
22 | find_library(SOCKET_LIBRARIES socket ) | 13 | find_library(SOCKET_LIBRARIES socket ) |
23 | 14 | ||
24 | # For toxcore. | 15 | # For toxcore. |
25 | 16 | pkg_use_module(LIBSODIUM libsodium ) | |
26 | # Try to find both static and shared variants of sodium | ||
27 | set(sodium_USE_STATIC_LIBS OFF) | ||
28 | find_package(sodium) | ||
29 | if (NOT TARGET sodium) | ||
30 | set(sodium_USE_STATIC_LIBS ON) | ||
31 | find_package(sodium REQUIRED) | ||
32 | endif() | ||
33 | 17 | ||
34 | # For toxav. | 18 | # For toxav. |
35 | simple_find_package(Opus | 19 | pkg_use_module(OPUS opus ) |
36 | PKGCFG_NAME opus | 20 | pkg_use_module(VPX vpx ) |
37 | INCLUDE_NAMES opus.h | ||
38 | PATH_SUFFIXES opus | ||
39 | LIB_NAMES opus) | ||
40 | |||
41 | simple_find_package(Vpx | ||
42 | PKGCFG_NAME vpx | ||
43 | INCLUDE_NAMES vpx_codec.h | ||
44 | PATH_SUFFIXES vpx | ||
45 | LIB_NAMES vpx vpxmd) | ||
46 | 21 | ||
47 | # For tox-bootstrapd. | 22 | # For tox-bootstrapd. |
48 | pkg_use_module(LIBCONFIG libconfig ) | 23 | pkg_use_module(LIBCONFIG libconfig ) |
@@ -54,3 +29,49 @@ pkg_use_module(MSGPACK msgpack ) | |||
54 | pkg_use_module(OPENCV opencv ) | 29 | pkg_use_module(OPENCV opencv ) |
55 | pkg_use_module(PORTAUDIO portaudio-2.0) | 30 | pkg_use_module(PORTAUDIO portaudio-2.0) |
56 | pkg_use_module(SNDFILE sndfile ) | 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() | ||