Skip to content

Commit

Permalink
testing ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vaguue committed Aug 19, 2024
1 parent 8af027b commit 3868340
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ jobs:
# # for this ridiculous `&` syntax alone, I'd rather use COBOL than Powershell
# # see https://stackoverflow.com/a/1674950/5637701
# & "$env:TEMP/npcap-oem.exe" /S
- name: Install npcap on Windows (step 2)
if: matrix.os == 'windows-latest'
run: |
set NPCAP_FILE=npcap-0.96.exe
curl -L https://npcap.com/dist/%NPCAP_FILE% --output %NPCAP_FILE%
%NPCAP_FILE% /S /winpcap_mode
xcopy C:\Windows\System32\Npcap\*.dll C:\Windows\System32
xcopy C:\Windows\SysWOW64\Npcap\*.dll C:\Windows\SysWOW64
shell: cmd
- name: Submodule update
run: git submodule update --init --recursive
shell: bash
Expand Down
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ execute_process(COMMAND node -p "require('node-addon-api').include"
OUTPUT_VARIABLE NODE_ADDON_API_DIR
)

execute_process(COMMAND node -p "require('os').arch()"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _CURRENT_ARCH
)

string(REGEX REPLACE "[\r\n\"]" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
string(REGEX REPLACE "[\r\n\"]" "" _CURRENT_ARCH ${_CURRENT_ARCH})

Message("NODE_ADDON_API_DIR: " ${NODE_ADDON_API_DIR})
Message("_CURRENT_ARCH: " ${_CURRENT_ARCH})

include_directories(${CMAKE_JS_INC})

Expand All @@ -35,7 +42,23 @@ endif()

if(PCAP_ROOT)
target_include_directories(${PROJECT_NAME} PRIVATE "${PCAP_ROOT}/Include")
target_link_libraries(${PROJECT_NAME} PUBLIC "${PCAP_ROOT}/Lib/Packet.lib" "${PCAP_ROOT}/Lib/wpcap.lib")

set(PACKET_LIB "${PCAP_ROOT}/Lib/${_CURRENT_ARCH}/Packet.lib")
set(WPCAP_LIB "${PCAP_ROOT}/Lib/${_CURRENT_ARCH}/wpcap.lib")

file(TO_NATIVE_PATH "${PACKET_LIB}" PACKET_LIB)
file(TO_NATIVE_PATH "${WPCAP_LIB}" WPCAP_LIB)

message("PACKET_LIB: " ${PACKET_LIB})
message("WPCAP_LIB: " ${WPCAP_LIB})

if(EXISTS ${PACKET_LIB} AND EXISTS ${WPCAP_LIB})
message("LINKING WITH: ${PACKET_LIB} ${WPCAP_LIB}")
#target_link_libraries(${PROJECT_NAME} PUBLIC "${PACKET_LIB}" "${WPCAP_LIB}")
else()
message(FATAL_ERROR "Required libraries not found. Ensure that PCAP_ROOT is set correctly.")
endif()

endif()

# PcapPlusPlus
Expand Down

0 comments on commit 3868340

Please sign in to comment.