|
|
|
@ -1,9 +1,11 @@ |
|
|
|
include(functions/FetchContent_MakeAvailableExcludeFromAll) |
|
|
|
include(functions/FetchContent_MakeAvailableExcludeFromAll) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set(BUILD_HOST_SELFTEST OFF) |
|
|
|
|
|
|
|
|
|
|
|
include(FetchContent) |
|
|
|
include(FetchContent) |
|
|
|
FetchContent_Declare(libzt |
|
|
|
FetchContent_Declare(libzt |
|
|
|
GIT_REPOSITORY https://github.com/diasurgical/libzt.git |
|
|
|
GIT_REPOSITORY https://github.com/diasurgical/libzt.git |
|
|
|
GIT_TAG b2be9882771116fcfd4ad918f36de8587324d9e7) |
|
|
|
GIT_TAG a9974991b031fd8f84c4bcfd93f129b3938ed8c8) |
|
|
|
FetchContent_MakeAvailableExcludeFromAll(libzt) |
|
|
|
FetchContent_MakeAvailableExcludeFromAll(libzt) |
|
|
|
|
|
|
|
|
|
|
|
if(NOT ANDROID) |
|
|
|
if(NOT ANDROID) |
|
|
|
@ -12,19 +14,25 @@ else() |
|
|
|
set(libzt_LIB_NAME zt-shared) |
|
|
|
set(libzt_LIB_NAME zt-shared) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# External library, ignore all warnings |
|
|
|
foreach( |
|
|
|
target_compile_options(zto_obj PRIVATE -w) |
|
|
|
lib_name |
|
|
|
target_compile_options(libnatpmp_obj PRIVATE -w) |
|
|
|
zto_obj |
|
|
|
target_compile_options(libzt_obj PRIVATE -w) |
|
|
|
libnatpmp_obj |
|
|
|
target_compile_options(lwip_obj PRIVATE -w) |
|
|
|
libzt_obj |
|
|
|
target_compile_options(miniupnpc_obj PRIVATE -w) |
|
|
|
lwip_obj |
|
|
|
target_compile_options(${libzt_LIB_NAME} PRIVATE -w) |
|
|
|
miniupnpc_obj |
|
|
|
|
|
|
|
zto_pic |
|
|
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") |
|
|
|
natpmp_pic |
|
|
|
target_compile_options(zto_obj PRIVATE -fpermissive) |
|
|
|
lwip_pic |
|
|
|
target_compile_options(libzt_obj PRIVATE -fpermissive) |
|
|
|
miniupnpc_pic |
|
|
|
target_compile_options(${libzt_LIB_NAME} PRIVATE -fpermissive) |
|
|
|
ztcore |
|
|
|
endif() |
|
|
|
${libzt_LIB_NAME} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
if(TARGET ${lib_name}) |
|
|
|
|
|
|
|
# External library, ignore all warnings |
|
|
|
|
|
|
|
target_compile_options(${lib_name} PRIVATE -w) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endforeach(lib_name) |
|
|
|
|
|
|
|
|
|
|
|
target_include_directories(${libzt_LIB_NAME} INTERFACE |
|
|
|
target_include_directories(${libzt_LIB_NAME} INTERFACE |
|
|
|
"${libzt_SOURCE_DIR}/include" |
|
|
|
"${libzt_SOURCE_DIR}/include" |
|
|
|
@ -40,22 +48,9 @@ else() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
if(MINGW_CROSS) |
|
|
|
if(MINGW_CROSS) |
|
|
|
option(MINGW_STDTHREADS_GENERATE_STDHEADERS "" ON) |
|
|
|
include(zt_defs REQUIRED) |
|
|
|
|
|
|
|
|
|
|
|
FetchContent_Declare(mingw-std-threads |
|
|
|
|
|
|
|
GIT_REPOSITORY https://github.com/meganz/mingw-std-threads |
|
|
|
|
|
|
|
GIT_TAG bee085c0a6cb32c59f0b55c7bba976fe6dcfca7f) |
|
|
|
|
|
|
|
FetchContent_MakeAvailableExcludeFromAll(mingw-std-threads) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_compile_definitions(libnatpmp_obj PRIVATE -D_WIN32_WINNT=0x601 -DSTATICLIB) |
|
|
|
|
|
|
|
target_compile_definitions(zto_obj PRIVATE -D_WIN32_WINNT=0x601 -DZT_SALSA20_SSE=0) |
|
|
|
|
|
|
|
target_compile_definitions(libzt_obj PRIVATE -D_WIN32_WINNT=0x601) |
|
|
|
|
|
|
|
target_link_libraries(libzt_obj PRIVATE mingw_stdthreads) |
|
|
|
|
|
|
|
target_link_libraries(${libzt_LIB_NAME} PUBLIC iphlpapi shlwapi wsock32 ws2_32 wininet mingw_stdthreads) |
|
|
|
|
|
|
|
target_include_directories(${libzt_LIB_NAME} INTERFACE "${libzt_SOURCE_DIR}/include/mingw-fixes") |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
if(MSVC) |
|
|
|
if(MSVC) |
|
|
|
target_compile_definitions(libnatpmp_obj PRIVATE -DSTATICLIB) |
|
|
|
target_compile_definitions(libnatpmp_obj PRIVATE -DSTATICLIB) |
|
|
|
target_link_libraries(${libzt_LIB_NAME} PUBLIC iphlpapi shlwapi wsock32 ws2_32 wininet) |
|
|
|
|
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|