| 1 |
# ############################################################################## |
| 2 |
# Options |
| 3 |
|
| 4 |
# Include UPnP (Universal Plug and Play) support |
| 5 |
option(PJNATH_WITH_UPNP "Enable UPnP support" ON) |
| 6 |
if(PJNATH_WITH_UPNP) |
| 7 |
find_package(UPNP) |
| 8 |
if(NOT UPNP_FOUND) |
| 9 |
set(PJNATH_WITH_UPNP OFF CACHE BOOL "Enable UPnP support (not found)" FORCE) |
| 10 |
endif() |
| 11 |
endif() |
| 12 |
|
| 13 |
# ############################################################################## |
| 14 |
# Target |
| 15 |
|
| 16 |
add_library(pjnath |
| 17 |
src/pjnath/errno.c |
| 18 |
src/pjnath/ice_session.c |
| 19 |
src/pjnath/ice_strans.c |
| 20 |
src/pjnath/nat_detect.c |
| 21 |
src/pjnath/stun_auth.c |
| 22 |
src/pjnath/stun_msg.c |
| 23 |
src/pjnath/stun_msg_dump.c |
| 24 |
src/pjnath/stun_session.c |
| 25 |
src/pjnath/stun_sock.c |
| 26 |
src/pjnath/stun_transaction.c |
| 27 |
src/pjnath/turn_session.c |
| 28 |
src/pjnath/turn_sock.c |
| 29 |
src/pjnath/upnp.c |
| 30 |
) |
| 31 |
|
| 32 |
# headers |
| 33 |
target_sources(pjnath |
| 34 |
PUBLIC |
| 35 |
FILE_SET HEADERS |
| 36 |
BASE_DIRS |
| 37 |
include |
| 38 |
FILES |
| 39 |
include/pjnath.h |
| 40 |
include/pjnath/config.h |
| 41 |
include/pjnath/errno.h |
| 42 |
include/pjnath/ice_session.h |
| 43 |
include/pjnath/ice_strans.h |
| 44 |
include/pjnath/nat_detect.h |
| 45 |
include/pjnath/stun_auth.h |
| 46 |
include/pjnath/stun_config.h |
| 47 |
include/pjnath/stun_msg.h |
| 48 |
include/pjnath/stun_session.h |
| 49 |
include/pjnath/stun_sock.h |
| 50 |
include/pjnath/stun_transaction.h |
| 51 |
include/pjnath/turn_session.h |
| 52 |
include/pjnath/turn_sock.h |
| 53 |
include/pjnath/types.h |
| 54 |
include/pjnath/upnp.h |
| 55 |
) |
| 56 |
|
| 57 |
# ############################################################################## |
| 58 |
# Dependencies |
| 59 |
|
| 60 |
target_link_libraries(pjnath PUBLIC pjlib PRIVATE pjlib-util) |
| 61 |
|
| 62 |
# upnp |
| 63 |
if(PJNATH_WITH_UPNP) |
| 64 |
target_sources(pjnath PRIVATE src/pjnath/upnp.c) |
| 65 |
target_link_libraries(pjnath PRIVATE UPNP::UPNP) |
| 66 |
target_compile_definitions(pjnath PUBLIC PJNATH_HAS_UPNP=1) |
| 67 |
endif() |
| 68 |
|
| 69 |
# ############################################################################## |
| 70 |
# Client application |
| 71 |
|
| 72 |
add_executable(pjturn-client EXCLUDE_FROM_ALL |
| 73 |
src/pjturn-client/client_main.c |
| 74 |
) |
| 75 |
|
| 76 |
target_link_libraries(pjturn-client PRIVATE pjlib pjlib-util pjnath) |
| 77 |
|
| 78 |
# ############################################################################## |
| 79 |
# Server application |
| 80 |
|
| 81 |
add_executable(pjturn-srv EXCLUDE_FROM_ALL |
| 82 |
src/pjturn-srv/allocation.c |
| 83 |
src/pjturn-srv/auth.c |
| 84 |
src/pjturn-srv/listener_udp.c |
| 85 |
src/pjturn-srv/listener_tcp.c |
| 86 |
src/pjturn-srv/server.c |
| 87 |
src/pjturn-srv/main.c |
| 88 |
) |
| 89 |
|
| 90 |
target_link_libraries(pjturn-srv PRIVATE pjlib pjlib-util pjnath) |
| 91 |
|
| 92 |
# ############################################################################## |
| 93 |
# Test application |
| 94 |
|
| 95 |
if(BUILD_TESTING) |
| 96 |
add_executable(pjnath-test |
| 97 |
src/pjnath-test/ice_test.c |
| 98 |
src/pjnath-test/stun.c |
| 99 |
src/pjnath-test/sess_auth.c |
| 100 |
src/pjnath-test/server.c |
| 101 |
src/pjnath-test/concur_test.c |
| 102 |
src/pjnath-test/stun_sock_test.c |
| 103 |
src/pjnath-test/turn_sock_test.c |
| 104 |
src/pjnath-test/test.c |
| 105 |
src/pjnath-test/${PJ_TEST_MAIN} |
| 106 |
) |
| 107 |
|
| 108 |
target_link_libraries(pjnath-test PRIVATE pjlib pjlib-util pjnath) |
| 109 |
|
| 110 |
add_test(NAME pjnath-test COMMAND pjnath-test) |
| 111 |
endif() |