-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
8 changed files
with
349 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Vcpkg build | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.cfg.os }} | ||
runs-on: ${{ matrix.cfg.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
cfg: | ||
- { os: ubuntu-latest, triplet: x64-linux } | ||
- { os: windows-2022, triplet: x64-windows-static-vs2022 } | ||
- { os: macos-latest, triplet: x64-osx } | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install linux dependencies | ||
if: ${{ matrix.cfg.os == 'ubuntu-latest' }} | ||
run: sudo apt-get install nasm openssl ninja-build | ||
- name: Install osx dependencies | ||
if: ${{ matrix.cfg.os == 'macos-latest' }} | ||
run: brew install nasm ninja | ||
- name: Cache vcpkg binary | ||
id: cache-vcpkg-bin | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
deps/vcpkg/vcpkg | ||
deps/vcpkg/vcpkg.exe | ||
key: ${{ runner.os }}-${{ hashFiles('deps/vcpkg/bootstrap.cmake') }} | ||
- name: Cache vcpkg packages | ||
id: cache-vcpkg | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/vcpkg | ||
~/AppData/Local/vcpkg/archives | ||
key: ${{ runner.os }}-${{ matrix.cfg.triplet }}-${{ hashFiles('vcpkg.json', '.git/modules/deps/vcpkg/shallow') }} | ||
- name: Bootstrap the ports | ||
run: python bootstrap.py --triplet ${{ matrix.cfg.triplet }} --clean-after-build | ||
- name: Build the code | ||
run: python build.py --triplet ${{ matrix.cfg.triplet }} --no-avx2 --python-path '${{ steps.setup-python.outputs.python-path }}' --run-tests |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.clangd | ||
compile_commands.json | ||
.DS_Store | ||
vcpkg_installed | ||
build |
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 @@ | ||
[submodule "deps/vcpkg"] | ||
path = deps/vcpkg | ||
url = https://github.com/VITObelgium/vcpkg-ports.git |
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,70 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import sys | ||
import sysconfig | ||
import argparse | ||
|
||
from deps.vcpkg.scripts.buildtools import vcpkg | ||
|
||
if __name__ == "__main__": | ||
try: | ||
parser = argparse.ArgumentParser( | ||
description="Bootstrap infra.", parents=[vcpkg.bootstrap_argparser()] | ||
) | ||
|
||
parser.add_argument( | ||
"--cpp20", | ||
dest="cpp20_enabled", | ||
action="store_true", | ||
help="build with C++20 support", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
platform = sysconfig.get_platform() | ||
triplet = args.triplet | ||
if platform == "win-amd64": | ||
triplet = "x64-windows-static-vs2022" | ||
elif platform == "mingw": | ||
triplet = "x64-mingw" | ||
elif not triplet: | ||
triplet = vcpkg.prompt_for_triplet() | ||
|
||
extras = [] | ||
features = [ | ||
"log", | ||
"cliprogress", | ||
"process", | ||
"hashing", | ||
"xml", | ||
"numeric", | ||
"charset", | ||
"compression", | ||
"gdal", | ||
"db", | ||
"testing", | ||
] | ||
|
||
if not args.cpp20_enabled: | ||
features.append("cpp17") | ||
|
||
build_root = None | ||
packages_root = None | ||
|
||
if args.clean: | ||
vcpkg.clean(triplet=triplet) | ||
else: | ||
vcpkg.bootstrap( | ||
ports_dir=os.path.join(".", "deps"), | ||
triplet=triplet, | ||
additional_ports=extras, | ||
build_root=build_root, | ||
packages_root=packages_root, | ||
additional_features=features, | ||
) | ||
except KeyboardInterrupt: | ||
print("\nInterrupted") | ||
sys.exit(-1) | ||
except RuntimeError as e: | ||
print(e) | ||
sys.exit(-1) |
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,100 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import sys | ||
import sysconfig | ||
import platform | ||
import argparse | ||
|
||
from deps.vcpkg.scripts.buildtools import vcpkg | ||
|
||
if __name__ == "__main__": | ||
try: | ||
parser = argparse.ArgumentParser( | ||
description="Build infra.", parents=[vcpkg.build_argparser()] | ||
) | ||
parser.add_argument( | ||
"--ui", dest="ui_enabled", action="store_true", help="build the ui" | ||
) | ||
|
||
parser.add_argument( | ||
"--cpp20", | ||
dest="cpp20_enabled", | ||
action="store_true", | ||
help="build with C++20 support", | ||
) | ||
|
||
parser.add_argument( | ||
"--ci", | ||
dest="ci_build", | ||
action="store_true", | ||
help="continuous integration build", | ||
) | ||
|
||
parser.add_argument( | ||
"--build-config", | ||
dest="build_config", | ||
help="Build configuration (Debug or Release)", | ||
default="Release", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
build_ui = "ON" if args.ui_enabled else "OFF" | ||
cxx_standard = "17" if (args.cpp20_enabled) else "17" | ||
sys_platform = sysconfig.get_platform() | ||
|
||
triplet = args.triplet | ||
if sys_platform == "win-amd64": | ||
triplet = "x64-windows-static-vs2022" | ||
elif sys_platform == "mingw": | ||
triplet = "x64-mingw" | ||
elif not triplet: | ||
triplet = vcpkg.prompt_for_triplet() | ||
|
||
cmake_args = [ | ||
f"-DCMAKE_CXX_STANDARD={cxx_standard}", | ||
f"-DINFRA_UI_COMPONENTS={build_ui}", | ||
"-DINFRA_LOGGING=ON", | ||
"-DINFRA_GDAL=ON", | ||
"-DINFRA_XML=ON", | ||
"-DINFRA_TBB=ON", | ||
"-DINFRA_NUMERIC=OFF", | ||
"-DINFRA_CHARSET=ON", | ||
"-DINFRA_PROCESS=ON", | ||
"-DINFRA_DATABASE=ON", | ||
"-DINFRA_DATABASE_SQLITE=ON", | ||
"-DINFRA_DATABASE_POSTGRES=ON", | ||
"-DINFRA_DATABASE_HASHING=ON", | ||
"-DINFRA_COMPRESSION=ON", | ||
"-DINFRA_COMPRESSION_ZSTD=ON", | ||
"-DINFRA_ENABLE_TESTS=ON", | ||
"-DINFRA_CLI_PROGRESS=ON", | ||
] | ||
|
||
if build_ui and triplet.startswith("x64-osx"): | ||
cmake_args.extend( | ||
[ | ||
"-DCMAKE_PREFIX_PATH=/usr/local/opt/qt6", | ||
"-DVCPKG_ALLOW_SYSTEM_LIBS=ON", | ||
] | ||
) | ||
|
||
targets = [] | ||
build_dir = "infra" | ||
|
||
vcpkg.build_project( | ||
os.path.abspath(args.source_dir), | ||
triplet=triplet, | ||
cmake_args=cmake_args, | ||
targets=targets, | ||
build_name=build_dir, | ||
run_tests_after_build=args.run_tests, | ||
test_arguments=args.test_args, | ||
build_config=args.build_config, | ||
) | ||
except KeyboardInterrupt: | ||
print("\nInterrupted") | ||
sys.exit(-1) | ||
except RuntimeError as e: | ||
print(e) | ||
sys.exit(-1) |
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,107 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", | ||
"name": "infra", | ||
"version": "0.11.2", | ||
"dependencies": [ | ||
"fmt" | ||
], | ||
"features": { | ||
"log": { | ||
"description": "logging support", | ||
"dependencies": [ | ||
"spdlog" | ||
] | ||
}, | ||
"testing": { | ||
"description": "unit test support", | ||
"dependencies": [ | ||
"doctest", | ||
"trompeloeil" | ||
] | ||
}, | ||
"cliprogress": { | ||
"description": "progress support", | ||
"dependencies": [ | ||
"indicators" | ||
] | ||
}, | ||
"process": { | ||
"description": "process support", | ||
"dependencies": [ | ||
"reproc" | ||
] | ||
}, | ||
"hashing": { | ||
"description": "hashing support", | ||
"dependencies": [ | ||
"cryptopp" | ||
] | ||
}, | ||
"xml": { | ||
"description": "xml support", | ||
"dependencies": [ | ||
"pugixml" | ||
] | ||
}, | ||
"tbb": { | ||
"description": "threading building blocks support", | ||
"dependencies": [ | ||
"tbb" | ||
] | ||
}, | ||
"numeric": { | ||
"description": "numeric support", | ||
"dependencies": [ | ||
"eigen3" | ||
] | ||
}, | ||
"charset": { | ||
"description": "charset conversion/detection support", | ||
"dependencies": [ | ||
"icu" | ||
] | ||
}, | ||
"compression": { | ||
"description": "compression support", | ||
"dependencies": [ | ||
"zstd" | ||
] | ||
}, | ||
"gdal": { | ||
"description": "gdal support", | ||
"dependencies": [ | ||
{ | ||
"name": "gdal", | ||
"features": [ | ||
"geos" | ||
] | ||
} | ||
] | ||
}, | ||
"db": { | ||
"description": "database support", | ||
"dependencies": [ | ||
{ | ||
"name": "sqlpp11", | ||
"features": [ | ||
"sqlite", | ||
"postgresql" | ||
] | ||
} | ||
] | ||
}, | ||
"cpp17": { | ||
"description": "C++17 build", | ||
"dependencies": [ | ||
"date", | ||
"gsl" | ||
] | ||
}, | ||
"ui": { | ||
"description": "ui support", | ||
"dependencies": [ | ||
"qt6" | ||
] | ||
} | ||
} | ||
} |