Skip to content

Commit

Permalink
Merge pull request #478 from lebarsfa/master
Browse files Browse the repository at this point in the history
Some minor updates for CMake support on Windows (currently used to build Tubex on Windows)
  • Loading branch information
cyrilbouvier authored Nov 2, 2020
2 parents 4068b3b + 632013b commit 7a1e759
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
5 changes: 5 additions & 0 deletions cmake.utils/ibex-config-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,13 @@ function (IBEX_INIT_COMMON)
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif ()

if(MSVC)
set (CMAKE_CXX_FLAGS_RELEASE "/D NDEBUG /D _CRT_SECURE_NO_WARNINGS" PARENT_SCOPE)
set (CMAKE_CXX_FLAGS_DEBUG "/D DEBUG /D _CRT_SECURE_NO_WARNINGS" PARENT_SCOPE)
else()
set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" PARENT_SCOPE)
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -pg -Wall -DDEBUG" PARENT_SCOPE)
endif()

##############################################################################
# add uninstall command
Expand Down
7 changes: 5 additions & 2 deletions interval_lib_wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
subdir_list (INTERVAL_LIB_LIST RELATIVE)

# TODO filib on Windows ??
set(INTERVAL_LIB "gaol" CACHE STRING "Library used for interval arithmetic")
if(WIN32)
set(INTERVAL_LIB "filib" CACHE STRING "Library used for interval arithmetic")
else()
set(INTERVAL_LIB "gaol" CACHE STRING "Library used for interval arithmetic")
endif()
set_property(CACHE INTERVAL_LIB PROPERTY STRINGS ${INTERVAL_LIB_LIST})

list(FIND INTERVAL_LIB_LIST ${INTERVAL_LIB} is_valid)
Expand Down
34 changes: 34 additions & 0 deletions interval_lib_wrapper/gaol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ if (MATHLIB_INCDIR AND MATHLIB_LIB)
INCLUDE_DIRECTORIES ${MATHLIB_INCDIR})
else()
message (STATUS "Will install and use mathlib from 3rd/ subdirectory")
if(MINGW)
ExternalProject_Add (libultim_3rd
PREFIX mathlib-2.1.0
URL ${CMAKE_CURRENT_SOURCE_DIR}/3rd/mathlib-2.1.0.tar.gz
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND sh -c "./configure --prefix=<INSTALL_DIR>
CFLAGS=${CMAKE_C_FLAGS}"
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
)
else()
ExternalProject_Add (libultim_3rd
PREFIX mathlib-2.1.0
URL ${CMAKE_CURRENT_SOURCE_DIR}/3rd/mathlib-2.1.0.tar.gz
Expand All @@ -36,6 +49,7 @@ else()
LOG_BUILD 1
LOG_INSTALL 1
)
endif()
ExternalProject_Get_Property (libultim_3rd INSTALL_DIR)
set (MATHLIB_LIBDIR "${INSTALL_DIR}/lib")
set (MATHLIB_INCDIR "${INSTALL_DIR}/include")
Expand Down Expand Up @@ -100,6 +114,25 @@ else ()
set (GAOL_CONFIG_ARGS "${GAOL_CONFIG_ARGS}" "--disable-simd")
endif ()
set (GAOL_PATCH "${CMAKE_CURRENT_SOURCE_DIR}/3rd/gaol-4.2.0.all.all.patch")
if(MINGW)
ExternalProject_Add (libgaol_3rd
PREFIX gaol-4.2.0
${_gaol_depends}
URL ${CMAKE_CURRENT_SOURCE_DIR}/3rd/gaol-4.2.0.tar.gz
PATCH_COMMAND patch -p1 -i ${GAOL_PATCH}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND sh -c "./configure --prefix=<INSTALL_DIR>
CFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
--with-mathlib-include=${MATHLIB_INCDIR}
--with-mathlib-lib=${MATHLIB_LIBDIR}
${GAOL_CONFIG_ARGS}"
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
)
else()
ExternalProject_Add (libgaol_3rd
PREFIX gaol-4.2.0
${_gaol_depends}
Expand All @@ -117,6 +150,7 @@ else ()
LOG_BUILD 1
LOG_INSTALL 1
)
endif()
ExternalProject_Get_Property (libgaol_3rd INSTALL_DIR)

set (_incdir ${INSTALL_DIR}/include)
Expand Down
2 changes: 1 addition & 1 deletion lp_lib_wrapper/soplex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ else ()
URL ${CMAKE_CURRENT_SOURCE_DIR}/3rd/soplex-4.0.2.tar
PATCH_COMMAND patch -p1 -i ${SOPLEX_PATCH}
CONFIGURE_COMMAND ""
BUILD_COMMAND make USRCXXFLAGS=${CMAKE_CXX_FLAGS} GMP=false ZLIB=false ${_shared} INSTALLDIR=<INSTALL_DIR> install
BUILD_COMMAND $(MAKE) USRCXXFLAGS=${CMAKE_CXX_FLAGS} GMP=false ZLIB=false ${_shared} INSTALLDIR=<INSTALL_DIR> install
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
LOG_DOWNLOAD 1
Expand Down

0 comments on commit 7a1e759

Please sign in to comment.