Skip to content

Commit

Permalink
Fix fetching sources of specific version with 'prerequisites' target
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhmm committed Oct 1, 2024
1 parent 812223e commit 1d69f74
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 30 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/conan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: C/C++ CI Conan

on: [push]

jobs:
build-on-windows:

runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Cache Boost dependencies
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/build/conan
${{ github.workspace }}/build/CMakeFiles
C:/Boost
key: ${{ runner.os }}-boost-${{ hashFiles('**/conanfile.txt') }}
restore-keys: |
${{ runner.os }}-boost-
- name: Create Build Dir
run: cmake -E make_directory ${{github.workspace}}/build
- name: Use Conan
run: |
pip install conan && conan profile detect
echo "[requires]" > ${{github.workspace}}/conanfile.txt
echo boost/1.84.0 >> ${{github.workspace}}/conanfile.txt
echo leveldb/1.23 >> ${{github.workspace}}/conanfile.txt
echo "[generators]" >> ${{github.workspace}}/conanfile.txt
echo CMakeDeps >> ${{github.workspace}}/conanfile.txt
echo CMakeToolchain >> ${{github.workspace}}/conanfile.txt
- name: Configure
working-directory: ${{github.workspace}}/build
env:
CC: cl
run: cmake ${{github.workspace}} -DOPENMIND_USE_CONAN=ON -DOPENMIND_USE_VCPKG=NO -DOPENMIND_BUILD_SAMPLES=NO -DOPENMIND_BUILD_TESTS=ON -G "Ninja Multi-Config" -D CMAKE_C_COMPILER="cl.exe" -D CMAKE_CXX_COMPILER="cl.exe" -DOPENMIND_MATH_USE_LEVELDB_CACHE=ON -DOPENMIND_STORAGE_LEVELDB=ON
- name: Install prerequisites with conan
working-directory: ${{github.workspace}}/build
run: cmake --build ${{github.workspace}}/build --target Install__Conan --config Release
- name: Reconfigure to detect newly installed prerequisites
working-directory: ${{github.workspace}}
run: cmake --preset conan-default
- name: Build
working-directory: ${{github.workspace}}
run: cmake --preset conan-default --build
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: check
working-directory: ${{github.workspace}}
run: ctest --preset conan-default --timeout 240 -j ${{steps.cpu-cores.outputs.count}} -E "image_codec_test|ts|Polyfit_test" --output-on-failure
# --rerun-failed --output-on-failure
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C/C++ CI
name: C/C++ CI Docker

on: [push]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C/C++ CI
name: C/C++ CI macOS

on: [push]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C/C++ CI
name: C/C++ CI Ubuntu

on: [push]

Expand Down
28 changes: 6 additions & 22 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C/C++ CI
name: C/C++ CI MSVC

on: [push]

Expand All @@ -8,42 +8,26 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Cache Boost dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/build/conan
${{ github.workspace }}/build/CMakeFiles
C:/Boost
key: ${{ runner.os }}-boost-${{ hashFiles('**/conanfile.txt') }}
key: ${{ runner.os }}-boost-${{ hashFiles('**/vcpkg.json') }}
restore-keys: |
${{ runner.os }}-boost-
- name: Create Build Dir
run: cmake -E make_directory ${{github.workspace}}/build
- name: Use Conan
run: |
pip install conan && conan profile detect

echo "[requires]" > ${{github.workspace}}/conanfile.txt
echo boost/1.84.0 >> ${{github.workspace}}/conanfile.txt
echo leveldb/1.23 >> ${{github.workspace}}/conanfile.txt
echo "[generators]" >> ${{github.workspace}}/conanfile.txt
echo CMakeDeps >> ${{github.workspace}}/conanfile.txt
echo CMakeToolchain >> ${{github.workspace}}/conanfile.txt
- name: Configure
working-directory: ${{github.workspace}}/build
env:
CC: cl
run: cmake ${{github.workspace}} -DOPENMIND_USE_CONAN=OFF -DOPENMIND_USE_VCPKG=NO -DOPENMIND_BUILD_SAMPLES=OFF -DOPENMIND_BUILD_TESTS=ON -G "Ninja Multi-Config" -D CMAKE_C_COMPILER="cl.exe" -D CMAKE_CXX_COMPILER="cl.exe" -Dleveldb_TAG:STRING="1.23" -DOPENMIND_MATH_USE_LEVELDB_CACHE=OFF -DOPENMIND_STORAGE_LEVELDB=OFF
- name: Install prerequisites with conan
working-directory: ${{github.workspace}}/build
run: cmake --build ${{github.workspace}}/build --target Install__Conan --config Release
- name: Reconfigure to detect newly installed prerequisites
working-directory: ${{github.workspace}}/build
run: cmake . -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/conan_toolchain.cmake
run: cmake ${{github.workspace}} -DOPENMIND_USE_CONAN=OFF -DOPENMIND_USE_VCPKG=NO -DOPENMIND_BUILD_SAMPLES=OFF -DOPENMIND_BUILD_TESTS=ON -G "Ninja Multi-Config" -D CMAKE_C_COMPILER="cl.exe" -D CMAKE_CXX_COMPILER="cl.exe" -Dleveldb_TAG:STRING="1.23" -DOPENMIND_MATH_USE_LEVELDB_CACHE=ON -DOPENMIND_STORAGE_LEVELDB=ON

- name: Install prerequisites
working-directory: ${{github.workspace}}/build
run: cmake --build ${{github.workspace}}/build --target prerequisites --config Release
Expand Down
16 changes: 11 additions & 5 deletions cmake/find_local_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ macro(find_pkg)
foreach(dep ${ARGN})
if(NOT ${dep}_FOUND)
if(${dep}_VERSION)
message("find_package(${dep} ${${dep}_VERSION} REQUIRED)")
find_package(${dep} ${${dep}_VERSION} REQUIRED)
find_package(${dep} ${${dep}_VERSION})
if(${dep}_FOUND)
message("find_package(${dep} ${${dep}_VERSION} REQUIRED)")
find_package(${dep} ${${dep}_VERSION} REQUIRED)
endif()
elseif(${dep}_TAG AND NOT ${dep}_TAG STREQUAL HEAD)
message("find_package(${dep} ${${dep}_TAG} REQUIRED)")
find_package(${dep} ${${dep}_TAG} REQUIRED)
find_package(${dep} ${${dep}_TAG})
if(${dep}_FOUND)
message("find_package(${dep} ${${dep}_TAG} REQUIRED)")
find_package(${dep} ${${dep}_TAG} REQUIRED)
endif()
else()
message("find_package(${dep} REQUIRED)")
message("find_package(${dep})")
find_package(${dep})
endif()
endif()
Expand Down

0 comments on commit 1d69f74

Please sign in to comment.