125 lines
3.5 KiB
CMake
125 lines
3.5 KiB
CMake
file(GLOB ixwebsocket CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/ixwebsocket/*.cpp)
|
|
|
|
add_library(ixwebsocket SHARED
|
|
${ixwebsocket}
|
|
)
|
|
|
|
target_include_directories(ixwebsocket PRIVATE
|
|
${CMAKE_SOURCE_DIR}/ixwebsocket/include
|
|
)
|
|
|
|
set_target_properties(ixwebsocket PROPERTIES
|
|
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/ixwebsocket/include
|
|
)
|
|
target_compile_options(ixwebsocket PRIVATE
|
|
-Wall
|
|
-Wextra
|
|
-pedantic
|
|
)
|
|
if(DEBUG)
|
|
target_compile_options(ixwebsocket PRIVATE
|
|
-g
|
|
)
|
|
target_link_options(ixwebsocket PRIVATE
|
|
-g
|
|
)
|
|
else()
|
|
target_compile_options(ixwebsocket PRIVATE
|
|
-O2
|
|
)
|
|
endif()
|
|
|
|
if(APPLE)
|
|
message("Building ixwebsocket for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}")
|
|
|
|
set_target_properties(ixwebsocket PROPERTIES
|
|
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}
|
|
BUILD_WITH_INSTALL_NAME_DIR TRUE
|
|
)
|
|
|
|
target_compile_definitions(ixwebsocket PRIVATE
|
|
IXWEBSOCKET_USE_TLS
|
|
IXWEBSOCKET_USE_SECURE_TRANSPORT
|
|
)
|
|
target_compile_options(ixwebsocket PRIVATE
|
|
"SHELL:-arch i386"
|
|
"SHELL:-arch x86_64"
|
|
)
|
|
target_link_options(ixwebsocket PRIVATE
|
|
"SHELL:-arch i386"
|
|
"SHELL:-arch x86_64"
|
|
)
|
|
target_link_libraries(ixwebsocket PRIVATE
|
|
"-framework Foundation"
|
|
"-framework Security"
|
|
)
|
|
elseif(UNIX)
|
|
message("Building ixwebsocket for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
|
|
|
set_target_properties(ixwebsocket PROPERTIES
|
|
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}
|
|
INSTALL_RPATH "\$ORIGIN"
|
|
)
|
|
|
|
target_compile_definitions(ixwebsocket PRIVATE
|
|
IXWEBSOCKET_USE_TLS
|
|
IXWEBSOCKET_USE_OPEN_SSL
|
|
IXWEBSOCKET_OPEN_SSL_CERTS="/etc/ssl/certs/"
|
|
)
|
|
target_compile_options(ixwebsocket PRIVATE
|
|
-nodefaultlibs
|
|
)
|
|
if(BIT STREQUAL "32")
|
|
target_compile_options(ixwebsocket PRIVATE
|
|
-m32
|
|
)
|
|
target_link_options(ixwebsocket PRIVATE
|
|
-m32
|
|
)
|
|
endif()
|
|
target_include_directories(ixwebsocket PRIVATE
|
|
${CMAKE_SOURCE_DIR}/openSSL/lin${BIT}/include
|
|
)
|
|
target_link_libraries(ixwebsocket PRIVATE
|
|
${CMAKE_SOURCE_DIR}/openSSL/lin${BIT}/libcrypto.so.1.1
|
|
${CMAKE_SOURCE_DIR}/openSSL/lin${BIT}/libssl.so.1.1
|
|
pthread
|
|
)
|
|
elseif(WIN32)
|
|
message("Building ixwebsocket for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
|
|
|
|
set_target_properties(ixwebsocket PROPERTIES
|
|
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}
|
|
)
|
|
|
|
target_compile_definitions(ixwebsocket PRIVATE
|
|
IXWEBSOCKET_USE_TLS
|
|
IXWEBSOCKET_USE_OPEN_SSL
|
|
IXWEBSOCKET_OPEN_SSL_CERTS=NULL
|
|
)
|
|
if(DEBUG)
|
|
target_compile_options(ixwebsocket PRIVATE
|
|
-gcodeview
|
|
)
|
|
target_link_options(ixwebsocket PRIVATE
|
|
-Wl,-pdb=
|
|
)
|
|
endif()
|
|
target_link_options(ixwebsocket PRIVATE
|
|
-static-libgcc
|
|
-static-libstdc++
|
|
)
|
|
target_include_directories(ixwebsocket PRIVATE
|
|
${CMAKE_SOURCE_DIR}/openSSL/win${BIT}/include
|
|
)
|
|
target_link_libraries(ixwebsocket PRIVATE
|
|
wsock32
|
|
ws2_32
|
|
shlwapi
|
|
crypt32
|
|
${CMAKE_SOURCE_DIR}/openSSL/win${BIT}/libcrypto-1_1.dll
|
|
${CMAKE_SOURCE_DIR}/openSSL/win${BIT}/libssl-1_1.dll
|
|
)
|
|
endif()
|
|
|
|
add_library(ixwebsocket::ixwebsocket ALIAS ixwebsocket) |