summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAnsa89 <ansalonistefano@gmail.com>2016-12-16 11:56:51 +0100
committerAnsa89 <ansalonistefano@gmail.com>2017-04-01 17:47:34 +0200
commit5ff099763b1f56414572e1c12eb2f003117db5a0 (patch)
tree300a850c82970ec9462fa43d346a3e7f799de186 /cmake
parent200ee1cace2f17537e6982ac447ea65d7c7a00b3 (diff)
Implement tox_loop
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Dependencies.cmake32
-rw-r--r--cmake/ModulePackage.cmake27
2 files changed, 47 insertions, 12 deletions
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 5ad332bd..4cb96594 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -8,30 +8,38 @@ include(ModulePackage)
8 8
9find_package(Threads REQUIRED) 9find_package(Threads REQUIRED)
10 10
11find_library(NCURSES_LIBRARIES ncurses ) 11find_library(NCURSES_LIBRARIES ncurses )
12find_library(UTIL_LIBRARIES util ) 12find_library(UTIL_LIBRARIES util )
13find_library(RT_LIBRARIES rt ) 13find_library(RT_LIBRARIES rt )
14 14
15# For toxcore. 15# For toxcore.
16pkg_use_module(LIBSODIUM libsodium ) 16pkg_use_module(LIBSODIUM libsodium )
17pkg_use_module(LIBEV ev )
18if(NOT LIBEV_FOUND)
19 if(NOT WIN32)
20 pkg_use_module(LIBEVENT libevent_pthreads )
21 else()
22 pkg_use_module(LIBEVENT libevent )
23 endif()
24endif()
17 25
18# For toxav. 26# For toxav.
19pkg_use_module(OPUS opus ) 27pkg_use_module(OPUS opus )
20pkg_use_module(VPX vpx ) 28pkg_use_module(VPX vpx )
21 29
22# For tox-bootstrapd. 30# For tox-bootstrapd.
23pkg_use_module(LIBCONFIG libconfig ) 31pkg_use_module(LIBCONFIG libconfig )
24 32
25# For auto tests. 33# For auto tests.
26pkg_use_module(CHECK check ) 34pkg_use_module(CHECK check )
27 35
28# For tox-spectest. 36# For tox-spectest.
29pkg_use_module(MSGPACK msgpack ) 37pkg_use_module(MSGPACK msgpack )
30 38
31# For av_test. 39# For av_test.
32pkg_use_module(OPENCV opencv ) 40pkg_use_module(OPENCV opencv )
33pkg_use_module(PORTAUDIO portaudio-2.0) 41pkg_use_module(PORTAUDIO portaudio-2.0 )
34pkg_use_module(SNDFILE sndfile ) 42pkg_use_module(SNDFILE sndfile )
35 43
36############################################################################### 44###############################################################################
37# 45#
diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake
index 3a4eb9b9..4d22ee41 100644
--- a/cmake/ModulePackage.cmake
+++ b/cmake/ModulePackage.cmake
@@ -2,6 +2,8 @@ option(ENABLE_SHARED "Build shared (dynamic) libraries for all modules" ON)
2option(ENABLE_STATIC "Build static libraries for all modules" ON) 2option(ENABLE_STATIC "Build static libraries for all modules" ON)
3option(COMPILE_AS_CXX "Compile all C code as C++ code" OFF) 3option(COMPILE_AS_CXX "Compile all C code as C++ code" OFF)
4 4
5include(FindPackageHandleStandardArgs)
6
5if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC) 7if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC)
6 message(WARNING 8 message(WARNING
7 "Both static and shared libraries are disabled; " 9 "Both static and shared libraries are disabled; "
@@ -48,6 +50,31 @@ function(pkg_use_module mod pkg)
48 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isystem ${dir}" PARENT_SCOPE) 50 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isystem ${dir}" PARENT_SCOPE)
49 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${dir}" PARENT_SCOPE) 51 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${dir}" PARENT_SCOPE)
50 endforeach() 52 endforeach()
53 else()
54 set(${mod}_DEFINITIONS ${${mod}_CFLAGS_OTHER})
55 find_path(${mod}_INCLUDE_DIR NAMES ${ARGV1}.h
56 HINTS ${${mod}_INCLUDEDIR} ${${mod}_INCLUDE_DIRS}
57 PATH_SUFFIXES ${ARGV1})
58 find_library(${mod}_LIBRARY NAMES ${ARGV1} lib${ARGV1}
59 HINTS ${${mod}_LIBDIR} ${${mod}_LIBRARY_DIRS})
60 find_package_handle_standard_args(${mod} DEFAULT_MSG
61 ${mod}_LIBRARY ${mod}_INCLUDE_DIR)
62
63 if(${mod}_FOUND)
64 mark_as_advanced(${mod}_INCLUDE_DIR ${mod}_LIBRARY)
65 set(${mod}_LIBRARIES ${${mod}_LIBRARY} PARENT_SCOPE)
66 set(${mod}_INCLUDE_DIRS ${${mod}_INCLUDE_DIR} PARENT_SCOPE)
67 set(${mod}_FOUND TRUE PARENT_SCOPE)
68 link_directories(${${mod}_LIBRARY_DIRS})
69 include_directories(${${mod}_INCLUDE_DIRS})
70 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${${mod}_CFLAGS_OTHER}" PARENT_SCOPE)
71 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${${mod}_CFLAGS_OTHER}" PARENT_SCOPE)
72
73 foreach(dir ${${mod}_INCLUDE_DIRS})
74 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -isystem ${dir}" PARENT_SCOPE)
75 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${dir}" PARENT_SCOPE)
76 endforeach()
77 endif()
51 endif() 78 endif()
52endfunction() 79endfunction()
53 80