2021-04-27 01:28:21 +08:00
|
|
|
cmake_minimum_required(VERSION 3.19)
|
2019-03-26 14:58:06 +08:00
|
|
|
project(libnice
|
|
|
|
LANGUAGES C
|
|
|
|
VERSION 0.1.15)
|
2017-02-13 11:35:12 +08:00
|
|
|
SET (this_target libnice)
|
|
|
|
|
2020-11-07 05:31:54 +08:00
|
|
|
if (WIN32)
|
|
|
|
add_definitions(
|
|
|
|
-D_CRT_SECURE_NO_WARNINGS
|
|
|
|
-D_SCL_SECURE_NO_WARNINGS
|
|
|
|
-DHAVE_OPENSSL
|
|
|
|
-DPACKAGE_STRING="${PROJECT_VERSION}")
|
|
|
|
else()
|
|
|
|
add_definitions(
|
|
|
|
-DHAVE_OPENSSL
|
|
|
|
-DPACKAGE_STRING="${PROJECT_VERSION}"
|
|
|
|
-DHAVE_NETDB_H=1)
|
|
|
|
endif()
|
2017-02-13 11:35:12 +08:00
|
|
|
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/config.h ${CMAKE_SOURCE_DIR}/config.h COPYONLY)
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/libnice.def ${CMAKE_SOURCE_DIR}/libnice.def COPYONLY)
|
|
|
|
|
2021-04-27 01:28:21 +08:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(GLIB2 glib-2.0 gobject-2.0 gmodule-2.0 gio-2.0 IMPORTED_TARGET)
|
2017-02-13 11:35:12 +08:00
|
|
|
find_library(IPHLPAPI_LIBRARY iphlpapi)
|
|
|
|
find_library(WS2_32_LIB ws2_32)
|
2020-02-08 01:36:39 +08:00
|
|
|
find_library(ADVAPI32_LIB advapi32)
|
2019-03-26 14:58:06 +08:00
|
|
|
find_package(OpenSSL REQUIRED)
|
2017-02-13 11:35:12 +08:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/agent
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/random
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/socket
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/stun
|
2021-04-27 01:28:21 +08:00
|
|
|
${GLIB2_INCLUDE_DIRS})
|
2017-02-13 11:35:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
SET (SRCS
|
|
|
|
./agent/address.c
|
2019-03-26 14:58:06 +08:00
|
|
|
./agent/agent-enum-types.c
|
2017-02-13 11:35:12 +08:00
|
|
|
./agent/agent.c
|
|
|
|
./agent/candidate.c
|
|
|
|
./agent/component.c
|
|
|
|
./agent/conncheck.c
|
|
|
|
./agent/debug.c
|
|
|
|
./agent/discovery.c
|
|
|
|
./agent/inputstream.c
|
|
|
|
./agent/interfaces.c
|
|
|
|
./agent/iostream.c
|
|
|
|
./agent/outputstream.c
|
|
|
|
./agent/pseudotcp.c
|
|
|
|
./agent/stream.c
|
|
|
|
./random/random-glib.c
|
2019-03-26 14:58:06 +08:00
|
|
|
./random/random.c
|
|
|
|
./random/test.c
|
2017-02-13 11:35:12 +08:00
|
|
|
./socket/http.c
|
|
|
|
./socket/pseudossl.c
|
|
|
|
./socket/socket.c
|
|
|
|
./socket/socks5.c
|
|
|
|
./socket/tcp-active.c
|
|
|
|
./socket/tcp-bsd.c
|
|
|
|
./socket/tcp-passive.c
|
|
|
|
./socket/udp-bsd.c
|
|
|
|
./socket/udp-turn-over-tcp.c
|
2019-03-26 14:58:06 +08:00
|
|
|
./socket/udp-turn.c
|
2017-02-13 11:35:12 +08:00
|
|
|
./stun/debug.c
|
|
|
|
./stun/rand.c
|
|
|
|
./stun/stun5389.c
|
|
|
|
./stun/stunagent.c
|
|
|
|
./stun/stuncrc32.c
|
|
|
|
./stun/stunhmac.c
|
|
|
|
./stun/stunmessage.c
|
|
|
|
./stun/usages/bind.c
|
|
|
|
./stun/usages/ice.c
|
|
|
|
./stun/usages/timer.c
|
|
|
|
./stun/usages/turn.c
|
|
|
|
./stun/utils.c
|
|
|
|
./libnice.def
|
|
|
|
)
|
|
|
|
SET(HEADERS
|
|
|
|
./agent/address.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./agent/agent-enum-types.h
|
2017-02-13 11:35:12 +08:00
|
|
|
./agent/agent-priv.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./agent/agent.h
|
2017-02-13 11:35:12 +08:00
|
|
|
./agent/candidate.h
|
|
|
|
./agent/component.h
|
|
|
|
./agent/conncheck.h
|
|
|
|
./agent/debug.h
|
|
|
|
./agent/discovery.h
|
|
|
|
./agent/inputstream.h
|
|
|
|
./agent/interfaces.h
|
|
|
|
./agent/iostream.h
|
|
|
|
./agent/outputstream.h
|
|
|
|
./agent/pseudotcp.h
|
|
|
|
./agent/stream.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./config.h
|
|
|
|
./nice/nice.h
|
2017-02-13 11:35:12 +08:00
|
|
|
./random/random-glib.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./random/random.h
|
2017-02-13 11:35:12 +08:00
|
|
|
./socket/http.h
|
|
|
|
./socket/pseudossl.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./socket/socket-priv.h
|
2017-02-13 11:35:12 +08:00
|
|
|
./socket/socket.h
|
|
|
|
./socket/socks5.h
|
|
|
|
./socket/tcp-active.h
|
|
|
|
./socket/tcp-bsd.h
|
|
|
|
./socket/tcp-passive.h
|
|
|
|
./socket/udp-bsd.h
|
|
|
|
./socket/udp-turn-over-tcp.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./socket/udp-turn.h
|
2017-02-13 11:35:12 +08:00
|
|
|
./stun/constants.h
|
|
|
|
./stun/debug.h
|
|
|
|
./stun/rand.h
|
|
|
|
./stun/stun5389.h
|
|
|
|
./stun/stunagent.h
|
|
|
|
./stun/stuncrc32.h
|
|
|
|
./stun/stunhmac.h
|
|
|
|
./stun/stunmessage.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./stun/tools/stund.h
|
2017-02-13 11:35:12 +08:00
|
|
|
./stun/usages/bind.h
|
|
|
|
./stun/usages/ice.h
|
|
|
|
./stun/usages/timer.h
|
|
|
|
./stun/usages/turn.h
|
|
|
|
./stun/utils.h
|
|
|
|
./stun/win32_common.h
|
2019-03-26 14:58:06 +08:00
|
|
|
./win32/vs9/config.h
|
2017-02-13 11:35:12 +08:00
|
|
|
)
|
|
|
|
add_library(libnice ${SRCS} ${HEADERS})
|
2020-11-07 05:31:54 +08:00
|
|
|
if (MSVC)
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4244 /wd4005 /wd4391 /wd4142 /wd4267")
|
|
|
|
endif()
|
|
|
|
if (WIN32)
|
2021-04-27 01:28:21 +08:00
|
|
|
target_link_libraries(libnice ${IPHLPAPI_LIBRARY} ${WS2_32_LIB} ${ADVAPI32_LIB} PkgConfig::GLIB2 OpenSSL::SSL)
|
2020-11-07 05:31:54 +08:00
|
|
|
else()
|
2021-04-27 01:28:21 +08:00
|
|
|
target_link_libraries(libnice PkgConfig::GLIB2 OpenSSL::SSL)
|
2020-11-07 05:31:54 +08:00
|
|
|
endif()
|
2017-02-13 11:35:12 +08:00
|
|
|
install(TARGETS libnice
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
LIBRARY DESTINATION lib)
|
|
|
|
|
2017-10-12 22:52:48 +08:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
2017-02-13 11:35:12 +08:00
|
|
|
install(FILES agent/address.h DESTINATION include/nice)
|
|
|
|
install(FILES agent/agent.h DESTINATION include/nice)
|
|
|
|
install(FILES agent/candidate.h DESTINATION include/nice)
|
|
|
|
install(FILES agent/debug.h DESTINATION include/nice)
|
|
|
|
install(FILES agent/interfaces.h DESTINATION include/nice)
|
|
|
|
install(FILES nice/nice.h DESTINATION include/nice)
|
|
|
|
install(FILES agent/pseudotcp.h DESTINATION include/nice)
|
|
|
|
install(FILES stun/constants.h DESTINATION include/stun)
|
|
|
|
install(FILES stun/debug.h DESTINATION include/stun)
|
|
|
|
install(FILES stun/stunagent.h DESTINATION include/stun)
|
|
|
|
install(FILES stun/stunmessage.h DESTINATION include/stun)
|
|
|
|
install(FILES stun/usages/bind.h DESTINATION include/stun/usages)
|
|
|
|
install(FILES stun/usages/ice.h DESTINATION include/stun/usages)
|
|
|
|
install(FILES stun/usages/timer.h DESTINATION include/stun/usages)
|
|
|
|
install(FILES stun/usages/turn.h DESTINATION include/stun/usages)
|
|
|
|
install(FILES stun/win32_common.h DESTINATION include/stun)
|
2020-11-07 05:31:54 +08:00
|
|
|
endif()
|