mirror of https://github.com/ntop/n2n.git
Browse Source
* Add new file 'network_traffic_filter.c/.h" * Add feature to drop or accept specific packet transmit over edge network interface by rules. * fix CMakeLists.txt typo * Update Rule String Format * replace -F (filter) with -R (rule) for traffic restrictions. * Update edge help (-h) message. Update documents. * Pass Build on CircleCI and local Windows 10 VS2019 * Fix cmake build failed because of sn_selection * fix operate void* cause vs2016 build failed * Fix typo to pass build on windows. * add inttypes.h for n2n_typedefs.h to pass windows build * modify headers to pass build on windows.pull/507/head
joshuafc
4 years ago
committed by
GitHub
11 changed files with 326 additions and 259 deletions
@ -0,0 +1,45 @@ |
|||||
|
# Build project. |
||||
|
# |
||||
|
# The script assumes that it will be called from inside the project directory. |
||||
|
# |
||||
|
# Usage: .ci\build-project.ps1 [vcpkg-directory [build-directory-name]] |
||||
|
# - vcpkg-directory: Optional full path to Vcpkg directory. Default: $HOME\vcpkg |
||||
|
# - build-directory-name: Optional name of build directory. Default: build. |
||||
|
# Can only be set of vcpkg-directory is set as well. |
||||
|
# |
||||
|
# Example 1: .ci\build-project.ps1 |
||||
|
# Example 2: .ci\build-project.ps1 $HOME\vcpkg-clang |
||||
|
# Example 3: .ci\build-project.ps1 $HOME\vcpkg-clang build-clang |
||||
|
|
||||
|
$ErrorActionPreference="Stop" |
||||
|
|
||||
|
$VCPKG_DIR=$args[0] |
||||
|
$BUILD_DIR=$args[1] |
||||
|
|
||||
|
if ($null -eq $VCPKG_DIR) { $VCPKG_DIR="$HOME\vcpkg" } |
||||
|
if ($null -eq $BUILD_DIR) { $BUILD_DIR="build" } |
||||
|
|
||||
|
# only pass toolchain file to CMake if Vcpkg is installed |
||||
|
if (Test-Path "$VCPKG_DIR" -PathType Container) { |
||||
|
$TOOLCHAIN="$VCPKG_DIR\scripts\buildsystems\vcpkg.cmake" |
||||
|
} else { |
||||
|
$TOOLCHAIN="False" |
||||
|
} |
||||
|
|
||||
|
Write-Host "---- build-project.ps1 ----" |
||||
|
Write-Host "VCPKG_DIR: $VCPKG_DIR" |
||||
|
Write-Host "BUILD_DIR: $BUILD_DIR" |
||||
|
Write-Host "CMAKE_TOOLCHAIN_FILE: $TOOLCHAIN" |
||||
|
Write-Host "---------------------------" |
||||
|
|
||||
|
if (-not (Get-Command cmake -ErrorAction SilentlyContinue)) { |
||||
|
New-Alias -Name cmake -Value "$Env:ProgramFiles\CMake\bin\cmake.exe" |
||||
|
} |
||||
|
|
||||
|
New-Item -Name $BUILD_DIR -ItemType Directory |
||||
|
Push-Location $BUILD_DIR |
||||
|
$ErrorActionPreference = "Stop"; |
||||
|
cmake -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" .. |
||||
|
cmake --build . --config Release |
||||
|
if ($LASTEXITCODE) { Throw "BUILD FAILED!" } |
||||
|
Pop-Location |
@ -0,0 +1,38 @@ |
|||||
|
|
||||
|
# Build Vcpkg and install dependency packages. |
||||
|
# |
||||
|
# Usage: .ci\install-vcpkg.ps1 <project directory> [vcpkg directory name] |
||||
|
# - project directory: Path to the project sources where the .vcpkg file is located. |
||||
|
# - vcpkg directory name: optional name of directory where Vcpkg will be clone'd into |
||||
|
# |
||||
|
# Example 1: .ci\install-vcpkg.ps1 $Env:GITHUB_WORKSPACE |
||||
|
# Example 2: .ci\install-vcpkg.ps1 $Env:APPVEYOR_BUILD_FOLDER vcpkg-msvc |
||||
|
|
||||
|
$ErrorActionPreference="Stop" |
||||
|
|
||||
|
if ($args.Count -lt 1) { Exit 1 } |
||||
|
|
||||
|
$PROJECT_DIR=$args[0] |
||||
|
$VCPKG_DIR=$args[1] |
||||
|
|
||||
|
if ($null -eq $VCPKG_DIR) { $VCPKG_DIR="vcpkg" } |
||||
|
|
||||
|
# do nothing if .vcpkg file doesn't exist |
||||
|
if (-not (Test-Path "$PROJECT_DIR\.vcpkg" -PathType Leaf)) { Write-Host ".vcpkg file does not exist, skipping Vcpkg installation."; Exit 0 } |
||||
|
|
||||
|
Write-Host "---- install-vcpkg.ps1 ----" |
||||
|
Write-Host "PROJECT_DIR: $PROJECT_DIR" |
||||
|
Write-Host "VCPKG_DIR: $VCPKG_DIR" |
||||
|
Write-Host "---------------------------" |
||||
|
|
||||
|
if (-not (Get-Command git -ErrorAction SilentlyContinue)) { |
||||
|
New-Alias -Name git -Value "$Env:ProgramFiles\Git\bin\git.exe" |
||||
|
} |
||||
|
|
||||
|
Push-Location "$HOME" |
||||
|
git clone --quiet --depth 1 https://github.com/Microsoft/vcpkg.git $VCPKG_DIR |
||||
|
Set-Location $VCPKG_DIR |
||||
|
.\bootstrap-vcpkg.bat -disableMetrics |
||||
|
$packages = Get-Content "$PROJECT_DIR\.vcpkg" |
||||
|
.\vcpkg.exe install --triplet x64-windows $packages |
||||
|
Pop-Location |
@ -0,0 +1,39 @@ |
|||||
|
version: 2.1 |
||||
|
|
||||
|
orbs: |
||||
|
win: circleci/windows@2.4.0 |
||||
|
|
||||
|
jobs: |
||||
|
linux-gcc: |
||||
|
machine: |
||||
|
image: ubuntu-1604:201903-01 |
||||
|
steps: |
||||
|
- checkout |
||||
|
- run: |
||||
|
name: Install Software |
||||
|
command: | |
||||
|
sudo apt-get update |
||||
|
sudo apt-get install -y cmake build-essential |
||||
|
mkdir build |
||||
|
cd build |
||||
|
cmake .. |
||||
|
make |
||||
|
windows-msvc: |
||||
|
executor: win/default |
||||
|
steps: |
||||
|
- checkout |
||||
|
- run: |
||||
|
name: Download CMake |
||||
|
command: | |
||||
|
$ProgressPreference = "SilentlyContinue" |
||||
|
Invoke-WebRequest -URI https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-win64-x64.zip -OutFile $Env:HOMEPATH\cmake-3.16.4-win64-x64.zip |
||||
|
Expand-Archive $Env:HOMEPATH\cmake-3.16.4-win64-x64.zip -DestinationPath "$Env:ProgramFiles" |
||||
|
Rename-Item "$Env:ProgramFiles\cmake-3.16.4-win64-x64" -NewName CMake |
||||
|
- run: .ci\install-vcpkg.ps1 "$Env:CIRCLE_WORKING_DIRECTORY" |
||||
|
- run: .ci\build-project.ps1 |
||||
|
workflows: |
||||
|
version: 2 |
||||
|
run-all: |
||||
|
jobs: |
||||
|
- linux-gcc |
||||
|
- windows-msvc |
Loading…
Reference in new issue