Skip to content

Commit

Permalink
Simplify configuration and use of vcpkg
Browse files Browse the repository at this point in the history
* Simplify configuration and use of vcpkg
* Use 22.04
* Set and use BUILD_TYPE = Release
* Use -DVCPKG_BUILD_TYPE=release
  • Loading branch information
magnesj authored May 31, 2024
1 parent 4f5a0d8 commit 1e07b23
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 275 deletions.
91 changes: 39 additions & 52 deletions .github/workflows/ResInsightWithCache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
BUILDCACHE_VERSION: 0.27.6
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
BUILDCACHE_ACCURACY: SLOPPY
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -23,45 +24,43 @@ jobs:
strategy:
fail-fast: false
matrix:
build_type: [Release]
config:
- {
name: "Windows Latest MSVC",
os: windows-2022,
cc: "cl",
cxx: "cl",
vcpkg-response-file: vcpkg_x64-windows.txt,
vcpkg-triplet: x64-windows,
build-python-module: true,
execute-unit-tests: true,
execute-pytests: true,
unity-build: true,
publish-to-pypi: false,
vcpkg-bootstrap: bootstrap-vcpkg.bat,
}
- {
name: "Ubuntu 20.04 gcc",
os: ubuntu-20.04,
name: "Ubuntu 22.04 gcc",
os: ubuntu-22.04,
cc: "gcc",
cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
build-python-module: true,
execute-unit-tests: true,
execute-pytests: true,
unity-build: false,
publish-to-pypi: true,
vcpkg-bootstrap: bootstrap-vcpkg.sh,
}
- {
name: "Ubuntu 22.04 clang-16",
os: ubuntu-22.04,
cc: "clang-16",
cxx: "clang++-16",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
build-python-module: true,
execute-unit-tests: true,
execute-pytests: false,
unity-build: false,
publish-to-pypi: false,
vcpkg-bootstrap: bootstrap-vcpkg.sh,
}
steps:
- name: Checkout
Expand Down Expand Up @@ -177,55 +176,43 @@ jobs:
cache: true
modules: "qtnetworkauth"

- name: Restore from cache and install vcpkg
uses: lukka/run-vcpkg@v7
id: runvcpkg
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
vcpkgArguments: "@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}"
vcpkgDirectory:
"${{ github.workspace }}/ThirdParty/vcpkg"
appendedCacheKey: ${{ matrix.config.os }}-${{ matrix.config.cxx }}-cache-key-v2
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Configure
shell: cmake -P {0}
- name: vcpkg bootstrap
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
execute_process(
COMMAND cmake
-S .
-B cmakebuild
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-D CMAKE_INSTALL_PREFIX=cmakebuild/install
-D RESINSIGHT_QT5_BUNDLE_LIBRARIES=true
-D RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
-D RESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true
-D RESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false
-D RESINSIGHT_ENABLE_UNITY_BUILD=${{ matrix.config.unity-build }}
-D RESINSIGHT_ENABLE_GRPC=${{ matrix.config.build-python-module }}
-D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}
-D RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true
-D RESINSIGHT_ENABLE_HDF5=false
-D RESINSIGHT_BUILD_LIBS_FROM_SOURCE=false
-D CMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
-G Ninja
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
ThirdParty/vcpkg/${{ matrix.config.vcpkg-bootstrap }}
- name: Configure
shell: bash
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: >
cmake -S . -B cmakebuild
-DVCPKG_BUILD_TYPE=release
-DCMAKE_INSTALL_PREFIX=cmakebuild/install
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DRESINSIGHT_QT5_BUNDLE_LIBRARIES=true
-DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
-DRESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true
-DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false
-DRESINSIGHT_ENABLE_UNITY_BUILD=${{ matrix.config.unity-build }}
-DRESINSIGHT_ENABLE_GRPC=${{ matrix.config.build-python-module }}
-DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}
-DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true
-DRESINSIGHT_ENABLE_HDF5=false
-DRESINSIGHT_BUILD_LIBS_FROM_SOURCE=false
-DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
-G Ninja
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build cmakebuild --target install
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
cmake --build cmakebuild --target install
- name: Stats for buildcache
run: ${{ github.workspace }}/buildcache/bin/buildcache -s
Expand Down
7 changes: 0 additions & 7 deletions ApplicationLibCode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ if(MSVC)
add_definitions(-D_USE_MATH_DEFINES)
endif()

# ##############################################################################
# Eigen
# ##############################################################################
if(RESINSIGHT_VCPKG_AUTO_INSTALL)
vcpkg_install(eigen3)
endif()

find_package(Eigen3 REQUIRED)

# ##############################################################################
Expand Down
16 changes: 0 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
option(RESINSIGHT_BUNDLE_TESTMODELS "Copy TestModels into the installation" OFF)
mark_as_advanced(RESINSIGHT_BUNDLE_TESTMODELS)

option(RESINSIGHT_VCPKG_AUTO_INSTALL
"Automatically download build pre-requisites with VCPKG" OFF
)
mark_as_advanced(RESINSIGHT_VCPKG_AUTO_INSTALL)

if(RESINSIGHT_VCPKG_AUTO_INSTALL)
include(AutoVcpkg)
set(AUTO_VCPKG_ROOT "${CMAKE_SOURCE_DIR}/ThirdParty/vcpkg")
endif()

set(CMAKE_CXX_STANDARD 20)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -436,12 +426,6 @@ endif() # MSVC
# Opm
# ##############################################################################

if(RESINSIGHT_VCPKG_AUTO_INSTALL)
vcpkg_install(boost-filesystem)
vcpkg_install(boost-spirit)
include(${CMAKE_TOOLCHAIN_FILE})
endif()

add_subdirectory(ThirdParty/custom-opm-flowdiagnostics)
add_subdirectory(ThirdParty/custom-opm-flowdiag-app)

Expand Down
4 changes: 0 additions & 4 deletions GrpcInterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ project(GrpcInterface)
message(STATUS "GRPC enabled")
add_definitions(-DENABLE_GRPC)

if(RESINSIGHT_VCPKG_AUTO_INSTALL)
vcpkg_install(grpc)
endif()

set(CMAKE_UNITY_BUILD false)
set(RESINSIGHT_GRPC_PYTHON_EXECUTABLE
""
Expand Down
148 changes: 0 additions & 148 deletions cmake/AutoVcpkg.cmake

This file was deleted.

27 changes: 0 additions & 27 deletions cmake/vcpkg-bootstrap.cmake

This file was deleted.

14 changes: 14 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "a42af01b72c28a8e1d7b48107b33e4f286a55ef6",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}
Loading

0 comments on commit 1e07b23

Please sign in to comment.