Skip to content

Commit

Permalink
Update CMakeLists.txt for macOS; Clean up workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
UjuiUjuMandan committed Nov 22, 2023
1 parent bade2ab commit a1ad80d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 41 deletions.
55 changes: 17 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,24 @@ on:
branches: [ '*' ]

jobs:
build-macos:
runs-on: macos-latest
job:
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest]

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup CMake and dependencies on macOS
if: ${{ runner.os == 'macOS' }}
run: |
brew install cmake libevent libpcap libsodium openssl
- name: Compile and configure Pcap_DNSProxy
run: |
cd Source/Auxiliary/Scripts
chmod +x CMake_Build.sh
# Workaround from https://stackoverflow.com/a/30895165
export C_INCLUDE_PATH=/usr/local/include
export CPLUS_INCLUDE_PATH=/usr/local/include
# Fuck Xcode
./CMake_Build.sh
- name: Create artifacts
uses: actions/upload-artifact@v3
with:
name: Pcap_DNSProxy-bin-macOS
path: Source/Release/

build-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup CMake, GCC, and dependencies
- name: Setup CMake, GCC, and dependencies on Ubuntu
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ cmake libevent-dev libpcap-dev libsodium-dev libssl-dev
Expand All @@ -53,7 +38,7 @@ jobs:
- name: Create artifacts
uses: actions/upload-artifact@v3
with:
name: Pcap_DNSProxy-bin-Ubuntu
name: Pcap_DNSProxy-bin-${{ runner.os }}
path: Source/Release/

build-windows:
Expand Down Expand Up @@ -81,7 +66,7 @@ jobs:
!${{ env.VCPKG_ROOT }}\downloads
Source/Tools
key: |
${{ runner.os }}-ncpkg-dependencies-${{ hashFiles('.github/workflows/build.yml') }}
${{ hashFiles( 'vcpkg.bat' ) }}-${{ runner.os }}-cache-key-v1
- name: Install vcpkg
if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }}
Expand All @@ -90,21 +75,15 @@ jobs:
cd vcpkg
.\bootstrap-vcpkg.bat
- name: Intergrate vcpkg with MSBuild
run: |
cd vcpkg
.\vcpkg integrate install
- name: Install dependencies with vcpkg
if: ${{ steps.vcpkg-cache.outputs.cache-hit != 'true' }}
run: |
.\vcpkg.bat
- name: Intergrate vcpkg with MSBuild
run: |
cd vcpkg
.\vcpkg install libevent libpcap libsodium openssl
.\vcpkg remove libpcap
.\vcpkg install winpcap
.\vcpkg install libevent:x86-windows libpcap:x86-windows libsodium:x86-windows openssl:x86-windows
.\vcpkg remove libpcap:x86-windows
.\vcpkg install winpcap:x86-windows
.\vcpkg integrate install
- name: Locate dependencies
run: |
Expand Down
6 changes: 3 additions & 3 deletions Source/Pcap_DNSProxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ ENDIF(STATIC_LIB)
find_package(Threads REQUIRED)
target_link_libraries(Pcap_DNSProxy ${CMAKE_THREAD_LIBS_INIT})
find_library(LIBEVENT_LIBRARIES event_core)
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
include_directories("/usr/local/include")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
include_directories("/usr/local/include")
ENDIF()
target_link_libraries(Pcap_DNSProxy ${LIBEVENT_LIBRARIES})
## Libraries needed
IF(ENABLE_LIBSODIUM)
Expand Down
7 changes: 7 additions & 0 deletions vcpkg.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cd vcpkg
.\vcpkg install libevent libpcap libsodium openssl
.\vcpkg remove libpcap
.\vcpkg install winpcap
.\vcpkg install libevent:x86-windows libpcap:x86-windows libsodium:x86-windows openssl:x86-windows
.\vcpkg remove libpcap:x86-windows
.\vcpkg install winpcap:x86-windows

0 comments on commit a1ad80d

Please sign in to comment.