-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c330b67
commit fd32507
Showing
17 changed files
with
142 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(BASE_SOURCES | ||
debug.c | ||
llog.c | ||
) | ||
add_library(base STATIC ${BASE_SOURCES}) | ||
target_include_directories(base PUBLIC include) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
message(STATUS "Installing libuv via submodule") | ||
execute_process(COMMAND git submodule update --init -- external/libuv | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
add_subdirectory(external/libuv) | ||
target_include_directories(uv_a INTERFACE external/libuv/include) | ||
|
||
message(STATUS "Installing uvw via submodule") | ||
execute_process(COMMAND git submodule update --init -- external/uvw | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
add_subdirectory(external/uvw) | ||
include_directories(external/uvw/src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
execute_process(COMMAND git describe --tags | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE LANPLAY_VERSION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
if (LANPLAY_VERSION STREQUAL "") | ||
set(LANPLAY_VERSION v0.0.7) | ||
MESSAGE("git describe --tags output is empty, set version to ${LANPLAY_VERSION}") | ||
endif() | ||
|
||
set(src | ||
main.c | ||
packet.c | ||
arp.c | ||
helper.c | ||
lan-client.c | ||
gateway.cpp | ||
proxy_direct.cpp | ||
proxy_socks5.cpp | ||
ipv4/ipv4.c | ||
ipv4/tcp.c | ||
ipv4/udp.c | ||
ipv4/icmp.c | ||
) | ||
|
||
add_executable(lan-play ${src}) | ||
|
||
target_compile_options( | ||
lan-play | ||
PRIVATE "-Wall" | ||
PRIVATE "-Wno-unused-function" | ||
PRIVATE "-DLANPLAY_VERSION=\"${LANPLAY_VERSION}\"" | ||
) | ||
|
||
set_target_properties(lan-play PROPERTIES CXX_STANDARD 14) | ||
|
||
target_link_libraries(lan-play base) | ||
target_link_libraries(lan-play uv_lwip) | ||
target_link_libraries(lan-play uv_a) | ||
|
||
find_package(PCAP REQUIRED) | ||
target_link_libraries(lan-play ${PCAP_LIBRARY}) | ||
target_include_directories(lan-play PRIVATE ${PCAP_INCLUDE_DIR}) | ||
|
||
if (WIN32) | ||
add_dependencies(lan-play winpcap) | ||
target_link_libraries(lan-play ws2_32.lib iphlpapi.lib psapi userenv.lib) | ||
# https://stackoverflow.com/questions/13768515/how-to-do-static-linking-of-libwinpthread-1-dll-in-mingw | ||
target_link_libraries(lan-play -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic) | ||
else() | ||
target_link_libraries(lan-play pthread) | ||
endif() | ||
|
||
INSTALL(TARGETS lan-play RUNTIME DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
add_library(uv_lwip STATIC uv_lwip.c) | ||
target_link_libraries(uv_lwip base lwip_lib) | ||
target_include_directories(lwip_lib PUBLIC .) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.