| 1 | project(ortp) |
|---|
| 2 | |
|---|
| 3 | cmake_minimum_required(VERSION 2.6) |
|---|
| 4 | |
|---|
| 5 | file(GLOB ORTP_SRC_ALL src/*.c) |
|---|
| 6 | file(GLOB ORTP_SRC_WIN32 src/dll_entry.c) |
|---|
| 7 | set(ORTP_SRC ${ORTP_SRC_ALL}) |
|---|
| 8 | |
|---|
| 9 | if(NOT WIN32) |
|---|
| 10 | list(REMOVE_ITEM ORTP_SRC ${ORTP_SRC_WIN32}) |
|---|
| 11 | endif(NOT WIN32) |
|---|
| 12 | |
|---|
| 13 | if(CMAKE_UNDER_CE) |
|---|
| 14 | set(ORTP_SRC ${ORTP_SRC} build/wince/ortp.def) |
|---|
| 15 | endif(CMAKE_UNDER_CE) |
|---|
| 16 | |
|---|
| 17 | if(WIN32 AND NOT CMAKE_UNDER_CE) |
|---|
| 18 | set(ORTP_SRC ${ORTP_SRC} build/win32native/ortp.def) |
|---|
| 19 | endif(WIN32 AND NOT CMAKE_UNDER_CE) |
|---|
| 20 | |
|---|
| 21 | have_vars(dlfcn.h inttypes.h linux/soundcard.h memory.h |
|---|
| 22 | poll.h stdint.h strings.h string.h sys/audio.h stdlib.h fcntl.h sys/stat.h sys/uio.h unistd.h sys/time.h sys/types.h semaphore.h) |
|---|
| 23 | |
|---|
| 24 | if(ANDROID) |
|---|
| 25 | set(CMAKE_THREAD_LIBS_INIT "-lc") |
|---|
| 26 | endif() |
|---|
| 27 | include(FindThreads) |
|---|
| 28 | include(FindOpenSSL) |
|---|
| 29 | |
|---|
| 30 | set(ORTP_MAJOR_VERSION __ZERO__) |
|---|
| 31 | set(ORTP_MINOR_VERSION "16") |
|---|
| 32 | set(ORTP_MICRO_VERSION __ZERO__) |
|---|
| 33 | #set(ORTP_DEFAULT_THREAD_STACK_SIZE __ZERO__) |
|---|
| 34 | set(ORTP_VERSION "0.${ORTP_MINOR_VERSION}.0") |
|---|
| 35 | set(PACKAGE "ortp") |
|---|
| 36 | set(PACKAGE_BUGREPORT "ortp") |
|---|
| 37 | set(PACKAGE_NAME "ortp") |
|---|
| 38 | set(PACKAGE_STRING "${PACKAGE} ${ORTP_VERSION}") |
|---|
| 39 | set(POSIXTIMER_INTERVAL 10000) |
|---|
| 40 | set(SO_REUSE_ADDR 1) |
|---|
| 41 | set(VERSION ${ORTP_VERSION}) |
|---|
| 42 | |
|---|
| 43 | if(ANDROID) |
|---|
| 44 | set(HAVE_DEV_RANDOM 1) |
|---|
| 45 | endif(ANDROID) |
|---|
| 46 | |
|---|
| 47 | if(WIN32 AND NOT CMAKE_UNDER_CE) |
|---|
| 48 | set(CMAKE_REQUIRED_LIBRARIES WS2_32.Lib) |
|---|
| 49 | set(CMAKE_REQUIRED_FLAGS /FIwinsock2.h) |
|---|
| 50 | endif(WIN32 AND NOT CMAKE_UNDER_CE) |
|---|
| 51 | if(CMAKE_UNDER_CE) |
|---|
| 52 | set(CMAKE_REQUIRED_LIBRARIES WS2.Lib) |
|---|
| 53 | set(CMAKE_REQUIRED_FLAGS /FIwinsock2.h) |
|---|
| 54 | endif(CMAKE_UNDER_CE) |
|---|
| 55 | have_function(select socket) |
|---|
| 56 | |
|---|
| 57 | set(STDC_HEADERS true) |
|---|
| 58 | |
|---|
| 59 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ortp-config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ortp-config.h") |
|---|
| 60 | add_definitions( -DHAVE_CONFIG_H ) |
|---|
| 61 | |
|---|
| 62 | include_directories(include ${CMAKE_CURRENT_BINARY_DIR}) |
|---|
| 63 | |
|---|
| 64 | add_library(ortp SHARED ${ORTP_SRC}) |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | set(ORTP_LINK_LIBRARIES) |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | if(USE_CSL) |
|---|
| 72 | add_definitions( -DHAVE_CSL ) |
|---|
| 73 | include_directories(${CSL_INCLUDE_DIRS} ${ACSLCORE_INCLUDE_DIRS}) |
|---|
| 74 | set(ORTP_LINK_LIBRARIES ${ORTP_LINK_LIBRARIES} ${ACSLCORE_LIBRARIES}) |
|---|
| 75 | if(WIN32) |
|---|
| 76 | add_definitions(-DISL_DLLENTRY=__declspec\(dllexport\)) |
|---|
| 77 | else(WIN32) |
|---|
| 78 | add_definitions(-DISL_DLLENTRY=) |
|---|
| 79 | endif(WIN32) |
|---|
| 80 | endif(USE_CSL) |
|---|
| 81 | |
|---|
| 82 | if(WIN32 AND NOT CMAKE_UNDER_CE) |
|---|
| 83 | set(ORTP_LINK_LIBRARIES ${ORTP_LINK_LIBRARIES} ws2_32 winmm) |
|---|
| 84 | endif(WIN32 AND NOT CMAKE_UNDER_CE) |
|---|
| 85 | if(CMAKE_UNDER_CE) |
|---|
| 86 | set(ORTP_LINK_LIBRARIES ${ORTP_LINK_LIBRARIES} ws2 mmTimer) |
|---|
| 87 | endif(CMAKE_UNDER_CE) |
|---|
| 88 | if(OPENSSL_FOUND) |
|---|
| 89 | set(ORTP_LINK_LIBRARIES ${ORTP_LINK_LIBRARIES} ssl crypto) |
|---|
| 90 | endif(OPENSSL_FOUND) |
|---|
| 91 | target_link_libraries(ortp ${ORTP_LINK_LIBRARIES}) |
|---|
| 92 | if(NOT ANDROID) |
|---|
| 93 | set_target_properties(ortp PROPERTIES VERSION ${ORTP_VERSION} SOVERSION ${ORTP_VERSION}) |
|---|
| 94 | endif() |
|---|
| 95 | |
|---|
| 96 | set(ORTP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" CACHE PATH "Include path for oRTP library") |
|---|
| 97 | set(ORTP_LIB_DIR ${LIBRARY_OUTPUT_DIRECTORY} CACHE PATH "Output directory for oRTP library") |
|---|
| 98 | set(ORTP_LIBRARIES ortp CACHE STRING "ortp libraries") |
|---|
| 99 | #subdirs(src/tests) |
|---|
| 100 | |
|---|
| 101 | if (BUILD_ORTP_TEST) |
|---|
| 102 | file(GLOB ORTP_TEST_SRC src/tests/*.c) |
|---|
| 103 | foreach(i ${ORTP_TEST_SRC}) |
|---|
| 104 | string(REPLACE ".c" "" prog ${i}) |
|---|
| 105 | string(REGEX REPLACE ".*/" "" prog ${prog}) |
|---|
| 106 | message("Adding executable ${prog} ${i})") |
|---|
| 107 | add_executable(${prog} ${i}) |
|---|
| 108 | target_link_libraries(${prog} ortp) |
|---|
| 109 | endforeach(i) |
|---|
| 110 | endif (BUILD_ORTP_TEST) |
|---|
| 111 | |
|---|
| 112 | |
|---|