Added patch for lwip-contrib for Windows compatibility
This commit is contained in:
@@ -61,7 +61,7 @@ else()
|
||||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fstack-protector")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBZT_FLAGS} ${SILENCE} -O3 -Wall -Wextra -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${LIBZT_FLAGS_DEBUG} ${SILENCE} -std=c++11 -DLWIP_DEBUG=1")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${LIBZT_FLAGS_DEBUG} ${SILENCE} -std=c++11")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${LIBZT_FLAGS} ${SILENCE} -O3 -std=c++11")
|
||||
set (LWIP_PORT_DIR ${PROJ_DIR}/ext/lwip-contrib/ports/unix/port)
|
||||
endif ()
|
||||
@@ -81,12 +81,10 @@ if(WIN32)
|
||||
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})
|
||||
#find_library(liphlpapi_LIBRARY_PATH NAMES iphlpapi.lib 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})
|
||||
add_definitions(-DSDK=1)
|
||||
add_definitions (-DZT_SDK=1)
|
||||
set (LWIP_PORT_DIR ${PROJ_DIR}/ext/lwip-contrib/ports/win32)
|
||||
endif ()
|
||||
@@ -115,30 +113,35 @@ set(LIBZT_SRC_DIR ${PROJ_DIR}/src)
|
||||
include_directories ("${LIBZT_SRC_DIR}")
|
||||
include_directories ("${PROJ_DIR}/include")
|
||||
file (GLOB libzt_src_glob ${LIBZT_SRC_DIR}/*.cpp)
|
||||
add_library (zt STATIC
|
||||
add_library (zt-static STATIC
|
||||
$<TARGET_OBJECTS:lwip_obj>
|
||||
$<TARGET_OBJECTS:zto_obj>
|
||||
$<TARGET_OBJECTS:http_obj> ${libzt_src_glob})
|
||||
if(WIN32)
|
||||
target_link_libraries (zt ws2_32)
|
||||
target_link_libraries (zt ${lshlwapi_LIBRARY_PATH})
|
||||
target_link_libraries (zt ${liphlpapi_LIBRARY_PATH})
|
||||
else()
|
||||
target_link_libraries (zt pthread)
|
||||
endif()
|
||||
set_target_properties (zt PROPERTIES OUTPUT_NAME zt)
|
||||
set_target_properties (zt-static PROPERTIES OUTPUT_NAME zt-static)
|
||||
|
||||
# libzt (shared)
|
||||
add_library (ztshared SHARED
|
||||
add_library (zt-shared SHARED
|
||||
$<TARGET_OBJECTS:lwip_pic_obj>
|
||||
$<TARGET_OBJECTS:zto_pic_obj>
|
||||
$<TARGET_OBJECTS:http_pic_obj> ${libzt_src_glob})
|
||||
set_target_properties (ztshared PROPERTIES OUTPUT_NAME zt)
|
||||
set_target_properties (zt-shared PROPERTIES OUTPUT_NAME zt-shared)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Android")
|
||||
target_link_libraries (zt lwip zto android log)
|
||||
target_link_libraries (zt-shared lwip zto android log)
|
||||
else ()
|
||||
target_link_libraries (zt pthread)
|
||||
#target_link_libraries (zt-shared pthread)
|
||||
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-shared ws2_32)
|
||||
target_link_libraries (zt-shared ${lshlwapi_LIBRARY_PATH})
|
||||
target_link_libraries (zt-shared ${liphlpapi_LIBRARY_PATH})
|
||||
else ()
|
||||
target_link_libraries (zt-static pthread)
|
||||
target_link_libraries (zt-shared pthread)
|
||||
endif ()
|
||||
|
||||
# --- OBJECT LIBRARIES (INTERMEDIATE)
|
||||
@@ -173,9 +176,9 @@ file (GLOB zto_src_glob
|
||||
${ZTO_SRC_DIR}/osdep/ManagedRoute.cpp)
|
||||
add_library (zto_obj OBJECT ${zto_src_glob})
|
||||
if (WIN32)
|
||||
target_link_libraries (zto ws2_32)
|
||||
target_link_libraries (zto ${lshlwapi_LIBRARY_PATH})
|
||||
target_link_libraries (zto ${liphlpapi_LIBRARY_PATH})
|
||||
target_link_libraries (zto_obj ws2_32)
|
||||
target_link_libraries (zto_obj ${lshlwapi_LIBRARY_PATH})
|
||||
target_link_libraries (zto_obj ${liphlpapi_LIBRARY_PATH})
|
||||
endif ()
|
||||
add_library (zto_pic_obj OBJECT ${zto_src_glob})
|
||||
set_target_properties (zto_pic_obj PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
@@ -201,20 +204,20 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
|
||||
get_filename_component (testname ${testname} NAME)
|
||||
add_executable (${testname} ${testsourcefile})
|
||||
if (WIN32)
|
||||
target_link_libraries (${testname} zt)
|
||||
target_link_libraries (${testname} zt-static)
|
||||
else ()
|
||||
target_link_libraries (${testname} zt pthread dl)
|
||||
target_link_libraries (${testname} zt-static pthread dl)
|
||||
endif ()
|
||||
endforeach (testsourcefile ${APP_SOURCES})
|
||||
|
||||
if(NOT WIN32)
|
||||
if (NOT WIN32) # only necessary for raw driver development
|
||||
# selftest
|
||||
add_executable (selftest ${PROJ_DIR}/test/selftest.cpp)
|
||||
target_compile_options (selftest PRIVATE -D__SELFTEST__)
|
||||
if (WIN32)
|
||||
target_link_libraries (selftest zt ${ws2_32_LIBRARY_PATH} ${lshlwapi_LIBRARY_PATH} ${liphlpapi_LIBRARY_PATH})
|
||||
target_link_libraries (selftest zt-static ${ws2_32_LIBRARY_PATH} ${lshlwapi_LIBRARY_PATH} ${liphlpapi_LIBRARY_PATH})
|
||||
else ()
|
||||
target_link_libraries (selftest zt pthread)
|
||||
target_link_libraries (selftest zt-static pthread)
|
||||
endif ()
|
||||
# nativetest
|
||||
add_executable (nativetest ${PROJ_DIR}/test/selftest.cpp)
|
||||
|
||||
15
ext/lwip-contrib.patch
Normal file
15
ext/lwip-contrib.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
diff --git a/ports/win32/include/arch/cc.h b/ports/win32/include/arch/cc.h
|
||||
index 334be07..9384b70 100644
|
||||
--- a/ports/win32/include/arch/cc.h
|
||||
+++ b/ports/win32/include/arch/cc.h
|
||||
@@ -78,8 +78,8 @@ typedef int sys_prot_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* C runtime functions redefined */
|
||||
-#define snprintf _snprintf
|
||||
-#define strdup _strdup
|
||||
+//#define snprintf _snprintf
|
||||
+//#define strdup _strdup
|
||||
#endif
|
||||
|
||||
#define PPP_INCLUDE_SETTINGS_HEADER
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Execute from project root directory
|
||||
|
||||
cd ext/lwip
|
||||
cp ../lwip.patch .
|
||||
git apply lwip.patch
|
||||
cd -
|
||||
cd ../..
|
||||
|
||||
cd ext/lwip-contrib
|
||||
cp ../lwip-contrib.patch .
|
||||
git apply lwip-contrib.patch
|
||||
|
||||
cd ../..
|
||||
|
||||
Reference in New Issue
Block a user