From d58e870089a2f2bd23a0959b27e6d46b02544892 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 31 Jan 2020 00:48:05 +0300 Subject: move Travis/AppVeyor scripts to Makefile --- .appveyor.yml | 93 ++++------------------------- .travis.yml | 83 ++------------------------ Makefile | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 202 insertions(+), 160 deletions(-) create mode 100644 Makefile diff --git a/.appveyor.yml b/.appveyor.yml index a11828e..35bb4c3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,7 +7,7 @@ image: environment: appveyor_boost_version: 1.65.0 - python_exe: C:\Python36-x64\python.exe + appveyor_python_exe: C:\Python36-x64\python.exe configuration: - MinSizeRel @@ -18,93 +18,20 @@ platform: matrix: fast_finish: true +install: + - choco install make + build_script: - echo Simple CMake projects - - - >- - "%python_exe%" ./cmake/build/build.py - --install C:\install\simple - --configuration Release - -- cmake/examples/simple - -A x64 - - C:\install\simple\bin\foo.exe - - ps: .\.ci\verify_arch.ps1 -Path C:\install\simple\bin\foo.exe -Arch x64 - - - >- - "%python_exe%" ./cmake/build/build.py - --install C:\install\static - --configuration Debug - -- cmake/examples/static - -A Win32 - - C:\install\static\bin\foo.exe - - ps: .\.ci\verify_arch.ps1 -Path C:\install\static\bin\foo.exe -Arch x86 - - - >- - "%python_exe%" ./cmake/build/build.py - --install C:\install\dynamic - --configuration RelWithDebInfo - -- cmake/examples/dynamic - -A x64 - - C:\install\dynamic\bin\foo.exe - - ps: .\.ci\verify_arch.ps1 -Path C:\install\dynamic\bin\foo.exe -Arch x64 + - make simple + - make static + - make dynamic - echo Boost 1.58.0 - - - '"%python_exe%" ./boost/build/build.py download 1.58.0' - - >- - "%python_exe%" ./boost/build/build.py build - --configuration Debug - --platform x86 - --link static - -- ./boost_1_58_0 - --with-filesystem --with-program_options - - dir /a-D /S /B boost_1_58_0\stage - - - >- - "%python_exe%" ./cmake/build/build.py - --install C:\install\boost_1_58_0 - --configuration Debug - -- cmake/examples/boost - -A Win32 - -D "BOOST_ROOT=%APPVEYOR_BUILD_FOLDER%\boost_1_58_0" - -D "BOOST_LIBRARYDIR=%APPVEYOR_BUILD_FOLDER%\boost_1_58_0\stage\x86\lib" - - C:\install\boost_1_58_0\bin\foo.exe - - ps: .\.ci\verify_arch.ps1 -Path C:\install\boost_1_58_0\bin\foo.exe -Arch x86 + - make boost/58 - echo Boost 1.72.0 - - - '"%python_exe%" ./boost/build/build.py download --cache . 1.72.0' - - >- - "%python_exe%" ./boost/build/build.py build - --platform x86 x64 - --link shared - -- ./boost_1_72_0 - --with-filesystem --with-program_options - - dir /a-D /S /B boost_1_72_0\stage - - - >- - "%python_exe%" ./cmake/build/build.py - --install C:\install\boost_1_72_0 - --configuration Release - -- cmake/examples/boost - -A x64 - -D "BOOST_ROOT=%APPVEYOR_BUILD_FOLDER%\boost_1_72_0" - -D "BOOST_LIBRARYDIR=%APPVEYOR_BUILD_FOLDER%\boost_1_72_0\stage\x64\lib" - -D Boost_USE_STATIC_LIBS=OFF - - set "PATH=%APPVEYOR_BUILD_FOLDER%\boost_1_72_0\stage\x64\lib;%PATH%" && C:\install\boost_1_72_0\bin\foo.exe - - ps: .\.ci\verify_arch.ps1 -Path C:\install\boost_1_72_0\bin\foo.exe -Arch x64 + - make boost/72 - echo Boost 1.65.0 - - - '"%python_exe%" ./boost/build/ci/appveyor.py --link static -- --with-filesystem --with-program_options' - - dir /a-D /S /B C:\boost_1_65_0\stage - - - >- - set "APPVEYOR_BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER%\cmake\examples\boost" && - "%python_exe%" ./cmake/build/ci/appveyor.py - --install C:\install\boost_1_65_0 - -- - -D BOOST_ROOT=C:\boost_1_65_0 - -D BOOST_LIBRARYDIR=C:\boost_1_65_0\stage\x64\lib - - C:\install\boost_1_65_0\bin\foo.exe - - ps: .\.ci\verify_arch.ps1 -Path C:\install\boost_1_65_0\bin\foo.exe -Arch x64 + - make boost/65 diff --git a/.travis.yml b/.travis.yml index 75bbd0b..8a48951 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,89 +28,18 @@ jobs: - name: Simple CMake projects script: - - >- - ./cmake/build/build.py - --install "$HOME/install/simple" - --configuration Release - -- cmake/examples/simple - - "$HOME/install/simple/bin/foo" - - ./.ci/verify_arch.sh "$HOME/install/simple/bin/foo" x64 - - - >- - ./cmake/build/build.py - --install "$HOME/install/static" - --configuration Debug - -- cmake/examples/static - -D "CMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/toolchains/gcc-x86.cmake" - - "$HOME/install/static/bin/foo" - - ./.ci/verify_arch.sh "$HOME/install/static/bin/foo" x86 - - - >- - ./cmake/build/build.py - --install "$HOME/install/dynamic" - --configuration RelWithDebInfo - -- cmake/examples/dynamic - - LD_LIBRARY_PATH="$HOME/install/dynamic/lib" "$HOME/install/dynamic/bin/foo" - - ./.ci/verify_arch.sh "$HOME/install/dynamic/bin/foo" x64 + - make simple + - make static + - make dynamic - name: Boost 1.58 - script: - - ./boost/build/build.py download 1.58.0 - - >- - ./boost/build/build.py build - --configuration Debug - --platform x86 - --link static - -- ./boost_1_58_0 - --with-filesystem --with-program_options - - bash -o pipefail -c 'find boost_1_58_0/stage -type f | sort' - - >- - ./cmake/build/build.py - --install "$HOME/install/boost_1_58_0" - --configuration Debug - -- cmake/examples/boost - -D "CMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/toolchains/gcc-x86.cmake" - -D "BOOST_ROOT=$TRAVIS_BUILD_DIR/boost_1_58_0" - -D "BOOST_LIBRARYDIR=$TRAVIS_BUILD_DIR/boost_1_58_0/stage/x86/Debug/lib" - - "$HOME/install/boost_1_58_0/bin/foo" - - ./.ci/verify_arch.sh "$HOME/install/boost_1_58_0/bin/foo" x86 + script: make boost/58 - name: Boost 1.72 - script: - - ./boost/build/build.py download --cache . 1.72.0 - - >- - ./boost/build/build.py build - --platform x86 x64 - --link shared - -- ./boost_1_72_0 - --with-filesystem --with-program_options - - bash -o pipefail -c 'find boost_1_72_0/stage -type f | sort' - - >- - ./cmake/build/build.py - --install "$HOME/install/boost_1_72_0" - --configuration Release - -- cmake/examples/boost - -D "BOOST_ROOT=$TRAVIS_BUILD_DIR/boost_1_72_0" - -D "BOOST_LIBRARYDIR=$TRAVIS_BUILD_DIR/boost_1_72_0/stage/x64/Release/lib" - -D Boost_USE_STATIC_LIBS=OFF - - >- - LD_LIBRARY_PATH="$TRAVIS_BUILD_DIR/boost_1_72_0/stage/x64/Release/lib" - "$HOME/install/boost_1_72_0/bin/foo" - - ./.ci/verify_arch.sh "$HOME/install/boost_1_72_0/bin/foo" x64 + script: make boost/72 - name: Boost 1.65 - script: - - ./boost/build/ci/travis.py --link static -- --with-filesystem --with-program_options - - bash -o pipefail -c 'find "$HOME/boost_1_65_0/stage" -type f | sort' - - >- - TRAVIS_BUILD_DIR="$TRAVIS_BUILD_DIR/cmake/examples/boost" - ./cmake/build/ci/travis.py - --install "$HOME/install/boost_1_65_0" - -- - -D BOOST_ROOT="$HOME/boost_1_65_0" - -D BOOST_LIBRARYDIR="$HOME/boost_1_65_0/stage/x64/Release/lib" - - "$HOME/install/boost_1_65_0/bin/foo" - - ./.ci/verify_arch.sh "$HOME/install/boost_1_65_0/bin/foo" x64 + script: make boost/65 env: travis_boost_version: 1.65.0 configuration: MinSizeRel diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0f7f8f8 --- /dev/null +++ b/Makefile @@ -0,0 +1,186 @@ +# Travis/AppVeyor commands. + +ifeq ($(OS),Windows_NT) +windows = 1 +else +windows = 0 +endif + +ifeq ($(windows),1) +SHELL = cmd +ext = .exe +x64_args = -A x64 +x86_args = -A Win32 +install_prefix = C:/install +verify_arch = powershell -file ./.ci/verify_arch.ps1 +python = python +ls = dir /a-D /S /B +cwd = $(shell cd) +else +ext = +x64_args = +x86_args = -D "CMAKE_TOOLCHAIN_FILE=$(TRAVIS_BUILD_DIR)/cmake/toolchains/gcc-x86.cmake" +install_prefix = $(HOME)/install +verify_arch = ./.ci/verify_arch.sh +python = python3 +ls = ls --almost-all -R +cwd = $(shell pwd) +endif + +ifdef appveyor_python_exe +python = $(appveyor_python_exe) +endif + +# examples/simple: x64/Release build. + +simple/build: + "$(python)" cmake/build/build.py --install "$(install_prefix)/simple" --configuration Release -- cmake/examples/simple $(x64_args) + +simple/run: + "$(install_prefix)/simple/bin/foo" + +simple/verify: + $(verify_arch) "$(install_prefix)/simple/bin/foo$(ext)" x64 + +simple: simple/build simple/run simple/verify + +.PHONY: simple simple/build simple/run simple/verify + +# examples/static: x86/Debug build. + +static/build: + "$(python)" cmake/build/build.py --install "$(install_prefix)/static" --configuration Debug -- cmake/examples/static $(x86_args) + +static/run: + "$(install_prefix)/static/bin/foo" + +static/verify: + $(verify_arch) "$(install_prefix)/static/bin/foo$(ext)" x86 + +static: static/build static/run static/verify + +.PHONY: static static/build static/run static/verify + +# examples/dynamic: x64/RelWithDebInfo build. + +dynamic/build: + "$(python)" cmake/build/build.py --install "$(install_prefix)/dynamic" --configuration RelWithDebInfo -- cmake/examples/dynamic $(x64_args) + +# Windows can pick up DLLs in the same directory, otherwise we need to add them +# to PATH. +dynamic/run: +ifeq ($(windows),1) + "$(install_prefix)/dynamic/bin/foo" +else + LD_LIBRARY_PATH="$(install_prefix)/dynamic/lib" "$(install_prefix)/dynamic/bin/foo" +endif + +dynamic/verify: + $(verify_arch) "$(install_prefix)/dynamic/bin/foo$(ext)" x64 + +dynamic: dynamic/build dynamic/run dynamic/verify + +.PHONY: dynamic dynamic/build dynamic/run dynamic/verify + +# Boost 1.58.0: +# * temporary download, +# * x86, Debug, static libraries only. +# examples/boost: +# * x86/Debug build. + +boost/58/download: + "$(python)" boost/build/build.py download 1.58.0 + +boost/58/build: + "$(python)" boost/build/build.py build --configuration Debug --platform x86 --link static -- ./boost_1_58_0 --with-filesystem --with-program_options + +boost/58/ls: + $(ls) "./boost_1_58_0/stage" + +boost/58/exe/build: + "$(python)" cmake/build/build.py --install "$(install_prefix)/boost_1_58_0" --configuration Debug -- cmake/examples/boost $(x86_args) -D "BOOST_ROOT=$(cwd)/boost_1_58_0" -D "BOOST_LIBRARYDIR=$(cwd)/boost_1_58_0/stage/x86/Debug/lib" + +# Boost should be linked statically, no need to adjust PATH: +boost/58/exe/run: + "$(install_prefix)/boost_1_58_0/bin/foo" + +boost/58/exe/verify: + $(verify_arch) "$(install_prefix)/boost_1_58_0/bin/foo$(ext)" x86 + +boost/58/exe: boost/58/exe/build boost/58/exe/run boost/58/exe/verify + +boost/58: boost/58/download boost/58/build boost/58/ls boost/58/exe + +.PHONY: boost/58 boost/58/download boost/58/build boost/58/ls boost/58/exe boost/58/exe/build boost/58/exe/run boost/58/exe/verify + +# Boost 1.72.0: +# * cached download, +# * x86 & x64, Debug & Release, shared libraries only. +# examples/boost: +# * x64/Release build. + +boost/72/download: + "$(python)" boost/build/build.py download --cache . 1.72.0 + +boost/72/build: + "$(python)" boost/build/build.py build --platform x86 x64 --link shared -- ./boost_1_72_0 --with-filesystem --with-program_options + +boost/72/ls: + $(ls) "./boost_1_72_0/stage" + +boost/72/exe/build: + "$(python)" cmake/build/build.py --install "$(install_prefix)/boost_1_72_0" --configuration Release -- cmake/examples/boost $(x64_args) -D "BOOST_ROOT=$(cwd)/boost_1_72_0" -D "BOOST_LIBRARYDIR=$(cwd)/boost_1_72_0/stage/x64/Release/lib" -D Boost_USE_STATIC_LIBS=OFF + +# Boost is linked dynamically, we need to adjust PATH: +boost/72/exe/run: +ifeq ($(windows),1) + set "PATH=$(cwd)\boost_1_72_0\stage\x64\Release\lib;%PATH%" && "$(install_prefix)/boost_1_72_0/bin/foo" +else + LD_LIBRARY_PATH="$(cwd)/boost_1_72_0/stage/x64/Release/lib" "$(install_prefix)/boost_1_72_0/bin/foo" +endif + +boost/72/exe/verify: + $(verify_arch) "$(install_prefix)/boost_1_72_0/bin/foo$(ext)" x64 + +boost/72/exe: boost/72/exe/build boost/72/exe/run boost/72/exe/verify + +boost/72: boost/72/download boost/72/build boost/72/ls boost/72/exe + +.PHONY: boost/72 boost/72/download boost/72/build boost/72/ls boost/72/exe boost/72/exe/build boost/72/exe/run boost/72/exe/verify + +# Boost 1.65.0: +# * download to $HOME (on Travis), C:\ (on AppVeyor), +# x64, Release, static & shared libraries. +# examples/boost: +# * x64/MinSizeRel build (set in .travis.yml and .appveyor.yml). + +ifdef TRAVIS +boost/65/build: + "$(python)" boost/build/ci/travis.py --link static -- --with-filesystem --with-program_options + +boost/65/ls: + $(ls) "$$HOME/boost/stage" + +boost/65/exe/build: + TRAVIS_BUILD_DIR="$$TRAVIS_BUILD_DIR/cmake/examples/boost" "$(python)" cmake/build/ci/travis.py --install "$(install_prefix)/boost_1_65_0" -- -D "BOOST_ROOT=$$HOME/boost" -D "BOOST_LIBRARYDIR=$$HOME/boost/stage/$$platform/$$configuration/lib" +endif +ifdef APPVEYOR +boost/65/build: + "$(python)" boost/build/ci/appveyor.py --link static -- --with-filesystem --with-program_options + +boost/65/ls: + $(ls) "C:/projects/boost/stage" + +boost/65/exe/build: + set "APPVEYOR_BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER%\cmake\examples\boost" && "$(python)" cmake/build/ci/appveyor.py --install "$(install_prefix)/boost_1_65_0" -- -D "BOOST_ROOT=C:\projects\boost" -D "BOOST_LIBRARYDIR=C:\projects\boost\stage\%platform%\%configuration%\lib" +endif + +boost/65/exe/run: + "$(install_prefix)/boost_1_65_0/bin/foo" + +boost/65/exe/verify: + $(verify_arch) "$(install_prefix)/boost_1_65_0/bin/foo$(ext)" x64 + +boost/65/exe: boost/65/exe/build boost/65/exe/run boost/65/exe/verify + +boost/65: boost/65/build boost/65/ls boost/65/exe -- cgit v1.2.3