File: Dependencies.cmake

package info (click to toggle)
libtoxcore 0.2.9-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,096 kB
  • sloc: ansic: 35,423; cpp: 1,526; sh: 642; python: 197; makefile: 78
file content (77 lines) | stat: -rw-r--r-- 2,332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
###############################################################################
#
# :: For UNIX-like systems that have pkg-config.
#
###############################################################################

include(ModulePackage)

find_package(Threads REQUIRED)

find_library(NSL_LIBRARIES          nsl          )
find_library(RT_LIBRARIES           rt           )
find_library(SOCKET_LIBRARIES       socket       )

# For toxcore.
pkg_use_module(LIBSODIUM            libsodium    )

# For toxav.
pkg_use_module(OPUS                 opus         )
pkg_use_module(VPX                  vpx          )

# For tox-bootstrapd.
pkg_use_module(LIBCONFIG            libconfig    )

# For tox-spectest.
pkg_use_module(MSGPACK              msgpack      )

# For av_test.
pkg_use_module(OPENCV               opencv       )
pkg_use_module(PORTAUDIO            portaudio-2.0)
pkg_use_module(SNDFILE              sndfile      )

###############################################################################
#
# :: For MSVC Windows builds.
#
# These require specific installation paths of dependencies:
# - libsodium in third-party/libsodium/Win32/Release/v140/dynamic
# - pthreads in third-party/pthreads-win32/Pre-built.2
#
###############################################################################

if(MSVC)
  # libsodium
  # ---------
  find_library(LIBSODIUM_LIBRARIES
    NAMES sodium libsodium
    PATHS
      "third_party/libsodium/Win32/Release/v140/dynamic"
      "third_party/libsodium/x64/Release/v140/dynamic"
  )
  if(LIBSODIUM_LIBRARIES)
    include_directories("third_party/libsodium/include")
    set(LIBSODIUM_FOUND TRUE)
    message("libsodium: ${LIBSODIUM_LIBRARIES}")
  else()
    message(FATAL_ERROR "libsodium libraries not found")
  endif()

  # pthreads
  # --------
  if(CMAKE_USE_WIN32_THREADS_INIT)
    find_library(CMAKE_THREAD_LIBS_INIT
      NAMES pthreadVC2
      PATHS
        "third_party/pthreads-win32/Pre-built.2/lib/x86"
        "third_party/pthreads-win32/Pre-built.2/lib/x64"
    )
    if(CMAKE_THREAD_LIBS_INIT)
      include_directories("third_party/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()