Skip to content

Refactor CMakeLists.txt to simplify dependency management #856

Refactor CMakeLists.txt to simplify dependency management

Refactor CMakeLists.txt to simplify dependency management #856

Workflow file for this run

name: Windows
on:
push:
paths-ignore:
- '.github/scripts/**'
- '.github/workflows/update-readme.yml'
- '*.md'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
GITHUB_WORKFLOW: Windows
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-2019"]
python-version: ["3.7.9"]
steps:
- uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('.github/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
environment-file: .github/environment.yml
activate-environment: tracking
python-version: ${{ matrix.python-version }}
channels: main
auto-activate-base: true
auto-update-conda: true
use-only-tar-bz2: true
- name: Build
shell: powershell
working-directory: ${{runner.workspace}}
run: |
echo "::group::Info"
conda info
conda list
echo Workspace: $GITHUB_WORKSPACE
ls $GITHUB_WORKSPACE/*
cd "D:/a/commons/commons"
ls
$python_exe=$( python -c "from shutil import which; print(which('python'))" )
$pythoninclude=$( python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())" )
$findlib=$( python find_library.py )
echo "python_exe = ${python_exe}"
echo "findlib = ${findlib}"
echo "pythoninclude = ${pythoninclude}"
echo "::endgroup::"
echo "::group::BUILD"
mkdir build
cd build
git submodule update --init --recursive
cmake .. -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE" -DPYTHON_INCLUDE_DIR:FILEPATH=$pythoninclude -DPYTHON_LIBRARY:FILEPATH=$findlib -DPYTHON_EXECUTABLE:FILEPATH=$python_exe -DWITH_PYLON=OFF -DCOMMONS_BUILD_OPENCV=ON -DCOMMONS_BUILD_PNG=ON -DCOMMONS_BUILD_ZIP=ON -DCOMMONS_BUILD_GLFW=ON -DCOMMONS_BUILD_ZLIB=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --target Z_LIB --config Release
cmake --build . --target libzip --config Release
cmake --build . --target libpng_custom --config Release
cmake --build . --target CustomOpenCV --config Release
cmake ..
cmake --build . --target INSTALL --config Release
echo "::endgroup::"