|
|
|
|
@ -76,15 +76,22 @@ endif ()
|
|
|
|
|
|
|
|
|
|
# WINDOWS-specific MSVC flags and libraries |
|
|
|
|
if (WIN32) |
|
|
|
|
# get literal paths for Windows libraries |
|
|
|
|
set (WIN_LIB_HINT_PATH "C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.16299.0\\um\\x86") |
|
|
|
|
message (STATUS ${WIN_LIB_HINT_PATH}) |
|
|
|
|
find_library (ws2_32_LIBRARY_PATH NAMES WS2_32 HINTS ${WIN_LIB_HINT_PATH}) |
|
|
|
|
find_library (lshlwapi_LIBRARY_PATH NAMES ShLwApi HINTS ${WIN_LIB_HINT_PATH}) |
|
|
|
|
set (liphlpapi_LIBRARY_PATH "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/um/x86/iphlpapi.Lib") |
|
|
|
|
message (STATUS ${ws2_32_LIBRARY_PATH}) |
|
|
|
|
message (STATUS ${lshlwapi_LIBRARY_PATH}) |
|
|
|
|
message (STATUS ${liphlpapi_LIBRARY_PATH}) |
|
|
|
|
# 32-bit |
|
|
|
|
if(NOT "${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)") |
|
|
|
|
set (WINLIBDIR, "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/um/x86") |
|
|
|
|
endif () |
|
|
|
|
# 64-bit |
|
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)") |
|
|
|
|
set (WINLIBDIR, "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/um/x64") |
|
|
|
|
endif () |
|
|
|
|
message (STATUS ${WINLIBDIR}) |
|
|
|
|
find_library (ws2_32_LIBRARY_PATH NAMES WS2_32 HINTS ${WINLIBDIR}) |
|
|
|
|
find_library (shlwapi_LIBRARY_PATH NAMES ShLwApi HINTS ${WINLIBDIR}) |
|
|
|
|
#find_library (iphlpapi_LIBRARY_PATH NAMES iphlpapi HINTS ${WINLIBDIR}) |
|
|
|
|
set (iphlpapi_LIBRARY_PATH "${WINLIBDIR}/iphlpapi.Lib") |
|
|
|
|
message (STATUS "WS2_32=${ws2_32_LIBRARY_PATH}") |
|
|
|
|
message (STATUS "ShLwApi=${shlwapi_LIBRARY_PATH}") |
|
|
|
|
message (STATUS "liphlpapi=${iphlpapi_LIBRARY_PATH}") |
|
|
|
|
add_definitions (-DZT_SDK=1) |
|
|
|
|
set (LWIP_PORT_DIR ${PROJ_DIR}/ext/lwip-contrib/ports/win32) |
|
|
|
|
endif () |
|
|
|
|
@ -130,11 +137,11 @@ endif ()
|
|
|
|
|
|
|
|
|
|
if (WIN32) |
|
|
|
|
target_link_libraries (zt-static ws2_32) |
|
|
|
|
target_link_libraries (zt-static ${lshlwapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zt-static ${liphlpapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zt-static ${shlwapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zt-static ${iphlpapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zt-shared ws2_32) |
|
|
|
|
target_link_libraries (zt-shared ${lshlwapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zt-shared ${liphlpapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zt-shared ${shlwapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zt-shared ${iphlpapi_LIBRARY_PATH}) |
|
|
|
|
endif () |
|
|
|
|
|
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
|
|
@ -175,8 +182,8 @@ file (GLOB zto_src_glob
|
|
|
|
|
add_library (zto_obj OBJECT ${zto_src_glob}) |
|
|
|
|
if (WIN32) |
|
|
|
|
target_link_libraries (zto_obj ws2_32) |
|
|
|
|
target_link_libraries (zto_obj ${lshlwapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zto_obj ${liphlpapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zto_obj ${shlwapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (zto_obj ${iphlpapi_LIBRARY_PATH}) |
|
|
|
|
endif () |
|
|
|
|
add_library (zto_pic ${zto_src_glob}) |
|
|
|
|
set_target_properties (zto_pic PROPERTIES POSITION_INDEPENDENT_CODE ON) |
|
|
|
|
@ -213,7 +220,7 @@ if (NOT WIN32) # only necessary for raw driver development
|
|
|
|
|
add_executable (selftest ${PROJ_DIR}/test/selftest.cpp) |
|
|
|
|
target_compile_options (selftest PRIVATE -D__SELFTEST__) |
|
|
|
|
if (WIN32) |
|
|
|
|
target_link_libraries (selftest zt-static ${ws2_32_LIBRARY_PATH} ${lshlwapi_LIBRARY_PATH} ${liphlpapi_LIBRARY_PATH}) |
|
|
|
|
target_link_libraries (selftest zt-static ${ws2_32_LIBRARY_PATH} ${shlwapi_LIBRARY_PATH} ${iphlpapi_LIBRARY_PATH}) |
|
|
|
|
else () |
|
|
|
|
target_link_libraries (selftest zt-static pthread) |
|
|
|
|
endif () |
|
|
|
|
|