2017-01-21 01:42:30 +08:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# :: For UNIX-like systems that have pkg-config.
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
include(ModulePackage)
|
|
|
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2017-04-16 17:57:21 +08:00
|
|
|
find_library(NCURSES_LIBRARIES ncurses )
|
|
|
|
find_library(UTIL_LIBRARIES util )
|
|
|
|
find_library(RT_LIBRARIES rt )
|
2017-01-21 01:42:30 +08:00
|
|
|
|
|
|
|
# For toxcore.
|
2017-04-16 17:57:21 +08:00
|
|
|
pkg_use_module(LIBSODIUM libsodium )
|
2017-01-21 01:42:30 +08:00
|
|
|
|
|
|
|
# For toxav.
|
2017-04-16 17:57:21 +08:00
|
|
|
pkg_use_module(OPUS opus )
|
|
|
|
pkg_use_module(VPX vpx )
|
2017-01-21 01:42:30 +08:00
|
|
|
|
|
|
|
# For tox-bootstrapd.
|
2017-04-16 17:57:21 +08:00
|
|
|
pkg_use_module(LIBCONFIG libconfig )
|
2017-01-21 01:42:30 +08:00
|
|
|
|
|
|
|
# For auto tests.
|
2017-04-16 17:57:21 +08:00
|
|
|
pkg_use_module(CHECK check )
|
2017-01-21 01:42:30 +08:00
|
|
|
|
|
|
|
# For tox-spectest.
|
2017-04-16 17:57:21 +08:00
|
|
|
pkg_use_module(MSGPACK msgpack )
|
2017-01-21 01:42:30 +08:00
|
|
|
|
|
|
|
# For av_test.
|
2017-04-16 17:57:21 +08:00
|
|
|
pkg_use_module(OPENCV opencv )
|
|
|
|
pkg_use_module(PORTAUDIO portaudio-2.0)
|
|
|
|
pkg_use_module(SNDFILE sndfile )
|
2017-01-21 01:42:30 +08:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
2017-06-05 04:58:28 +08:00
|
|
|
# :: 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
|
2017-01-21 01:42:30 +08:00
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2017-06-05 04:58:28 +08:00
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
|
# libsodium
|
|
|
|
# ---------
|
2017-01-21 01:42:30 +08:00
|
|
|
find_library(LIBSODIUM_LIBRARIES
|
2017-06-05 04:58:28 +08:00
|
|
|
NAMES sodium libsodium
|
2017-01-21 01:42:30 +08:00
|
|
|
PATHS
|
2017-06-05 04:58:28 +08:00
|
|
|
"libsodium/Win32/Release/v140/static"
|
|
|
|
"libsodium/x64/Release/v140/static"
|
2017-01-21 01:42:30 +08:00
|
|
|
)
|
|
|
|
if(LIBSODIUM_LIBRARIES)
|
2017-06-05 04:58:28 +08:00
|
|
|
include_directories("libsodium/include")
|
2017-01-21 01:42:30 +08:00
|
|
|
set(LIBSODIUM_FOUND TRUE)
|
2017-06-05 04:58:28 +08:00
|
|
|
add_definitions(-DSODIUM_STATIC)
|
|
|
|
message("libsodium: ${LIBSODIUM_LIBRARIES}")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "libsodium libraries not found")
|
2017-01-21 01:42:30 +08:00
|
|
|
endif()
|
2017-02-20 08:54:49 +08:00
|
|
|
|
2017-06-05 04:58:28 +08:00
|
|
|
# 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"
|
2017-02-20 08:54:49 +08:00
|
|
|
)
|
2017-06-05 04:58:28 +08:00
|
|
|
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}")
|
|
|
|
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()
|
2017-02-20 08:54:49 +08:00
|
|
|
endif()
|