ci: Fix system_build workflow

This commit is contained in:
Mizux Seiha
2024-07-18 18:47:55 +02:00
committed by Corentin Le Molgat
parent d577dd79fd
commit dbecad75cb
5 changed files with 147 additions and 91 deletions

View File

@@ -398,6 +398,9 @@ CMAKE_DEPENDENT_OPTION(BUILD_PYTHON_DOC "Build the Python doc" OFF "NOT BUILD_DO
message(STATUS "Python: Fetch dependencies: ${FETCH_PYTHON_DEPS}")
endif()
# Find system deps
include(system_deps)
# Build Needed dependencies
add_subdirectory(cmake/dependencies dependencies)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR}/dependencies/install)
@@ -426,7 +429,9 @@ message(STATUS "Found int * size: ${SIZEOF_INT_P}")
cmake_pop_check_state()
include(host)
include(deps)
# verify deps
include(check_deps)
include(cpp)
include(flatzinc)
include(glop)

109
cmake/check_deps.cmake Normal file
View File

@@ -0,0 +1,109 @@
# Copyright 2010-2024 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Check dependencies
if(NOT TARGET ZLIB::ZLIB)
message(FATAL_ERROR "Target ZLIB::ZLIB not available.")
endif()
if(NOT TARGET absl::base)
message(FATAL_ERROR "Target absl::base not available.")
endif()
set(ABSL_DEPS
absl::base
absl::core_headers
absl::absl_check
absl::absl_log
absl::check
absl::die_if_null
absl::flags
absl::flags_commandlineflag
absl::flags_marshalling
absl::flags_parse
absl::flags_reflection
absl::flags_usage
absl::log
absl::log_flags
absl::log_globals
absl::log_initialize
absl::log_internal_message
absl::cord
absl::random_random
absl::raw_hash_set
absl::hash
absl::leak_check
absl::memory
absl::meta
absl::stacktrace
absl::status
absl::statusor
absl::str_format
absl::strings
absl::synchronization
absl::time
absl::any
)
if(NOT TARGET protobuf::libprotobuf)
message(FATAL_ERROR "Target protobuf::libprotobuf not available.")
endif()
if(NOT TARGET Eigen3::Eigen)
message(FATAL_ERROR "Target Eigen3::Eigen not available.")
endif()
if(BUILD_LP_PARSER OR BUILD_TESTING)
if(NOT TARGET re2::re2)
message(FATAL_ERROR "Target re2::re2 not available.")
endif()
set(RE2_DEPS re2::re2)
endif()
if(USE_COINOR)
if(NOT TARGET Coin::CbcSolver)
message(FATAL_ERROR "Target Coin::CbcSolver not available.")
endif()
if(NOT TARGET Coin::ClpSolver)
message(FATAL_ERROR "Target Coin::ClpSolver not available.")
endif()
set(COINOR_DEPS Coin::CbcSolver Coin::OsiCbc Coin::ClpSolver Coin::OsiClp)
endif()
if(USE_PDLP AND BUILD_PDLP)
set(PDLP_DEPS Eigen3::Eigen)
endif()
if(USE_SCIP AND NOT TARGET libscip)
message(FATAL_ERROR "Target libscip not available.")
endif()
# Check optional Dependencies
if(USE_CPLEX AND NOT TARGET CPLEX::CPLEX)
message(FATAL_ERROR "Target CPLEX::CPLEX not available.")
endif()
# CXX Test
if(BUILD_TESTING AND NOT TARGET GTest::gtest_main)
message(FATAL_ERROR "Target GTest::gtest_main not available.")
endif()
# Check language Dependencies
if(BUILD_PYTHON)
if(NOT TARGET pybind11_abseil::absl_casters)
message(FATAL_ERROR "Target pybind11_abseil::absl_casters not available.")
endif()
if(NOT TARGET pybind11_native_proto_caster)
message(FATAL_ERROR "Target pybind11_native_proto_caster not available.")
endif()
endif()

View File

@@ -14,6 +14,7 @@ COPY . .
FROM devel AS build
# Archlinux do not provide pybind11 protobuf package
RUN cmake -S. -Bbuild -DBUILD_DEPS=OFF \
-DBUILD_pybind11_abseil=ON \
-DBUILD_pybind11_protobuf=ON \
-DUSE_COINOR=ON \
-DUSE_GLPK=ON \

View File

@@ -25,73 +25,23 @@ set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
if(NOT BUILD_ZLIB)
find_package(ZLIB REQUIRED)
endif()
if(NOT TARGET ZLIB::ZLIB)
message(FATAL_ERROR "Target ZLIB::ZLIB not available.")
endif()
if(NOT BUILD_absl)
find_package(absl REQUIRED)
endif()
set(ABSL_DEPS
absl::base
absl::core_headers
absl::absl_check
absl::absl_log
absl::check
absl::die_if_null
absl::flags
absl::flags_commandlineflag
absl::flags_marshalling
absl::flags_parse
absl::flags_reflection
absl::flags_usage
absl::log
absl::log_flags
absl::log_globals
absl::log_initialize
absl::log_internal_message
absl::cord
absl::random_random
absl::raw_hash_set
absl::hash
absl::leak_check
absl::memory
absl::meta
absl::stacktrace
absl::status
absl::statusor
absl::str_format
absl::strings
absl::synchronization
absl::time
absl::any
)
if(NOT BUILD_Protobuf)
find_package(Protobuf REQUIRED)
endif()
if(NOT TARGET protobuf::libprotobuf)
message(FATAL_ERROR "Target protobuf::libprotobuf not available.")
endif()
if(NOT BUILD_Eigen3)
find_package(Eigen3 REQUIRED)
endif()
if(NOT TARGET Eigen3::Eigen)
message(FATAL_ERROR "Target Eigen3::Eigen not available.")
endif()
if(BUILD_LP_PARSER OR BUILD_TESTING)
if(NOT BUILD_re2)
find_package(re2 REQUIRED)
endif()
if(NOT TARGET re2::re2)
message(FATAL_ERROR "Target re2::re2 not available.")
endif()
endif()
if(BUILD_LP_PARSER)
set(RE2_DEPS re2::re2)
endif()
if(USE_COINOR)
@@ -114,34 +64,22 @@ if(USE_COINOR)
if(NOT BUILD_Cbc)
find_package(Cbc REQUIRED)
endif()
set(COINOR_DEPS Coin::CbcSolver Coin::OsiCbc Coin::ClpSolver Coin::OsiClp)
endif()
if(USE_GLPK)
if(NOT BUILD_GLPK)
find_package(GLPK REQUIRED)
endif()
if(USE_GLPK AND NOT BUILD_GLPK)
find_package(GLPK REQUIRED)
endif()
if(USE_HIGHS)
if(NOT BUILD_HIGHS)
find_package(HIGHS REQUIRED)
endif()
if(USE_HIGHS AND NOT BUILD_HIGHS)
find_package(HIGHS REQUIRED)
endif()
if(USE_PDLP)
if(NOT BUILD_PDLP)
find_package(PDLP REQUIRED)
else()
set(PDLP_DEPS Eigen3::Eigen)
endif()
if(USE_PDLP AND NOT BUILD_PDLP)
find_package(PDLP REQUIRED)
endif()
if(USE_SCIP)
if(NOT BUILD_SCIP)
find_package(SCIP REQUIRED)
endif()
if(USE_SCIP AND NOT BUILD_SCIP)
find_package(SCIP REQUIRED)
endif()
# Check optional Dependencies
@@ -150,13 +88,8 @@ if(USE_CPLEX)
endif()
# CXX Test
if(BUILD_TESTING)
if(NOT BUILD_googletest)
find_package(GTest REQUIRED)
endif()
if(NOT TARGET GTest::gtest_main)
message(FATAL_ERROR "Target GTest::gtest_main not available.")
endif()
if(BUILD_TESTING AND NOT BUILD_googletest)
find_package(GTest REQUIRED)
endif()
# Check language Dependencies
@@ -165,6 +98,10 @@ if(BUILD_PYTHON)
find_package(pybind11 REQUIRED)
endif()
if(NOT BUILD_pybind11_abseil)
find_package(pybind11_abseil REQUIRED)
endif()
if(NOT BUILD_pybind11_protobuf)
find_package(pybind11_protobuf REQUIRED)
endif()

View File

@@ -55,25 +55,29 @@ index ceb65a8..e142837 100644
include_directories(${TOP_LEVEL_DIR} ${pybind11_INCLUDE_DIRS})
diff --git a/cmake/dependencies/CMakeLists.txt b/cmake/dependencies/CMakeLists.txt
new file mode 100644
index 0000000..826eda8
index 0000000..b67d564
--- /dev/null
+++ b/cmake/dependencies/CMakeLists.txt
@@ -0,0 +1,15 @@
@@ -0,0 +1,19 @@
+include(FetchContent)
+
+set(ABSL_PROPAGATE_CXX_STD ON)
+set(BUILD_TESTING OFF)
+FetchContent_Declare(
+ absl
+ URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz
+ URL_HASH
+
+if(NOT TARGET absl::base)
+ set(ABSL_PROPAGATE_CXX_STD ON)
+ FetchContent_Declare(
+ absl
+ URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz
+ URL_HASH
+ SHA256=59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5)
+ FetchContent_MakeAvailable(absl)
+endif()
+
+FetchContent_Declare(
+ pybind11
+ URL https://github.com/pybind/pybind11/archive/refs/heads/master.tar.gz)
+
+FetchContent_MakeAvailable(absl pybind11)
+if(NOT TARGET pybind11::pybind11_headers)
+ FetchContent_Declare(
+ pybind11
+ URL https://github.com/pybind/pybind11/archive/refs/heads/master.tar.gz)
+ FetchContent_MakeAvailable(pybind11)
+endif()
diff --git a/pybind11_abseil/BUILD b/pybind11_abseil/BUILD
index 791c245..33e614a 100644
--- a/pybind11_abseil/BUILD