From 1d91b9ccb57eafbb7c07e994089a0f124358ffbd Mon Sep 17 00:00:00 2001 From: Ted Ralphs Date: Tue, 20 Aug 2024 09:12:58 +0200 Subject: [PATCH 1/3] version number updates for release 0.60.9 --- Cgl/configure | 48 ++++++++++++++++++------------------ Cgl/configure.ac | 4 +-- Cgl/src/config_cgl_default.h | 4 +-- README.md | 12 ++++----- configure | 46 +++++++++++++++++----------------- configure.ac | 2 +- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Cgl/configure b/Cgl/configure index 3c03017a..2a787005 100755 --- a/Cgl/configure +++ b/Cgl/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Cgl 0.60. +# Generated by GNU Autoconf 2.59 for Cgl 0.60.9. # # Report bugs to . # @@ -429,8 +429,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Cgl' PACKAGE_TARNAME='cgl' -PACKAGE_VERSION='0.60' -PACKAGE_STRING='Cgl 0.60' +PACKAGE_VERSION='0.60.9' +PACKAGE_STRING='Cgl 0.60.9' PACKAGE_BUGREPORT='cgl@list.coin-or.org' ac_unique_file="src/CglMessage.hpp" @@ -1009,7 +1009,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Cgl 0.60 to adapt to many kinds of systems. +\`configure' configures Cgl 0.60.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1075,7 +1075,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Cgl 0.60:";; + short | recursive ) echo "Configuration of Cgl 0.60.9:";; esac cat <<\_ACEOF @@ -1287,7 +1287,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Cgl configure 0.60 +Cgl configure 0.60.9 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1307,7 +1307,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Cgl $as_me 0.60, which was +It was created by Cgl $as_me 0.60.9, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1833,7 +1833,7 @@ _ACEOF # Capture libtool library version, if given. - + coin_libversion=11:9:10 @@ -1982,7 +1982,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" @@ -2803,7 +2803,7 @@ echo "$as_me: error: Failed to find a C compiler!" >&2;} fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no @@ -2821,7 +2821,7 @@ CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; @@ -2867,7 +2867,7 @@ if test x"$CFLAGS" = x; then case $build in *-cygwin* | *-mingw*) case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' @@ -3182,7 +3182,7 @@ fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; @@ -3682,7 +3682,7 @@ fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no @@ -3732,7 +3732,7 @@ if test x"$CXXFLAGS" = x; then case $build in *-cygwin* | *-mingw*) case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then @@ -4055,7 +4055,7 @@ fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; @@ -4091,7 +4091,7 @@ else coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in - clang* ) + clang* | */clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; @@ -4540,7 +4540,7 @@ fi # Define the identity of the package. PACKAGE='cgl' - VERSION='0.60' + VERSION='0.60.9' cat >>confdefs.h <<_ACEOF @@ -20290,7 +20290,7 @@ fi # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in - clang* ) + clang* | */clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} @@ -20489,7 +20489,7 @@ if test "$dependency_linking" = auto; then case $build in *-cygwin* | *-mingw*) case "$CC" in - clang* ) + clang* | */clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) @@ -27471,7 +27471,7 @@ echo "$as_me:$LINENO: checking which command should be used to link input files" echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac @@ -27485,7 +27485,7 @@ if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in - clang* ) + clang* | */clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; @@ -28125,7 +28125,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by Cgl $as_me 0.60, which was +This file was extended by Cgl $as_me 0.60.9, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -28188,7 +28188,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Cgl config.status 0.60 +Cgl config.status 0.60.9 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/Cgl/configure.ac b/Cgl/configure.ac index 43c47c35..33d4a5d7 100644 --- a/Cgl/configure.ac +++ b/Cgl/configure.ac @@ -12,7 +12,7 @@ AC_PREREQ(2.59) -AC_INIT([Cgl],[0.60],[cgl@list.coin-or.org]) +AC_INIT([Cgl],[0.60.9],[cgl@list.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. @@ -41,7 +41,7 @@ AC_CANONICAL_BUILD # the source root directory contains definition of where to find those # externals. The following macro ensures that those externals are # retrieved by svn if they are not there yet. -AC_COIN_PROJECTDIR_INIT(Cgl) +AC_COIN_PROJECTDIR_INIT(Cgl,11:9:10) # Check if user wants to produce debugging code AC_COIN_DEBUG_COMPILE(Cgl) diff --git a/Cgl/src/config_cgl_default.h b/Cgl/src/config_cgl_default.h index 7589aa3c..af7845b1 100644 --- a/Cgl/src/config_cgl_default.h +++ b/Cgl/src/config_cgl_default.h @@ -5,7 +5,7 @@ /***************************************************************************/ /* Version number of project */ -#define CGL_VERSION "0.60" +#define CGL_VERSION "0.60.9" /* Major Version number of project */ #define CGL_VERSION_MAJOR 0 @@ -14,4 +14,4 @@ #define CGL_VERSION_MINOR 60 /* Release Version number of project */ -#define CGL_VERSION_RELEASE 9999 +#define CGL_VERSION_RELEASE 9 diff --git a/README.md b/README.md index 88869830..ecf29ed7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Cgl 0.60 +# Cgl 0.60.9 [![A COIN-OR Project](https://coin-or.github.io/coin-or-badge.png)](https://www.coin-or.org) @@ -90,9 +90,9 @@ Code: [![DOI](https://zenodo.org/badge/173502902.svg)](https://zenodo.org/badge/ ## CURRENT BUILD STATUS -[![Windows Builds](https://github.com/coin-or/Cgl/actions/workflows/windows-ci.yml/badge.svg?branch=stable/0.60)](https://github.com/coin-or/Cgl/actions/workflows/windows-ci.yml?query=branch%3Astable/0.60) +[![Windows Builds](https://github.com/coin-or/Cgl/actions/workflows/windows-ci.yml/badge.svg?branch=releases/0.60.9)](https://github.com/coin-or/Cgl/actions/workflows/windows-ci.yml?query=branch%3Areleases/0.60.9) -[![Linux and MacOS Builds](https://github.com/coin-or/Cgl/actions/workflows/linux-ci.yml/badge.svg?branch=stable/0.60)](https://github.com/coin-or/Cgl/actions/workflows/linux-ci.yml?query=branch%3Astable/0.60) +[![Linux and MacOS Builds](https://github.com/coin-or/Cgl/actions/workflows/linux-ci.yml/badge.svg?branch=releases/0.60.9)](https://github.com/coin-or/Cgl/actions/workflows/linux-ci.yml?query=branch%3Areleases/0.60.9) ## DOWNLOAD @@ -183,7 +183,7 @@ following on the command line. ``` wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew chmod u+x coinbrew -./coinbrew fetch Cgl@0.60 +./coinbrew fetch Cgl@0.60.9 ./coinbrew build Cgl ``` For more detailed instructions on coinbrew, see https://coin-or.github.io/coinbrew. @@ -206,10 +206,10 @@ make install If you have `Doxygen` available, you can build a HTML documentation by typing -`make doxygen-docs` +`make doxydoc` in the build directory. If Cgl was built via `coinbrew`, then the build -directory will be `./build/Cgl/0.60` by default. The doxygen documentation main file +directory will be `./build/Cgl/0.60.9` by default. The doxygen documentation main file is found at `/doxydoc/html/index.html`. If you don't have `doxygen` installed locally, you can use also find the diff --git a/configure b/configure index 807623db..b787ceb8 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac 0.9. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Cgl 0.60. +# Generated by GNU Autoconf 2.59 for Cgl 0.60.9. # # Report bugs to . # @@ -430,8 +430,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Cgl' PACKAGE_TARNAME='cgl' -PACKAGE_VERSION='0.60' -PACKAGE_STRING='Cgl 0.60' +PACKAGE_VERSION='0.60.9' +PACKAGE_STRING='Cgl 0.60.9' PACKAGE_BUGREPORT='cgl@lists.coin-or.org' ac_unique_file="configure.ac" @@ -1033,7 +1033,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Cgl 0.60 to adapt to many kinds of systems. +\`configure' configures Cgl 0.60.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1099,7 +1099,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Cgl 0.60:";; + short | recursive ) echo "Configuration of Cgl 0.60.9:";; esac cat <<\_ACEOF @@ -1296,7 +1296,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Cgl configure 0.60 +Cgl configure 0.60.9 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1316,7 +1316,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Cgl $as_me 0.60, which was +It was created by Cgl $as_me 0.60.9, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1823,7 +1823,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) if test x"$CXX" != x; then case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) if test x"$CC" = x; then CC="$CXX" @@ -2644,7 +2644,7 @@ echo "$as_me: error: Failed to find a C compiler!" >&2;} fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cc_g" = yes ; then ac_cv_prog_cc_g=no @@ -2662,7 +2662,7 @@ CFLAGS="$save_cflags" # add automake conditional so we can recognize cl compiler in makefile coin_cc_is_cl=false case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_cc_is_cl=true ;; @@ -2708,7 +2708,7 @@ if test x"$CFLAGS" = x; then case $build in *-cygwin* | *-mingw*) case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL*) if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then coin_opt_cflags='-MD -O2' @@ -3023,7 +3023,7 @@ fi # Correct the LD variable if we are using the MS or Intel-windows compiler case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; @@ -3525,7 +3525,7 @@ fi # Autoconf incorrectly concludes that cl recognises -g. It doesn't. case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* ) if test "$ac_cv_prog_cxx_g" = yes ; then ac_cv_prog_cxx_g=no @@ -3575,7 +3575,7 @@ if test x"$CXXFLAGS" = x; then case $build in *-cygwin* | *-mingw*) case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL*) # The MT and MTd options are mutually exclusive if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then @@ -3898,7 +3898,7 @@ fi # correct the LD variable in a build with MS or Intel-windows compiler case "$CXX" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LD=link ;; @@ -4624,7 +4624,7 @@ else coin_disable_shared=yes if test x"$enable_shared" = xyes; then case "$CC" in - clang* ) + clang* | */clang* ) { echo "$as_me:$LINENO: WARNING: Building of DLLs not supported in this configuration." >&5 echo "$as_me: WARNING: Building of DLLs not supported in this configuration." >&2;} ;; @@ -5073,7 +5073,7 @@ fi # Define the identity of the package. PACKAGE='cgl' - VERSION='0.60' + VERSION='0.60.9' cat >>confdefs.h <<_ACEOF @@ -20586,7 +20586,7 @@ fi # sys_lib_search_path_spec *-cygwin* | *-mingw*) case "$CXX" in - clang* ) + clang* | */clang* ) # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? { echo "$as_me:$LINENO: Applying patches to libtool for CLANG compiler" >&5 echo "$as_me: Applying patches to libtool for CLANG compiler" >&6;} @@ -20785,7 +20785,7 @@ if test "$dependency_linking" = auto; then case $build in *-cygwin* | *-mingw*) case "$CC" in - clang* ) + clang* | */clang* ) dependency_linking=yes ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) @@ -21882,7 +21882,7 @@ echo "$as_me:$LINENO: checking which command should be used to link input files" echo $ECHO_N "checking which command should be used to link input files... $ECHO_C" >&6 coin_link_input_cmd="$LN_S" case "$CC" in - clang* ) ;; + clang* | */clang* ) ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) coin_link_input_cmd=cp ;; esac @@ -21896,7 +21896,7 @@ if test x$coin_skip_ac_output != xyes; then # library extension case "$CC" in - clang* ) + clang* | */clang* ) LIBEXT=a ;; cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) LIBEXT=lib ;; @@ -22399,7 +22399,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by Cgl $as_me 0.60, which was +This file was extended by Cgl $as_me 0.60.9, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22457,7 +22457,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Cgl config.status 0.60 +Cgl config.status 0.60.9 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 79a85046..c86f6c68 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ AC_PREREQ(2.59) -AC_INIT([Cgl],[0.60],[cgl@lists.coin-or.org]) +AC_INIT([Cgl],[0.60.9],[cgl@lists.coin-or.org]) AC_COPYRIGHT([ Copyright 2006 International Business Machines and others. From 11a122633bc40a663829109873cbb6aeac1c1339 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 3 Apr 2019 14:09:26 +0200 Subject: [PATCH 2/3] Add CMake based build - Fix super build (e.g. FetchContent) integration - cmake: option() honors normal variables (CMP0077) --- .gitignore | 3 + CMakeLists.txt | 147 +++++++++++++++++++++++++++++++++++ Cgl/CMakeLists.txt | 159 ++++++++++++++++++++++++++++++++++++++ Cgl/config.h.cmake.in | 114 +++++++++++++++++++++++++++ Cgl/config_cgl.h.cmake.in | 13 ++++ cmake/CheckEnv.cmake | 151 ++++++++++++++++++++++++++++++++++++ cmake/Config.cmake.in | 19 +++++ cmake/ParseAc.cmake | 28 +++++++ 8 files changed, 634 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 Cgl/CMakeLists.txt create mode 100644 Cgl/config.h.cmake.in create mode 100644 Cgl/config_cgl.h.cmake.in create mode 100644 cmake/CheckEnv.cmake create mode 100644 cmake/Config.cmake.in create mode 100644 cmake/ParseAc.cmake diff --git a/.gitignore b/.gitignore index f28ec2dc..86855aff 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ aclocal.m4* acinclude.m4 autom4te* +*.swp +.vs/ +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..8c515615 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,147 @@ +cmake_minimum_required(VERSION 3.16) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +include(ParseAc) +parse_ac(VERSION MAJOR MINOR PATCH) + +project(Cgl VERSION ${VERSION} LANGUAGES CXX C) +set(PROJECT_NAMESPACE coin) +message(STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}") +#message(STATUS "major: ${PROJECT_VERSION_MAJOR}") +#message(STATUS "minor: ${PROJECT_VERSION_MINOR}") +#message(STATUS "patch: ${PROJECT_VERSION_PATCH}") + +# Default Build Type to be Release +get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(isMultiConfig) + if(NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING + "Choose the type of builds, options are: Debug Release RelWithDebInfo MinSizeRel. (default: Release;Debug)" + FORCE) + endif() + message(STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}") +else() + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel. (default: Release)" + FORCE) + endif() + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +endif() + +# Layout build dir like install dir +include(GNUInstallDirs) +set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +set(CMAKE_BUILD_RPATH_USE_ORIGIN ON) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) +if(UNIX) + option(BUILD_SHARED_LIBS "Build shared libraries (.so or .dylib)." ON) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) + # for multi-config build system (e.g. Xcode, Ninja Multi-Config) + foreach(OutputConfig IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER ${OutputConfig} OUTPUTCONFIG) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OutputConfig}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OutputConfig}/${CMAKE_INSTALL_LIBDIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OutputConfig}/${CMAKE_INSTALL_BINDIR}) + endforeach() +else() + # Currently Only support static build for windows + option(BUILD_SHARED_LIBS "Build shared libraries (.dll)." OFF) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) + # for multi-config builds (e.g. msvc) + foreach(OutputConfig IN LISTS CMAKE_CONFIGURATION_TYPES) + string(TOUPPER ${OutputConfig} OUTPUTCONFIG) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OutputConfig}/${CMAKE_INSTALL_BINDIR}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OutputConfig}/${CMAKE_INSTALL_BINDIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OutputConfig}/${CMAKE_INSTALL_BINDIR}) + endforeach() +endif() + +if(MSVC AND BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + +# config options +if(MSVC) + # Build with multiple processes + add_definitions(/MP) + add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE) + # MSVC warning suppressions + add_definitions( + /wd4018 # 'expression' : signed/unsigned mismatch + /wd4065 # switch statement contains 'default' but no 'case' labels + /wd4101 # 'identifier' : unreferenced local variable + /wd4102 # 'label' : unreferenced label + /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data + /wd4267 # 'var' : conversion from 'size_t' to 'type', possible loss of data + /wd4309 # 'conversion' : truncation of constant value + /wd4805 # 'operation' : unsafe mix of type 'type1' and type 'type2' in operation. + /wd4996 # The compiler encountered a deprecated declaration. + ) +endif() +if(APPLE) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override -Wno-unused-command-line-argument -Wno-unused-result -Wno-exceptions" + ) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") +endif() + +# ZLIB +if(NOT TARGET ZLIB::ZLIB) + find_package(ZLIB) +endif() +if(ZLIB_FOUND OR TARGET ZLIB::ZLIB) + message(STATUS "Use zlib") + set(HAVE_ZLIB_H "1" CACHE INTERNAL "Use zlib") + set(COIN_HAS_ZLIB "1" CACHE INTERNAL "Use zlib") +endif() + +# PThread +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads) +if(CMAKE_USE_PTHREADS_INIT) + set(PTHREADS_FOUND TRUE) +else() + set(PTHREADS_FOUND FALSE) +endif() + +# CoinUtils +if(NOT TARGET Coin::CoinUtils) + find_package(CoinUtils REQUIRED CONFIG) +endif() +# Osi +if(NOT TARGET Coin::Osi) + find_package(Osi REQUIRED CONFIG) +endif() +# Clp +if(NOT TARGET Coin::Clp) + find_package(Clp REQUIRED CONFIG) +endif() + +include(CheckEnv) +include(CTest) + +add_subdirectory(Cgl) + +include(GNUInstallDirs) +install(EXPORT ${PROJECT_NAME}Targets + NAMESPACE Coin:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +include(CMakePackageConfigHelpers) +configure_package_config_file(cmake/Config.cmake.in + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +write_basic_package_version_file( + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + COMPATIBILITY SameMajorVersion) +install( + FILES + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + COMPONENT Devel) diff --git a/Cgl/CMakeLists.txt b/Cgl/CMakeLists.txt new file mode 100644 index 00000000..72c763aa --- /dev/null +++ b/Cgl/CMakeLists.txt @@ -0,0 +1,159 @@ +set(NAME "CGL") + +# PTHREAD +if(PTHREADS_FOUND) + set(${NAME}_PTHREADS "1" CACHE INTERNAL "Use pthread") +endif() + +set(COIN_${NAME}_CHECKLEVEL "0" CACHE INTERNAL + "${NAME} check level") +set(COIN_${NAME}_VERBOSITY "0" CACHE INTERNAL + "${NAME} verbosity level") +configure_file(config.h.cmake.in config.h) +configure_file(config_cgl.h.cmake.in config_cgl.h) + +set(_SRCS + src/CglMixedIntegerRounding/CglMixedIntegerRoundingTest.cpp + src/CglMixedIntegerRounding/CglMixedIntegerRounding.cpp + src/CglDuplicateRow/CglDuplicateRow.cpp + src/CglCutGenerator.cpp + src/CglPreProcess/CglPreProcess.cpp + src/CglProbing/CglProbing.cpp + src/CglProbing/CglProbingTest.cpp + src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp + src/CglMixedIntegerRounding2/CglMixedIntegerRounding2Test.cpp + src/CglLandP/CglLandPUtils.cpp + src/CglLandP/CglLandPTest.cpp + src/CglLandP/CglLandPTabRow.cpp + src/CglLandP/CglLandPSimplex.cpp + src/CglLandP/CglLandPValidator.cpp + src/CglLandP/CglLandPMessages.cpp + src/CglLandP/CglLandP.cpp + src/CglOddHole/CglOddHoleTest.cpp + src/CglOddHole/CglOddHole.cpp + src/CglRedSplit/CglRedSplitParam.cpp + src/CglRedSplit/CglRedSplit.cpp + src/CglRedSplit/CglRedSplitTest.cpp + src/CglAllDifferent/CglAllDifferent.cpp + src/CglKnapsackCover/CglKnapsackCoverTest.cpp + src/CglKnapsackCover/CglKnapsackCover.cpp + src/CglSimpleRounding/CglSimpleRoundingTest.cpp + src/CglSimpleRounding/CglSimpleRounding.cpp + src/CglZeroHalf/CglZeroHalfTest.cpp + src/CglZeroHalf/Cgl012cut.cpp + src/CglZeroHalf/CglZeroHalf.cpp + src/CglRedSplit2/CglRedSplit2Test.cpp + src/CglRedSplit2/CglRedSplit2Param.cpp + src/CglRedSplit2/CglRedSplit2.cpp + src/CglMessage.cpp + src/CglStored.cpp + src/CglParam.cpp + src/CglResidualCapacity/CglResidualCapacity.cpp + src/CglResidualCapacity/CglResidualCapacityTest.cpp + src/CglTwomir/CglTwomirTest.cpp + src/CglTwomir/CglTwomir.cpp + src/CglFlowCover/CglFlowCoverTest.cpp + src/CglFlowCover/CglFlowCover.cpp + src/CglClique/CglCliqueHelper.cpp + src/CglClique/CglCliqueTest.cpp + src/CglClique/CglClique.cpp + src/CglTreeInfo.cpp + src/CglLiftAndProject/CglLiftAndProject.cpp + src/CglGomory/CglGomoryTest.cpp + src/CglGomory/CglGomory.cpp + src/CglGMI/CglGMI.cpp + src/CglGMI/CglGMIParam.cpp) + +set(_HDRS + src/CglConfig.h + src/CglMixedIntegerRounding/CglMixedIntegerRounding.hpp + src/CglDuplicateRow/CglDuplicateRow.hpp + src/CglStored.hpp + src/CglPreProcess/CglPreProcess.hpp + src/CglProbing/CglProbing.hpp + src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.hpp + src/CglLandP/CglLandP.hpp + src/CglLandP/CglLandPUtils.hpp + src/CglLandP/CglLandPValidator.hpp + src/CglLandP/CglLandPTabRow.hpp + src/CglLandP/CglLandPMessages.hpp + src/CglLandP/CglLandPSimplex.hpp + src/CglOddHole/CglOddHole.hpp + src/CglRedSplit/CglRedSplitParam.hpp + src/CglRedSplit/CglRedSplit.hpp + src/CglAllDifferent/CglAllDifferent.hpp + src/CglKnapsackCover/CglKnapsackCover.hpp + src/CglSimpleRounding/CglSimpleRounding.hpp + src/CglMessage.hpp + src/CglZeroHalf/CglZeroHalf.hpp + src/CglZeroHalf/Cgl012cut.hpp + src/CglRedSplit2/CglRedSplit2Param.hpp + src/CglRedSplit2/CglRedSplit2.hpp + src/CglCutGenerator.hpp + src/CglResidualCapacity/CglResidualCapacity.hpp + src/CglTwomir/CglTwomir.hpp + src/CglFlowCover/CglFlowCover.hpp + src/CglClique/CglClique.hpp + src/CglLiftAndProject/CglLiftAndProject.hpp + src/CglGomory/CglGomory.hpp + src/CglGMI/CglGMIParam.hpp + src/CglGMI/CglGMI.hpp + src/CglParam.hpp + src/CglTreeInfo.hpp) + +include(GNUInstallDirs) + +add_library(Cgl ${_SRCS} ${_HDRS}) +target_include_directories(Cgl PUBLIC + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $) +target_compile_definitions(Cgl + PUBLIC HAVE_CONFIG_H + PRIVATE CGL_BUILD) +if(CMAKE_VERSION VERSION_LESS "3.8.2") + set_property(TARGET Cgl PROPERTY CXX_STANDARD 11) + set_property(TARGET Cgl PROPERTY CXX_STANDARD_REQUIRED ON) +else() + target_compile_features(Cgl PUBLIC cxx_std_11) +endif() +if(APPLE) + set_target_properties(Cgl PROPERTIES INSTALL_RPATH "@loader_path") +elseif(UNIX) + set_target_properties(Cgl PROPERTIES INSTALL_RPATH "$ORIGIN") +endif() +target_link_libraries(Cgl PUBLIC + Coin::CoinUtils + Coin::Osi + Coin::OsiClp) +set_target_properties(Cgl PROPERTIES + PUBLIC_HEADER "${_HDRS};${CMAKE_CURRENT_BINARY_DIR}/config_cgl.h" + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}) +add_library(Coin::Cgl ALIAS Cgl) + +# Install +install(TARGETS Cgl + EXPORT ${PROJECT_NAME}Targets + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coin + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) diff --git a/Cgl/config.h.cmake.in b/Cgl/config.h.cmake.in new file mode 100644 index 00000000..35329dcd --- /dev/null +++ b/Cgl/config.h.cmake.in @@ -0,0 +1,114 @@ +/*config.h. Generated by configure_file.*/ + +#define COIN_HAS_COINUTILS 1 +#define COIN_HAS_OSI 1 +#define COIN_HAS_OSICLP 1 + +/* VERSION */ +#define VERSION "${VERSION}" +/* ${NAME}_VERSION */ +#define ${NAME}_VERSION "${VERSION}" +/* ${NAME}_VERSION_MAJOR */ +#define ${NAME}_VERSION_MAJOR ${MAJOR} +/* ${NAME}_VERSION_MINOR */ +#define ${NAME}_VERSION_MINOR ${MINOR} +/* ${NAME}_VERSION_RELEASE */ +#define ${NAME}_VERSION_RELEASE ${PATCH} + +/* HAVE_MATH_H */ +#cmakedefine HAVE_MATH_H ${HAVE_MATH_H} +/* HAVE_CTYPE_H */ +#cmakedefine HAVE_CTYPE_H ${HAVE_CTYPE_H} +/* HAVE_INTTYPES_H */ +#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H} +/* HAVE_FLOAT_H */ +#cmakedefine HAVE_FLOAT_H ${HAVE_FLOAT_H} +/* HAVE_IEEEFP_H */ +#cmakedefine HAVE_IEEEFP_H ${HAVE_IEEEFP_H} +/* HAVE_STDARG_H */ +#cmakedefine HAVE_STDARG_H ${HAVE_STDARG_H} +/* HAVE_STDDEF_H */ +#cmakedefine HAVE_STDDEF_H ${HAVE_STDDEF_H} +/* HAVE_STDINT_H */ +#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} +/* HAVE_STDIO_H */ +#cmakedefine HAVE_STDIO_H ${HAVE_STDIO_H} +/* HAVE_STDLIB_H */ +#cmakedefine HAVE_STDLIB_H ${HAVE_STDLIB_H} +/* HAVE_ASSERT_H */ +#cmakedefine HAVE_ASSERT_H ${HAVE_ASSERT_H} +/* HAVE_DLFCN_H */ +#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} +/* HAVE_ENDIAN_H */ +#cmakedefine HAVE_ENDIAN_H ${HAVE_ENDIAN_H} +/* HAVE_MEMORY_H */ +#cmakedefine HAVE_MEMORY_H ${HAVE_MEMORY_H} +/* HAVE_STRINGS_H */ +#cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H} +/* HAVE_STRING_H */ +#cmakedefine HAVE_STRING_H ${HAVE_STRING_H} +/* HAVE_TIME_H */ +#cmakedefine HAVE_TIME_H ${HAVE_TIME_H} +/* HAVE_UNISTD_H */ +#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} +/* HAVE_SYS_STAT_H */ +#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H} +/* HAVE_SYS_TYPES_H */ +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} + +/* HAVE_CMATH */ +#cmakedefine HAVE_CMATH ${HAVE_CMATH} +/* HAVE_CCTYPE */ +#cmakedefine HAVE_CCTYPE ${HAVE_CCTYPE} +/* HAVE_CINTTYPES */ +#cmakedefine HAVE_CINTTYPES ${HAVE_CINTTYPES} +/* HAVE_CFLOAT */ +#cmakedefine HAVE_CFLOAT ${HAVE_CFLOAT} +/* HAVE_CIEEEFP */ +#cmakedefine HAVE_CIEEEFP ${HAVE_CIEEEFP} +/* HAVE_CSTDARG */ +#cmakedefine HAVE_CSTDARG ${HAVE_CSTDARG} +/* HAVE_CSTDDEF */ +#cmakedefine HAVE_CSTDDEF ${HAVE_CSTDDEF} +/* HAVE_CSTDINT */ +#cmakedefine HAVE_CSTDINT ${HAVE_CSTDINT} +/* HAVE_CSTDIO */ +#cmakedefine HAVE_CSTDIO ${HAVE_CSTDIO} +/* HAVE_CSTDLIB */ +#cmakedefine HAVE_CSTDLIB ${HAVE_CSTDLIB} +/* HAVE_CASSERT */ +#cmakedefine HAVE_CASSERT ${HAVE_CASSERT} +/* HAVE_CSTRING */ +#cmakedefine HAVE_CSTRING ${HAVE_CSTRING} +/* HAVE_CTIME */ +#cmakedefine HAVE_CTIME ${HAVE_CTIME} + +/* COIN_C_FINITE */ +#cmakedefine COIN_C_FINITE ${COIN_C_FINITE} +/* COIN_C_ISNAN */ +#cmakedefine COIN_C_ISNAN ${COIN_C_ISNAN} +/* COIN_INT64_T */ +#cmakedefine COIN_INT64_T ${COIN_INT64_T} +/* COIN_UINT64_T */ +#cmakedefine COIN_UINT64_T ${COIN_UINT64_T} +/* COIN_INTPTR_T */ +#cmakedefine COIN_INTPTR_T ${COIN_INTPTR_T} + +/* COIN_${NAME}_CHECKLEVEL */ +#define COIN_${NAME}_CHECKLEVEL ${COIN_${NAME}_CHECKLEVEL} +/* COIN_${NAME}_VERBOSITY */ +#define COIN_${NAME}_VERBOSITY ${COIN_${NAME}_VERBOSITY} + +/* PACKAGE */ +#cmakedefine PACKAGE +/* PACKAGE_NAME */ +#cmakedefine PACKAGE_NAME +/* PACKAGE_VERSION */ +#cmakedefine PACKAGE_VERSION +/* PACKAGE_STRING */ +#cmakedefine PACKAGE_STRING +/* PACKAGE_TARNAME */ +#cmakedefine PACKAGE_TARNAME +/* PACKAGE_BUGREPORT */ +#cmakedefine PACKAGE_BUGREPORT + diff --git a/Cgl/config_cgl.h.cmake.in b/Cgl/config_cgl.h.cmake.in new file mode 100644 index 00000000..8dc44bf9 --- /dev/null +++ b/Cgl/config_cgl.h.cmake.in @@ -0,0 +1,13 @@ +#ifndef __CONFIG_${NAME}_H__ +#define __CONFIG_${NAME}_H__ + +/* ${NAME}_VERSION */ +#define ${NAME}_VERSION "${VERSION}" +/* ${NAME}_VERSION_MAJOR */ +#define ${NAME}_VERSION_MAJOR ${MAJOR} +/* ${NAME}_VERSION_MINOR */ +#define ${NAME}_VERSION_MINOR ${MINOR} +/* ${NAME}_VERSION_RELEASE */ +#define ${NAME}_VERSION_RELEASE ${PATCH} + +#endif diff --git a/cmake/CheckEnv.cmake b/cmake/CheckEnv.cmake new file mode 100644 index 00000000..b2477025 --- /dev/null +++ b/cmake/CheckEnv.cmake @@ -0,0 +1,151 @@ +# Flags +include (CheckIncludeFile) +check_include_file(math.h HAVE_MATH_H) +check_include_file(ctype.h HAVE_CTYPE_H) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(float.h HAVE_FLOAT_H) +check_include_file(ieeefp.h HAVE_IEEEFP_H) +check_include_file(stdarg.h HAVE_STDARG_H) +check_include_file(stddef.h HAVE_STDDEF_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stdio.h HAVE_STDIO_H) +check_include_file(stdlib.h HAVE_STDLIB_H) +check_include_file(assert.h HAVE_ASSERT_H) +check_include_file(dlfcn.h HAVE_DLFCN_H) +check_include_file(endian.h HAVE_ENDIAN_H) +check_include_file(memory.h HAVE_MEMORY_H) +check_include_file(strings.h HAVE_STRINGS_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(time.h HAVE_TIME_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(sys/stat.h HAVE_SYS_STAT_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) + +include (CheckIncludeFileCXX) +check_include_file_cxx(cmath HAVE_CMATH) +check_include_file_cxx(cctype HAVE_CCTYPE) +check_include_file_cxx(cinttypes HAVE_CINTTYPES) +check_include_file_cxx(cfloat HAVE_CFLOAT) +check_include_file_cxx(cieeefp HAVE_CIEEEFP) +check_include_file_cxx(cstdarg HAVE_CSTDARG) +check_include_file_cxx(cstddef HAVE_CSTDDEF) +check_include_file_cxx(cstdint HAVE_CSTDINT) +check_include_file_cxx(cstdio HAVE_CSTDIO) +check_include_file_cxx(cstdlib HAVE_CSTDLIB) +check_include_file_cxx(cassert HAVE_CASSERT) +check_include_file_cxx(cstring HAVE_CSTRING) +check_include_file_cxx(ctime HAVE_CTIME) + +set(STDC_HEADERS 1 CACHE INTERNAL "System has ANSI C header files") + +set(TEST_INCLUDES "") +if(HAVE_CMATH) + list(APPEND TEST_INCLUDES "cmath") +endif() +if(HAVE_CFLOAT) + list(APPEND TEST_INCLUDES "cfloat") +endif() +if(HAVE_CIEEEFP) + list(APPEND TEST_INCLUDES "cieeefp") +endif() +if(HAVE_MATH_H) + list(APPEND TEST_INCLUDES "math.h") +endif() +if(HAVE_FLOAT_H) + list(APPEND TEST_INCLUDES "float.h") +endif() +if(HAVE_IEEEFP_H) + list(APPEND TEST_INCLUDES "ieeefp.h") +endif() + +# ISFINITE +include(CheckCXXSourceCompiles) +check_cxx_source_compiles( + "#include \nint main(){return std::isfinite(0);}" + HAVE_STD_ISFINITE) +include(CheckFunctionExists) +include(CheckCXXSymbolExists) +check_cxx_symbol_exists(isfinite "${TEST_INCLUDES}" HAVE_ISFINITE) +check_cxx_symbol_exists(finite "${TEST_INCLUDES}" HAVE_FINITE) +check_cxx_symbol_exists(_finite "${TEST_INCLUDES}" HAVE__FINITE) +check_cxx_symbol_exists(__finite "${TEST_INCLUDES}" HAVE___FINITE) +if(HAVE_STD_ISFINITE) + set(COIN_C_FINITE "std::isfinite") +elseif(HAVE_ISFINITE) + set(COIN_C_FINITE "isfinite") +elseif(HAVE_FINITE) + set(COIN_C_FINITE "finite") +elseif(HAVE__FINITE) + set(COIN_C_FINITE "_finite") +elseif(HAVE___FINITE) + set(COIN_C_FINITE "__finite") +else() + message(FATAL_ERROR "Can't find isfinite()") +endif() +message(STATUS "Found isfinite: ${COIN_C_FINITE}") + +# ISNAN +include(CheckCXXSourceCompiles) +check_cxx_source_compiles( + "#include \nint main(){return std::isnan(0);}" + HAVE_STD_ISNAN) +include(CheckFunctionExists) +include(CheckCXXSymbolExists) +check_cxx_symbol_exists(isnan "${TEST_INCLUDES}" HAVE_ISNAN) +check_cxx_symbol_exists(_isnan "${TEST_INCLUDES}" HAVE__ISNAN) +check_cxx_symbol_exists(__isnan "${TEST_INCLUDES}" HAVE___ISNAN) +if(HAVE_STD_ISNAN) + set(COIN_C_ISNAN "std::isnan") +elseif(HAVE_ISNAN) + set(COIN_C_ISNAN "isnan") +elseif(HAVE__ISNAN) + set(COIN_C_ISNAN "_isnan") +elseif(HAVE___ISNAN) + set(COIN_C_ISNAN "__isnan") +else() + message(FATAL_ERROR "Can't find isnan()") +endif() +message(STATUS "Found isnan: ${COIN_C_ISNAN}") + +# Basic type +include(CheckTypeSize) +check_type_size("int64_t" SIZEOF_INT64_T) +check_type_size("long long" SIZEOF_LONG_LONG) +check_type_size("long" SIZEOF_LONG) +check_type_size("uint64_t" SIZEOF_UINT64_T) +check_type_size("unsigned long long" SIZEOF_ULONG_LONG) +check_type_size("unsigned long" SIZEOF_ULONG) +check_type_size("intptr_t" SIZEOF_INTPTR_T) +check_type_size("int *" SIZEOF_INT_P) + +if(SIZEOF_INT64_T EQUAL "8") + set(COIN_INT64_T "int64_t") +elseif(SIZEOF_LONG EQUAL "8") + set(COIN_INT64_T "long") +elseif(SIZEOF_LONG_LONG EQUAL "8") + set(COIN_INT64_T "long long") +else() + message(FATAL_ERROR "Can't find suitable int64_t") +endif() +message(STATUS "Found int64_t: ${COIN_INT64_T}") + +if(SIZEOF_UINT64_T EQUAL "8") + set(COIN_UINT64_T "uint64_t") +elseif(SIZEOF_ULONG EQUAL "8") + set(COIN_INT64_T "unsigned long") +elseif(SIZEOF_ULONG_LONG EQUAL "8") + set(COIN_INT64_T "unsigned long long") +else() + message(FATAL_ERROR "Can't find suitable uint64_t") +endif() +message(STATUS "Found uint64_t: ${COIN_UINT64_T}") + +if(SIZEOF_INTPTR_T) + set(COIN_INTPTR_T "intptr_t") +elseif(SIZEOF_INT_P) + set(COIN_INTPTR_T "int *") +else() + message(FATAL_ERROR "Can't find suitable intptr_t") +endif() +message(STATUS "Found intptr_t: ${COIN_INTPTR_T}") + diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in new file mode 100644 index 00000000..313f4988 --- /dev/null +++ b/cmake/Config.cmake.in @@ -0,0 +1,19 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +if(@ZLIB_FOUND@) + find_dependency(ZLIB REQUIRED) +endif() + +if(@PTHREADS_FOUND@) + find_dependency(Threads REQUIRED) +endif() + +if(${CMAKE_VERSION} VERSION_LESS "3.9.6") + find_dependency(Clp REQUIRED) +else() + find_dependency(Clp REQUIRED CONFIG) +endif() + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/cmake/ParseAc.cmake b/cmake/ParseAc.cmake new file mode 100644 index 00000000..55057d44 --- /dev/null +++ b/cmake/ParseAc.cmake @@ -0,0 +1,28 @@ +function(parse_ac VERSION_STRING VERSION_MAJOR VERSION_MINOR VERSION_PATCH) + file(READ "configure.ac" IN) + if(IN MATCHES "AC_INIT\\(.*trunk.*\\)") + message(WARNING "using trunk...") + set(MAJOR 999) + set(MINOR 0) + set(PATCH 0) + else() + # AC_INIT([Cgl],[major.minor.patch or trunk],[url or email]) + string(REGEX MATCH + "AC_INIT\\([^,]+,\\[([0-9]+)\\.([0-9]+)(\\.([0-9]+))?\\],[^\\)]+\\)" AC_INIT ${IN}) + message(STATUS "AC_INIT: ${AC_INIT}") + set(MAJOR ${CMAKE_MATCH_1}) + set(MINOR ${CMAKE_MATCH_2}) + if(CMAKE_MATCH_3) + set(PATCH ${CMAKE_MATCH_4}) + else() + set(PATCH 0) + endif() + endif() + set(VERSION "${MAJOR}.${MINOR}.${PATCH}") + + set(${VERSION_MAJOR} ${MAJOR} PARENT_SCOPE) + set(${VERSION_MINOR} ${MINOR} PARENT_SCOPE) + set(${VERSION_PATCH} ${PATCH} PARENT_SCOPE) + set(${VERSION_STRING} ${VERSION} PARENT_SCOPE) + message(STATUS "version: ${VERSION}") +endfunction() From f9504202d798b0c41a48cda068fc83e8a287c2e0 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 3 Apr 2019 14:03:57 +0200 Subject: [PATCH 3/3] Add CMake CI --- .dockerignore | 21 +++ .github/workflows/amd64_docker.yml | 45 +++++ .github/workflows/amd64_linux.yml | 81 +++++++++ .github/workflows/amd64_macos.yml | 76 +++++++++ .github/workflows/amd64_windows.yml | 77 +++++++++ .github/workflows/arm64_macos.yml | 76 +++++++++ ci/Makefile | 252 ++++++++++++++++++++++++++++ ci/docker/almalinux/Dockerfile | 65 +++++++ ci/docker/alpine/Dockerfile | 60 +++++++ ci/docker/archlinux/Dockerfile | 60 +++++++ ci/docker/debian/Dockerfile | 63 +++++++ ci/docker/fedora/Dockerfile | 64 +++++++ ci/docker/opensuse/Dockerfile | 63 +++++++ ci/docker/rockylinux/Dockerfile | 65 +++++++ ci/docker/ubuntu/Dockerfile | 65 +++++++ ci/sample/CMakeLists.txt | 22 +++ ci/sample/main.cpp | 12 ++ 17 files changed, 1167 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/amd64_docker.yml create mode 100644 .github/workflows/amd64_linux.yml create mode 100644 .github/workflows/amd64_macos.yml create mode 100644 .github/workflows/amd64_windows.yml create mode 100644 .github/workflows/arm64_macos.yml create mode 100644 ci/Makefile create mode 100644 ci/docker/almalinux/Dockerfile create mode 100644 ci/docker/alpine/Dockerfile create mode 100644 ci/docker/archlinux/Dockerfile create mode 100644 ci/docker/debian/Dockerfile create mode 100644 ci/docker/fedora/Dockerfile create mode 100644 ci/docker/opensuse/Dockerfile create mode 100644 ci/docker/rockylinux/Dockerfile create mode 100644 ci/docker/ubuntu/Dockerfile create mode 100644 ci/sample/CMakeLists.txt create mode 100644 ci/sample/main.cpp diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..cbad1428 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +# Project Files unneeded by docker +ci/cache +ci/docker +.git +.gitignore +.github +.dockerignore +.travis.yml +.clang-format +AUTHORS +INSTALL +install-sh +missing +README +README.md + +build/ + +# Editor directories and files +*.user +*.swp diff --git a/.github/workflows/amd64_docker.yml b/.github/workflows/amd64_docker.yml new file mode 100644 index 00000000..41b7cfad --- /dev/null +++ b/.github/workflows/amd64_docker.yml @@ -0,0 +1,45 @@ +# ref: https://github.com/docker-library/official-images +name: amd64 Docker + +on: [push, pull_request, workflow_dispatch] + +jobs: + docker: + strategy: + matrix: + distro: [ + almalinux, + alpine, + archlinux, + debian, + fedora, + opensuse, + rockylinux, + ubuntu + ] + fail-fast: false + name: amd64 • ${{ matrix.distro }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check docker + run: | + docker info + docker buildx ls + - name: Build env image + run: make --directory=ci amd64_${{ matrix.distro }}_env + - name: Build devel project + run: make --directory=ci amd64_${{ matrix.distro }}_devel + - name: Build project + run: make --directory=ci amd64_${{ matrix.distro }}_build + - name: Test project + run: make --directory=ci amd64_${{ matrix.distro }}_test + + - name: Build install env image + run: make --directory=ci amd64_${{ matrix.distro }}_install_env + - name: Build install devel project + run: make --directory=ci amd64_${{ matrix.distro }}_install_devel + - name: Build install project + run: make --directory=ci amd64_${{ matrix.distro }}_install_build + - name: Test install project + run: make --directory=ci amd64_${{ matrix.distro }}_install_test diff --git a/.github/workflows/amd64_linux.yml b/.github/workflows/amd64_linux.yml new file mode 100644 index 00000000..aeea7cb3 --- /dev/null +++ b/.github/workflows/amd64_linux.yml @@ -0,0 +1,81 @@ +# ref: https://github.com/actions/runner-images +name: amd64 Linux + +on: [push, pull_request, workflow_dispatch] + +# Building using the github runner environement directly. +jobs: + native: + strategy: + matrix: + cmake: [ + {generator: "Unix Makefiles", config: "Release"}, + {generator: "Ninja", config: "Release"}, + {generator: "Ninja Multi-Config", config: "Release"}, + ] + fail-fast: false + name: Linux • ${{ matrix.cmake.generator }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Ninja + run: | + sudo apt-get update + sudo apt-get install ninja-build + - name: Check cmake + run: cmake --version + - name: Install CoinUtils + run: > + cd /tmp + && git clone -b stable/2.11 --depth=1 https://github.com/Mizux/CoinUtils.git + && cd CoinUtils + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf CoinUtils + - name: Install Osi + run: > + cd /tmp + && git clone -b stable/0.108 --depth=1 https://github.com/Mizux/Osi.git + && cd Osi + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf Osi + - name: Install Clp + run: > + cd /tmp + && git clone -b stable/1.17 --depth=1 https://github.com/Mizux/Clp.git + && cd Clp + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf Clp + - name: Configure + run: > + cmake -S. -Bbuild + -G "${{ matrix.cmake.generator }}" + -DCMAKE_BUILD_TYPE="$BUILD_TYPE" + -DCMAKE_INSTALL_PREFIX=build/install + - name: Build + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target all + -v -j2 + - name: Test + run: > + CTEST_OUTPUT_ON_FAILURE=1 + cmake --build build + --config ${{ matrix.cmake.config }} + --target test + -v + - name: Install + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target install + -v diff --git a/.github/workflows/amd64_macos.yml b/.github/workflows/amd64_macos.yml new file mode 100644 index 00000000..fd1c9585 --- /dev/null +++ b/.github/workflows/amd64_macos.yml @@ -0,0 +1,76 @@ +# ref: https://github.com/actions/runner-images +name: amd64 MacOS + +on: [push, pull_request, workflow_dispatch] + +# Building using the github runner environement directly. +jobs: + native: + strategy: + matrix: + cmake: [ + {generator: "Xcode", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: install}, + {generator: "Unix Makefiles", config: Release, build_target: all, test_target: test, install_target: install}, + ] + fail-fast: false + name: MacOS • ${{ matrix.cmake.generator }} + runs-on: macos-13 # last macos intel based runner + steps: + - uses: actions/checkout@v4 + - name: Check cmake + run: cmake --version + - name: Install CoinUtils + run: > + cd /tmp + && git clone -b stable/2.11 --depth=1 https://github.com/Mizux/CoinUtils.git + && cd CoinUtils + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf CoinUtils + - name: Install Osi + run: > + cd /tmp + && git clone -b stable/0.108 --depth=1 https://github.com/Mizux/Osi.git + && cd Osi + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf Osi + - name: Install Clp + run: > + cd /tmp + && git clone -b stable/1.17 --depth=1 https://github.com/Mizux/Clp.git + && cd Clp + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf Clp + - name: Configure + run: > + cmake -S. -Bbuild + -G "${{ matrix.cmake.generator }}" + -DCMAKE_BUILD_TYPE=${{ matrix.cmake.config }} + -DCMAKE_INSTALL_PREFIX=build/install + - name: Build + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.build_target }} + -v -j2 + - name: Test + run: > + CTEST_OUTPUT_ON_FAILURE=1 + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.test_target }} + -v + - name: Install + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.install_target }} + -v diff --git a/.github/workflows/amd64_windows.yml b/.github/workflows/amd64_windows.yml new file mode 100644 index 00000000..a0993e45 --- /dev/null +++ b/.github/workflows/amd64_windows.yml @@ -0,0 +1,77 @@ +# ref: https://github.com/actions/runner-images +name: amd64 Windows + +on: [push, pull_request, workflow_dispatch] + +# Building using the github runner environement directly. +jobs: + native: + strategy: + matrix: + cmake: [ + {generator: "Visual Studio 17 2022", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: INSTALL}, + {generator: "Visual Studio 17 2022", config: Debug, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: INSTALL}, + ] + fail-fast: false + name: Windows • ${{ matrix.cmake.generator }} (${{ matrix.cmake.config }}) + runs-on: windows-latest + env: + CTEST_OUTPUT_ON_FAILURE: 1 + steps: + - uses: actions/checkout@v4 + - name: Check cmake + run: | + cmake --version + cmake -G || true + - name: Install CoinUtils + run: > + git clone -b stable/2.11 --depth=1 https://github.com/Mizux/CoinUtils.git + && cd CoinUtils + && cmake -S. -Bbuild + && cmake --build build --config ${{ matrix.cmake.config }} + && cmake --build build --config ${{ matrix.cmake.config }} --target install + && cd .. + && Remove-Item CoinUtils -Recurse -Include *.* + - name: Install Osi + run: > + git clone -b stable/0.108 --depth=1 https://github.com/Mizux/Osi.git + && cd Osi + && cmake -S. -Bbuild + && cmake --build build --config ${{ matrix.cmake.config }} + && cmake --build build --config ${{ matrix.cmake.config }} --target install + && cd .. + && Remove-Item Osi -Recurse -Include *.* + - name: Install Clp + run: > + git clone -b stable/1.17 --depth=1 https://github.com/Mizux/Clp.git + && cd Clp + && cmake -S. -Bbuild + && cmake --build build --config ${{ matrix.cmake.config }} + && cmake --build build --config ${{ matrix.cmake.config }} --target install + && cd .. + && Remove-Item Clp -Recurse -Include *.* + - name: Configure + run: > + cmake -S. -Bbuild + -G "${{ matrix.cmake.generator }}" + -DCMAKE_CONFIGURATION_TYPES=${{ matrix.cmake.config }} + -DBUILD_DEPS=ON + -DCMAKE_INSTALL_PREFIX=build/install + - name: Build + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.build_target }} + -v -j2 + - name: Test + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.test_target }} + -v + - name: Install + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.install_target }} + -v diff --git a/.github/workflows/arm64_macos.yml b/.github/workflows/arm64_macos.yml new file mode 100644 index 00000000..848ea549 --- /dev/null +++ b/.github/workflows/arm64_macos.yml @@ -0,0 +1,76 @@ +# ref: https://github.com/actions/runner-images +name: arm64 MacOS + +on: [push, pull_request, workflow_dispatch] + +# Building using the github runner environement directly. +jobs: + native: + strategy: + matrix: + cmake: [ + {generator: "Xcode", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: install}, + {generator: "Unix Makefiles", config: Release, build_target: all, test_target: test, install_target: install}, + ] + fail-fast: false + name: MacOS • ${{ matrix.cmake.generator }} + runs-on: macos-latest # macos M1 based runner + steps: + - uses: actions/checkout@v4 + - name: Check cmake + run: cmake --version + - name: Install CoinUtils + run: > + cd /tmp + && git clone -b stable/2.11 --depth=1 https://github.com/Mizux/CoinUtils.git + && cd CoinUtils + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf CoinUtils + - name: Install Osi + run: > + cd /tmp + && git clone -b stable/0.108 --depth=1 https://github.com/Mizux/Osi.git + && cd Osi + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf Osi + - name: Install Clp + run: > + cd /tmp + && git clone -b stable/1.17 --depth=1 https://github.com/Mizux/Clp.git + && cd Clp + && cmake -S. -Bbuild + && cmake --build build --config Release + && sudo cmake --build build --config Release --target install + && cd .. + && rm -rf Clp + - name: Configure + run: > + cmake -S. -Bbuild + -G "${{ matrix.cmake.generator }}" + -DCMAKE_BUILD_TYPE=${{ matrix.cmake.config }} + -DCMAKE_INSTALL_PREFIX=build/install + - name: Build + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.build_target }} + -v -j2 + - name: Test + run: > + CTEST_OUTPUT_ON_FAILURE=1 + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.test_target }} + -v + - name: Install + run: > + cmake --build build + --config ${{ matrix.cmake.config }} + --target ${{ matrix.cmake.install_target }} + -v diff --git a/ci/Makefile b/ci/Makefile new file mode 100644 index 00000000..627597e3 --- /dev/null +++ b/ci/Makefile @@ -0,0 +1,252 @@ +PROJECT := cgl +BRANCH := $(shell git rev-parse --abbrev-ref HEAD) +SHA1 := $(shell git rev-parse --verify HEAD) + +# General commands +.PHONY: help +BOLD:=\e[1m +RESET:=\e[0m + +help: + @echo -e "${BOLD}SYNOPSIS${RESET}" + @echo -e "\tmake [NOCACHE=1] [VERBOSE=1]" + @echo + @echo -e "${BOLD}DESCRIPTION${RESET}" + @echo -e "\ttest build inside docker container to have a reproductible build." + @echo + @echo -e "${BOLD}MAKE TARGETS${RESET}" + @echo -e "\t${BOLD}help${RESET}: display this help and exit." + @echo + @echo -e "\tBuild using docker and the host platform." + @echo -e "\t${BOLD}_${RESET}: build a docker image for a specific distro." + @echo -e "\t${BOLD}save__${RESET}: Save a docker image for a specific distro." + @echo -e "\t${BOLD}sh__${RESET}: run a container using the docker image specified (debug purpose)." + @echo -e "\t${BOLD}clean__${RESET}: Remove a docker image for a specific distro." + @echo -e "\t${BOLD}clean_native${RESET}: Remove ALL caches and docker images." + @echo + @echo -e "\tWith ${BOLD}${RESET}:" + @echo -e "\t\t${BOLD}almalinux${RESET} (latest)" + @echo -e "\t\t${BOLD}alpine${RESET} (edge)" + @echo -e "\t\t${BOLD}archlinux${RESET} (latest)" + @echo -e "\t\t${BOLD}debian${RESET} (latest)" + @echo -e "\t\t${BOLD}fedora${RESET} (latest)" + @echo -e "\t\t${BOLD}opensuse${RESET} (tumbleweed)" + @echo -e "\t\t${BOLD}rockylinux${RESET} (9)" + @echo -e "\t\t${BOLD}ubuntu${RESET} (latest)" + @echo -e "\t\t${BOLD}all${RESET}: trigger ALL DISTROS." + @echo + @echo -e "\tWith ${BOLD}${RESET}:" + @echo -e "\t\t${BOLD}env${RESET}" + @echo -e "\t\t${BOLD}devel${RESET}" + @echo -e "\t\t${BOLD}build${RESET}" + @echo -e "\t\t${BOLD}test${RESET}" + @echo -e "\t\t${BOLD}install_env${RESET}" + @echo -e "\t\t${BOLD}install_devel${RESET}" + @echo -e "\t\t${BOLD}install_build${RESET}" + @echo -e "\t\t${BOLD}install_test${RESET}" + @echo -e "\te.g. 'make ubuntu_test'" + @echo + @echo -e "\tBuild using docker buildx with a platform specified." + @echo -e "\t${BOLD}_${RESET}: build docker images for ALL DISTROS." + @echo -e "\t${BOLD}__${RESET}: build docker image for a specific distro." + @echo -e "\t${BOLD}save__${RESET}: Save docker images for ALL DISTROS." + @echo -e "\t${BOLD}save___${RESET}: Save the docker image for a specific distro." + @echo -e "\t${BOLD}sh___${RESET}: run a container using the docker image specified (debug purpose)." + @echo -e "\t${BOLD}clean___${RESET}: Remove cache and docker image." + @echo -e "\t${BOLD}clean_platforms${RESET}: Remove ALL cache and docker image." + @echo + @echo -e "\tWith ${BOLD}${RESET}:" + @echo -e "\t\t${BOLD}amd64${RESET}: linux/amd64 (x86_64)" + @echo -e "\t\t${BOLD}386${RESET}: linux/386 (x86)" + @echo -e "\t\t${BOLD}arm${RESET}: linux/arm (armv7)" + @echo -e "\t\t${BOLD}arm64${RESET}: linux/arm64 (aarch64, arm64v8)" + @echo -e "\t\t${BOLD}mips${RESET}: linux/mips (mips 32bits)" + @echo -e "\t\t${BOLD}mipsle${RESET}: linux/mipsle (mips 32bits Little Endian)" + @echo -e "\t\t${BOLD}mips64${RESET}: linux/mips64 (mips 64bits)" + @echo -e "\t\t${BOLD}mips64le${RESET}: linux/mips64le (mips 64bits Little Endian)" + @echo -e "\t\t${BOLD}ppc64${RESET}: linux/ppc64 (PowerPC 64Bits)" + @echo -e "\t\t${BOLD}ppc64le${RESET}: linux/ppc64le (PowerPC 64Bits Little Endian)" + @echo -e "\t\t${BOLD}riscv64${RESET}: linux/riscv64 (RISC-V 64bits)" + @echo -e "\t\t${BOLD}s390x${RESET}: linux/s390x (IBM System/390x)" + @echo -e "\te.g. 'make amd64_ubuntu_test'" + @echo -e "\tDocker image unavailable: arm64_archlinux" + @echo + @echo -e "\tGlobal targets." + @echo -e "\t${BOLD}clean${RESET}: Remove ALL caches and docker images." + @echo -e "\t${BOLD}distclean${RESET}: Remove everything." + @echo + @echo -e "\t${BOLD}NOCACHE=1${RESET}: use 'docker build --no-cache' when building container (default use cache)." + @echo -e "\t${BOLD}VERBOSE=1${RESET}: use 'docker build --progress=plain' when building container." + @echo + @echo -e "branch: $(BRANCH)" + @echo -e "sha1: $(SHA1)" + +# Need to add cmd_distro to PHONY otherwise target are ignored since they do not +# contain recipe (using FORCE do not work here) +.PHONY: all +all: all_test + +# Delete all implicit rules to speed up makefile +MAKEFLAGS += --no-builtin-rules +.SUFFIXES: +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES := +# Keep all intermediate files +# ToDo: try to remove it later +.SECONDARY: + +# Docker image name prefix. +IMAGE := ${PROJECT} + +DOCKER_BUILD_CMD := docker build +DOCKER_BUILDX_CMD := docker buildx build +ifdef NOCACHE +DOCKER_BUILD_CMD := ${DOCKER_BUILD_CMD} --no-cache +DOCKER_BUILDX_CMD := ${DOCKER_BUILDX_CMD} --no-cache +endif +ifdef VERBOSE +DOCKER_BUILD_CMD := ${DOCKER_BUILD_CMD} --progress=plain +DOCKER_BUILDX_CMD := ${DOCKER_BUILDX_CMD} --progress=plain +endif +DOCKER_RUN_CMD := docker run --rm --init --net=host + +# Currently supported distro +DISTROS := \ + almalinux \ + alpine \ + archlinux \ + debian \ + fedora \ + opensuse \ + rockylinux \ + ubuntu + +# $* stem +# $< first prerequist +# $@ target name + +############ +## STAGES ## +############ +STAGES := env devel build test install_env install_devel install_build install_test + +define make-stage-target = +#$$(info STAGE: $1) +#$$(info Create targets: all_$1 $(addsuffix _$1, $(DISTROS)).) +targets_$1 := $(addsuffix _$1, $(DISTROS)) +.PHONY: all_$1 $$(targets_$1) +all_$1: $$(targets_$1) +$$(targets_$1): %_$1: docker/%/Dockerfile + #@docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null + ${DOCKER_BUILD_CMD} --target=$1 --tag ${IMAGE}:$$*_$1 -f $$< .. + +#$$(info Create targets: save_all_$1 $(addprefix save_, $(addsuffix _$1, $(DISTROS))) (debug).) +save_targets_$1 := $(addprefix save_, $(addsuffix _$1, $(DISTROS))) +.PHONY: save_all_$1 $$(save_targets_$1) +save_all_$1: $$(save_targets_$1) +$$(save_targets_$1): save_%_$1: cache/%/docker_$1.tar +cache/%/docker_$1.tar: %_$1 + @rm -f $$@ + mkdir -p cache/$$* + docker save ${IMAGE}:$$*_$1 -o $$@ + +#$$(info Create targets: $(addprefix sh_, $(addsuffix _$1, $(DISTROS))) (debug).) +sh_targets_$1 := $(addprefix sh_, $(addsuffix _$1, $(DISTROS))) +.PHONY: $$(sh_targets_$1) +$$(sh_targets_$1): sh_%_$1: %_$1 + ${DOCKER_RUN_CMD} -it --name ${IMAGE}_$$*_$1 ${IMAGE}:$$*_$1 + +#$$(info Create targets: clean_all_$1 $(addprefix clean_, $(addsuffix _$1, $(DISTROS))).) +clean_targets_$1 := $(addprefix clean_, $(addsuffix _$1, $(DISTROS))) +.PHONY: clean_all_$1 $$(clean_targets_$1) +clean_all_$1: $$(clean_targets_$1) +$$(clean_targets_$1): clean_%_$1: + docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null + rm -f cache/$$*/docker_$1.tar +endef + +$(foreach stage,$(STAGES),$(eval $(call make-stage-target,$(stage)))) + +## MERGE ## +.PHONY: clean_all +clean_all: $(addprefix clean_all_, $(STAGES)) + rm -f $(addprefix cache/, $(DISTROS)) + +############## +## PLATFORM ## +############## +# ref: https://go.dev/doc/install/source#environment +# ref: https://github.com/containerd/containerd/blob/269548fa27e0089a8b8278fc4fc781d7f65a939b/platforms/platforms.go#L80-L94 +PLATFORMS := \ + 386 amd64 \ + arm arm64 \ + mips mipsle mips64 mips64le \ + ppc64 ppc64le \ + riscv64 \ + s390x + +define make-platform-stage-target = +#$$(info PLATFORM: '$1' STAGE: '$2') +#$$(info Create targets: $1_all_$2 $(addprefix $1_, $(addsuffix _$2, $(DISTROS))).) +targets_$1_$2 := $(addprefix $1_, $(addsuffix _$2, $(DISTROS))) +.PHONY: $1_all_$2 $$(targets_$1_$2) +$1_all_$2: $$(targets_$1_$2) +$$(targets_$1_$2): $1_%_$2: docker/%/Dockerfile + #@docker image rm -f ${IMAGE}:$1_$$*_$2 2>/dev/null + ${DOCKER_BUILDX_CMD} --platform linux/$1 --target=$2 --tag ${IMAGE}:$1_$$*_$2 -f $$< .. + +#$$(info Create save targets: save_$1_all_$2 $(addprefix save_$1_, $(addsuffix _$2, $(DISTROS))) (debug).) +save_targets_$1_$2 := $(addprefix save_$1_, $(addsuffix _$2, $(DISTROS))) +.PHONY: save_$1_all_$2 $$(save_targets_$1_$2) +save_$1_all_$2: $$(save_targets_$1_$2) +$$(save_targets_$1_$2): save_$1_%_$2: cache/$1/%/docker_$2.tar +cache/$1/%/docker_$2.tar: $1_%_$2 + @rm -f $$@ + mkdir -p cache/$1/$$* + docker save ${IMAGE}:$1_$$*_$2 -o $$@ + +#$$(info Create sh targets: $(addprefix sh_$1_, $(addsuffix _$2, $(DISTROS))) (debug).) +sh_targets_$1_$2 := $(addprefix sh_$1_, $(addsuffix _$2, $(DISTROS))) +.PHONY: $$(sh_targets_$1_$2) +$$(sh_targets_$1_$2): sh_$1_%_$2: $1_%_$2 + ${DOCKER_RUN_CMD} --platform linux/$1 -it --name ${IMAGE}_$1_$$*_$2 ${IMAGE}:$1_$$*_$2 + +#$$(info Create targets: clean_$1_all_$2 $(addprefix clean_$1_, $(addsuffix _$2, $(DISTROS))).) +clean_targets_$1_$2 := $(addprefix clean_$1_, $(addsuffix _$2, $(DISTROS))) +.PHONY: clean_$1_all_$2 $$(clean_targets_$1_$2) +clean_$1_all_$2: $$(clean_targets_$1_$2) +$$(clean_targets_$1_$2): clean_$1_%_$2: + docker image rm -f ${IMAGE}:$1_$$*_$2 2>/dev/null + rm -f cache/$1/$$*/docker_$2.tar +endef + +define make-platform-target = +#$$(info PLATFORM: $1) +$(foreach stage,$(STAGES),$(eval $(call make-platform-stage-target,$1,$(stage)))) + +# merge +.PHONY: clean_$1 +clean_$1: $(addprefix clean_$1_all_, $(STAGES)) + -rmdir $(addprefix cache/$1/, $(DISTROS)) + -rmdir cache/$1 +endef + +$(foreach platform,$(PLATFORMS),$(eval $(call make-platform-target,$(platform)))) + +## MERGE ## +.PHONY: clean_platforms +clean_platforms: $(addprefix clean_, $(PLATFORMS)) + +########### +## CLEAN ## +########### +.PHONY: clean +clean: clean_all clean_platforms + docker container prune -f + docker image prune -f + -rmdir cache + +.PHONY: distclean +distclean: clean + -docker container rm -f $$(docker container ls -aq) + -docker image rm -f $$(docker image ls -aq) diff --git a/ci/docker/almalinux/Dockerfile b/ci/docker/almalinux/Dockerfile new file mode 100644 index 00000000..182a4613 --- /dev/null +++ b/ci/docker/almalinux/Dockerfile @@ -0,0 +1,65 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/almalinux +FROM almalinux:latest AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN dnf -y update \ +&& dnf -y install git wget openssl-devel cmake \ +&& dnf -y groupinstall "Development Tools" \ +&& dnf clean all \ +&& rm -rf /var/cache/dnf +CMD [ "/usr/bin/bash" ] + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/docker/alpine/Dockerfile b/ci/docker/alpine/Dockerfile new file mode 100644 index 00000000..0fcc9ca6 --- /dev/null +++ b/ci/docker/alpine/Dockerfile @@ -0,0 +1,60 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/alpine +FROM alpine:edge AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN apk add --no-cache git build-base linux-headers cmake + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/docker/archlinux/Dockerfile b/ci/docker/archlinux/Dockerfile new file mode 100644 index 00000000..3331b08c --- /dev/null +++ b/ci/docker/archlinux/Dockerfile @@ -0,0 +1,60 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/archlinux/ +FROM archlinux:latest AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN pacman -Syu --noconfirm git base-devel cmake + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/docker/debian/Dockerfile b/ci/docker/debian/Dockerfile new file mode 100644 index 00000000..e56b50d2 --- /dev/null +++ b/ci/docker/debian/Dockerfile @@ -0,0 +1,63 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/debian +FROM debian:unstable AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN apt-get update -qq \ +&& apt-get install -yq git wget libssl-dev build-essential cmake \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/docker/fedora/Dockerfile b/ci/docker/fedora/Dockerfile new file mode 100644 index 00000000..72ac89ac --- /dev/null +++ b/ci/docker/fedora/Dockerfile @@ -0,0 +1,64 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/fedora +FROM fedora:latest AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN dnf -y update \ +&& dnf -y install git wget \ +&& dnf -y groupinstall "Development Tools" \ +&& dnf -y install gcc-c++ cmake \ +&& dnf clean all + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/docker/opensuse/Dockerfile b/ci/docker/opensuse/Dockerfile new file mode 100644 index 00000000..ffe28b41 --- /dev/null +++ b/ci/docker/opensuse/Dockerfile @@ -0,0 +1,63 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/r/opensuse/tumbleweed +FROM opensuse/tumbleweed AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN zypper update -y \ +&& zypper install -y git patch gcc gcc-c++ cmake \ +&& zypper clean -a +ENV CC=gcc CXX=g++ + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/docker/rockylinux/Dockerfile b/ci/docker/rockylinux/Dockerfile new file mode 100644 index 00000000..e4886a8c --- /dev/null +++ b/ci/docker/rockylinux/Dockerfile @@ -0,0 +1,65 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/rockylinux +FROM rockylinux:9 AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN dnf -y update \ +&& dnf -y install git wget openssl-devel cmake \ +&& dnf -y groupinstall "Development Tools" \ +&& dnf clean all \ +&& rm -rf /var/cache/dnf +CMD [ "/usr/bin/bash" ] + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/docker/ubuntu/Dockerfile b/ci/docker/ubuntu/Dockerfile new file mode 100644 index 00000000..de01fe08 --- /dev/null +++ b/ci/docker/ubuntu/Dockerfile @@ -0,0 +1,65 @@ +# Create a virtual environment with all tools installed +# ref: https://hub.docker.com/_/ubuntu +FROM ubuntu:latest AS env + +# Install system build dependencies +ENV PATH=/usr/local/bin:$PATH +RUN apt update -q \ +&& DEBIAN_FRONTEND=noninteractive apt install -yq \ + git wget libssl-dev \ + build-essential cmake \ +&& apt-get clean \ +&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN cd /tmp \ +&& git clone -b stable/2.11 https://github.com/Mizux/CoinUtils.git \ +&& cd CoinUtils \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf CoinUtils + +RUN cd /tmp \ +&& git clone -b stable/0.108 https://github.com/Mizux/Osi.git \ +&& cd Osi \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Osi + +RUN cd /tmp \ +&& git clone -b stable/1.17 https://github.com/Mizux/Clp.git \ +&& cd Clp \ +&& cmake -S. -Bbuild \ +&& cmake --build build --target install \ +&& cd .. \ +&& rm -rf Clp + +# Add the library src to our build env +FROM env AS devel +WORKDIR /home/project +COPY . . + +FROM devel AS build +RUN cmake --version +RUN cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release +RUN cmake --build build --target all -v +RUN cmake --build build --target install -v + +FROM build AS test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v + +# Test install rules +FROM env AS install_env +COPY --from=build /usr/local /usr/local/ + +FROM install_env AS install_devel +WORKDIR /home/sample +COPY ci/sample . + +FROM install_devel AS install_build +RUN cmake -S. -Bbuild +RUN cmake --build build --target all -v + +FROM install_build AS install_test +RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v diff --git a/ci/sample/CMakeLists.txt b/ci/sample/CMakeLists.txt new file mode 100644 index 00000000..2c6e0a62 --- /dev/null +++ b/ci/sample/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.5) +project(Sample VERSION 1.0.0 LANGUAGES CXX) + +include(CTest) +find_package(Cgl REQUIRED) + +add_executable(sample main.cpp) +#target_compile_features(sample PUBLIC cxx_std_11) +set_target_properties(sample PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + VERSION ${PROJECT_VERSION}) +target_link_libraries(sample PRIVATE Coin::Cgl) + +if(BUILD_TESTING) + add_test(NAME sample_UT COMMAND sample) +endif() + +include(GNUInstallDirs) +install(TARGETS sample + EXPORT SampleTargets + DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/ci/sample/main.cpp b/ci/sample/main.cpp new file mode 100644 index 00000000..a252f657 --- /dev/null +++ b/ci/sample/main.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +int main(int argc, char** argv) { + std::cout << "coinutils version: " << COINUTILS_VERSION << std::endl; + std::cout << "osi version: " << OSI_VERSION << std::endl; + std::cout << "cgl version: " << CGL_VERSION << std::endl; + return 0; +} +