From ce0bf232d1b2c01df056df9a030e10ba5252832f Mon Sep 17 00:00:00 2001 From: iphydf Date: Fri, 20 Jan 2017 17:42:30 +0000 Subject: Add appveyor build for native windows tests. It doesn't compile, yet. A few changes (like VLA support) need to be made before we can enable appveyor as a required PR check. --- cmake/Dependencies.cmake | 56 +++++++++++++++++++++++++++++++++++++++++++++++ cmake/ModulePackage.cmake | 8 ++++--- 2 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 cmake/Dependencies.cmake (limited to 'cmake') diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake new file mode 100644 index 00000000..338a4193 --- /dev/null +++ b/cmake/Dependencies.cmake @@ -0,0 +1,56 @@ +############################################################################### +# +# :: For UNIX-like systems that have pkg-config. +# +############################################################################### + +include(ModulePackage) + +find_package(Threads REQUIRED) + +find_library(NCURSES_LIBRARIES ncurses ) +find_library(UTIL_LIBRARIES util ) +find_library(RT_LIBRARIES rt ) + +# 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 auto tests. +pkg_use_module(CHECK check ) + +# 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 Windows and other systems lacking pkg-config. +# +############################################################################### + +if(NOT LIBSODIUM_FOUND) + include_directories(include) + find_library(LIBSODIUM_LIBRARIES + NAMES + sodium + libsodium + PATHS + Win32/Release/v140/static + x64/Release/v140/static + ) + if(LIBSODIUM_LIBRARIES) + set(LIBSODIUM_FOUND TRUE) + endif() + message("libsodium: ${LIBSODIUM_LIBRARIES}") +endif() diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake index 38f841ba..3a4eb9b9 100644 --- a/cmake/ModulePackage.cmake +++ b/cmake/ModulePackage.cmake @@ -10,7 +10,7 @@ if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC) set(ENABLE_SHARED ON) endif() -find_package(PkgConfig REQUIRED) +find_package(PkgConfig) if(COMPILE_AS_CXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1") @@ -34,8 +34,10 @@ function(add_c_executable exec) add_executable(${exec} ${ARGN}) endfunction() -function(pkg_use_module mod) - pkg_search_module(${mod} ${ARGN}) +function(pkg_use_module mod pkg) + if(PKG_CONFIG_FOUND) + pkg_search_module(${mod} ${pkg}) + endif() if(${mod}_FOUND) link_directories(${${mod}_LIBRARY_DIRS}) include_directories(${${mod}_INCLUDE_DIRS}) -- cgit v1.2.3