-
Notifications
You must be signed in to change notification settings - Fork 37
/
CMakeLists.txt
50 lines (43 loc) · 1.92 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.18)
project(jitsisrtp_${JITSI_SRTP_LIBSSL_VERSION} C)
option(JITSI_SRTP_LIBSSL_VERSION "libssl version")
if (${JITSI_SRTP_LIBSSL_VERSION} MATCHES "1.1")
set(_JITSI_SRTP_LIBSSL_VERSION "1.1...2")
else ()
set(_JITSI_SRTP_LIBSSL_VERSION "${JITSI_SRTP_LIBSSL_VERSION}...99")
endif ()
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(JNA_SYSTEM_PROCESSOR "x86-64")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64el")
set(JNA_SYSTEM_PROCESSOR "ppc64le")
else ()
set(JNA_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
endif ()
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/src/main/resources/${CMAKE_SYSTEM_NAME}-${JNA_SYSTEM_PROCESSOR}" CACHE PATH "default install path" FORCE)
string(TOLOWER ${CMAKE_INSTALL_PREFIX} CMAKE_INSTALL_PREFIX)
message(STATUS "CMAKE_INSTALL_PREFIX not set, defaulting to >${CMAKE_INSTALL_PREFIX}<")
endif ()
find_package(OpenSSL ${_JITSI_SRTP_LIBSSL_VERSION} REQUIRED)
# TODO: CMake 3.24 will support import targets for JNI to only query JNI without AWT; use when released
find_package(JNI)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(${PROJECT_NAME} SHARED
src/main/native/JitsiCipherOpenSsl.c
src/main/native/JitsiHmacOpenSsl.c
src/main/native/JitsiOpenSslProvider.c
src/main/native/SrtpCipherGcmAuthOnlyOpenSsl.c
)
target_link_libraries(${PROJECT_NAME} PRIVATE
${JAVA_JVM_LIBRARY}
OpenSSL::Crypto
)
target_include_directories(${PROJECT_NAME} PUBLIC
${OPENSSL_INCLUDE_DIR}
${JNI_INCLUDE_DIRS}
${CMAKE_CURRENT_LIST_DIR}/target/native/javah
)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "."
LIBRARY DESTINATION "."
)