commit 08e3618524c5ba25f2a6100a8bb40b71d3bf9f31
parent fa1b70ec5eba3db90abc34f7f0692438fdd4b247
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 26 Jun 2021 21:05:46 -0400
use a vcpkg manifest file for build dependencies
Diffstat:
6 files changed, 64 insertions(+), 43 deletions(-)
diff --git a/.appveyor.yml b/.appveyor.yml
@@ -5,7 +5,10 @@ before_build:
- git submodule update --init --depth 1
build_script:
- - cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN
+ - export VCPKG_OVERLAY_TRIPLETS=cmake/vcpkg-triplets
+ - cmake -B build -DCMAKE_BUILD_TYPE=Release
+ -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake
+ -DVCPKG_TARGET_TRIPLET=arch-env -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$TOOLCHAIN
-DCMAKE_OSX_ARCHITECTURES=$ARCH -DCMAKE_OSX_DEPLOYMENT_TARGET=$DEPLOY_TARGET
- cmake --build build
@@ -14,6 +17,8 @@ test_script:
for:
- matrix: { only: [ appveyor_build_worker_image: &linux Ubuntu1804 ] }
+ cache:
+ - build/vcpkg_installed -> vcpkg.json, cmake/vcpkg-triplets/arch-env.cmake
install: |-
set -e
@@ -41,28 +46,23 @@ for:
sudo update-alternatives --set gcc /usr/bin/gcc-7
- git clone --depth 1 --branch v2.13.8 -c advice.detachedHead=false \
- https://github.com/catchorg/Catch2.git
- cmake Catch2 -B Catch2/build -DBUILD_TESTING=OFF
- sudo cmake --build Catch2/build --target install > /dev/null
-
case $ARCH in
x86_64)
install-deps amd64
;;
i686)
install-deps i386 g++-multilib
- export TOOLCHAIN=cmake/linux-cross.cmake \
+ export TOOLCHAIN=$(pwd)/cmake/linux-cross.cmake \
TOOLCHAIN_PREFIX=i386-linux-gnu
;;
armv7l)
install-deps armhf g++-arm-linux-gnueabihf
- export TOOLCHAIN=cmake/linux-cross.cmake \
+ export TOOLCHAIN=$(pwd)/cmake/linux-cross.cmake \
TOOLCHAIN_PREFIX=arm-linux-gnueabihf
;;
aarch64)
install-deps arm64 g++-aarch64-linux-gnu
- export TOOLCHAIN=cmake/linux-cross.cmake \
+ export TOOLCHAIN=$(pwd)/cmake/linux-cross.cmake \
TOOLCHAIN_PREFIX=aarch64-linux-gnu
;;
esac
@@ -70,9 +70,9 @@ for:
- path: build/reaper_reapack*.so
- matrix: { only: [ appveyor_build_worker_image: macos, appveyor_build_worker_image: macos-mojave ] }
+ cache:
+ - build/vcpkg_installed -> vcpkg.json, cmake/vcpkg-triplets/arch-env.cmake
install:
- - brew install boost catch2 > /dev/null
-
- |-
case $ARCH in
arm64)
@@ -91,22 +91,23 @@ for:
# don't use LibXml2/SQLite3 from Mono
- sudo rm -r /Library/Frameworks/Mono.framework
+
+ # backport vcpkg bugfixes (TODO: remove after future image updates)
+ - git -C ~/vcpkg fetch
+ - git -C ~/vcpkg restore -s 38d6712d5644ede4ff597e889549f5d540dcf8ff ports/catch2
artifacts:
- path: build/reaper_reapack*.dylib
- matrix: { only: [ appveyor_build_worker_image: &windows Visual Studio 2022 ] }
cache:
- - C:\Tools\vcpkg\installed -> vendor\vcpkg-deps.txt
+ - build\vcpkg_installed -> vcpkg.json
install:
- - set VCPKG_ROOT=C:\Tools\vcpkg
- - set VCPKG_DEFAULT_TRIPLET=%ARCH%-windows-static
- - set /p reapack-deps=<vendor\vcpkg-deps.txt
- - vcpkg install %reapack-deps%
-
- if "%ARCH%" == "x64" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
- if "%ARCH%" == "x86" call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat"
build_script:
- cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DVCPKG_TARGET_TRIPLET=%ARCH%-windows-static
+ -DCMAKE_TOOLCHAIN_FILE=C:\Tools\vcpkg\scripts\buildsystems\vcpkg.cmake
- cmake --build build
artifacts:
- path: build\reaper_reapack*.dll
diff --git a/README.md b/README.md
@@ -10,7 +10,7 @@ the user guide or the package upload tool.
Clone the repository and submodules:
- git clone --recursive https://github.com/cfillion/reapack.git
+ git clone --recursive --shallow-submodules https://github.com/cfillion/reapack.git
### Prerequisites
@@ -50,18 +50,12 @@ architecture when configuring or building ReaPack.
Install [vcpkg](https://docs.microsoft.com/cpp/build/vcpkg) in any directory:
git clone https://github.com/Microsoft/vcpkg.git C:\path\to\vcpkg
- C:\path\to\vcpkg\bootstrap-vcpkg.bat
-Set the `VCPKG_ROOT` and `VCPKG_DEFAULT_TRIPLET` environment variables
-(only required when running `vcpkg install` or creating a new build tree):
+Set `VCPKG_TARGET_TRIPLET` and `CMAKE_TOOLCHAIN_FILE` when creating the build
+tree:
- set VCPKG_ROOT=C:\path\to\vcpkg
- set VCPKG_DEFAULT_TRIPLET=%PLATFORM%-windows-static
-
-Install ReaPack's build dependencies:
-
- set /p reapack-deps=<vendor\vcpkg-deps.txt
- %VCPKG_ROOT%\vcpkg install %reapack-deps%
+ -DVCPKG_TARGET_TRIPLET=%PLATFORM%-windows-static
+ -DCMAKE_TOOLCHAIN_FILE=C:\path\to\vcpkg\scripts\buildsystems\vcpkg.cmake
### Build configuration
@@ -70,7 +64,7 @@ Create and configure a new build tree inside of the `build` directory.
cmake -B build -DCMAKE_BUILD_TYPE=Debug
Using the [Ninja](https://ninja-build.org/) generator is recommended for
-best performances:
+best performance:
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
@@ -81,10 +75,6 @@ Alternatively, multiple build trees can be created if desired:
cmake -B build/portable -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/path/to/reaper/portable/install
-The vcpkg install is automatically detected and configured from the `VCPKG_ROOT`
-and `VCPKG_DEFAULT_TRIPLET` environment variables when creating a build tree on
-Windows.
-
### Compile and install
To compile a build tree:
diff --git a/cmake/vcpkg-triplets/arch-env.cmake b/cmake/vcpkg-triplets/arch-env.cmake
@@ -0,0 +1,18 @@
+if(NOT DEFINED ENV{ARCH})
+ message(FATAL_ERROR "The ARCH environment variable is not set.")
+endif()
+
+if($ENV{ARCH} STREQUAL "x86_64")
+ set(VCPKG_TARGET_ARCHITECTURE x64)
+elseif($ENV{ARCH} STREQUAL "i386")
+ set(VCPKG_TARGET_ARCHITECTURE x86)
+else()
+ set(VCPKG_TARGET_ARCHITECTURE $ENV{ARCH})
+endif()
+set(VCPKG_BUILD_TYPE release)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+set(VCPKG_CMAKE_SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME})
+set(VCPKG_OSX_ARCHITECTURES $ENV{ARCH})
+set(VCPKG_OSX_DEPLOYMENT_TARGET $ENV{DEPLOY_TARGET})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -6,15 +6,7 @@ find_package(MiniZip REQUIRED)
find_package(Threads REQUIRED)
find_package(WDL REQUIRED)
-if(NOT APPLE AND NOT WIN32)
- find_package(OpenSSL REQUIRED COMPONENTS Crypto)
-endif()
-
-if(NOT WIN32)
- find_package(SWELL REQUIRED)
-endif()
-
-if(VCPKG_TOOLCHAIN)
+if(WIN32)
# required for selecting the right debug or release version
find_package(unofficial-sqlite3 CONFIG REQUIRED)
add_library(SQLite::SQLite3 INTERFACE IMPORTED)
@@ -22,8 +14,13 @@ if(VCPKG_TOOLCHAIN)
find_package(tinyxml2 CONFIG REQUIRED)
else()
+ find_package(SWELL REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(SQLite3 REQUIRED)
+
+ if(NOT APPLE)
+ find_package(OpenSSL REQUIRED COMPONENTS Crypto)
+ endif()
endif()
find_package(Git)
diff --git a/vcpkg.json b/vcpkg.json
@@ -0,0 +1,16 @@
+{
+ "name": "reapack",
+ "version-string": "current",
+ "dependencies": [
+ { "name": "boost-algorithm", "platform": "!linux" },
+ { "name": "boost-lexical-cast", "platform": "!linux" },
+ { "name": "boost-logic", "platform": "!linux" },
+ { "name": "boost-math", "platform": "!linux" },
+ { "name": "boost-preprocessor", "platform": "!linux" },
+ { "name": "boost-range", "platform": "!linux" },
+ "catch2",
+ { "name": "curl", "platform": "windows", "features": [ "non-http" ] },
+ { "name": "sqlite3", "platform": "windows" },
+ { "name": "tinyxml2", "platform": "windows" }
+ ]
+}
diff --git a/vendor/vcpkg-deps.txt b/vendor/vcpkg-deps.txt
@@ -1 +0,0 @@
-boost-algorithm boost-core boost-lexical-cast boost-logic boost-math boost-preprocessor boost-range catch2 curl[non-http] sqlite3 tinyxml2