From 40c0ae30a13ebf7c0320965e8b9283c724298577 Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Sat, 9 Nov 2024 14:39:53 +0100 Subject: [PATCH 1/2] switch to Bliss::libbliss if find_package(Bliss CONFIG) succeeds - closes scipopt/scip#117 --- CHANGELOG | 3 ++- CMakeLists.txt | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0e2a8fe479..c50a4dabf7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -19,7 +19,8 @@ Build system ### Cmake -- fix SCIP Optimization Suite build with -DSYM=bliss and bliss being downloaded and build during configuration by cmake +- fix SCIP Optimization Suite build with -DSYM=(s)bliss and bliss being downloaded and build during configuration by cmake +- fix use of a bliss cmake installation (from https://github.com/scipopt/bliss) specified via BLISS_DIR if -DSYM=(s)bliss ### Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 675b1d8d77..8492dc75c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,11 +133,9 @@ if(SYM STREQUAL "bliss" OR SYM STREQUAL "sbliss") find_package(Bliss CONFIG HINTS ${BLISS_DIR}) if(Bliss_FOUND) - get_filename_component(BLISS_ABSOLUTE_PATH ${Bliss_DIR}/../../.. REALPATH) - include_directories(${BLISS_ABSOLUTE_PATH}/include) - set(SYM_LIBRARIES ${BLISS_ABSOLUTE_PATH}/lib/libbliss.a) - set(SYM_PIC_LIBRARIES ${BLISS_ABSOLUTE_PATH}/lib/libbliss.a) - message(STATUS "Found Bliss: ${BLISS_ABSOLUTE_PATH}") + set(SYM_LIBRARIES Bliss::libbliss) + set(SYM_PIC_LIBRARIES Bliss::libbliss) + message(STATUS "Found Bliss: ${Bliss_DIR}") else() # Utilities to automatically download missing dependencies include(cmake/Dependencies.cmake) From 8809de7fba386669d845c767c30ebfac067fce3e Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Sat, 9 Nov 2024 15:22:40 +0100 Subject: [PATCH 2/2] remove unused FindBLISS.cmake --- cmake/Modules/FindBLISS.cmake | 116 ---------------------------------- 1 file changed, 116 deletions(-) delete mode 100644 cmake/Modules/FindBLISS.cmake diff --git a/cmake/Modules/FindBLISS.cmake b/cmake/Modules/FindBLISS.cmake deleted file mode 100644 index c115984219..0000000000 --- a/cmake/Modules/FindBLISS.cmake +++ /dev/null @@ -1,116 +0,0 @@ -include(FindPackageHandleStandardArgs) - -# Check whether environment variable BLISS_DIR was set. -if(NOT BLISS_DIR) - set(ENV_BLISS_DIR $ENV{BLISS_DIR}) - if(ENV_BLISS_DIR) - set(BLISS_DIR $ENV{BLISS_DIR} CACHE PATH "Path to bliss build directory") - endif() -endif() - -# If the bliss directory is specified, first try to use it. -if(BLISS_DIR) - set(COPY_BLISS_HEADERS FALSE) - - # Look for the includes with subdirectory bliss. - find_path(BLISS_INCLUDE_DIR - NAMES bliss/graph.hh - PATHS ${BLISS_DIR} - PATH_SUFFIXES include - NO_DEFAULT_PATH - ) - - # If not found, look for the includes without bliss subdirectory. - if(NOT BLISS_INCLUDE_DIR) - find_path(BLISS_HEADER_DIR - NAMES graph.hh - PATHS ${BLISS_DIR} - PATH_SUFFIXES include src - NO_DEFAULT_PATH - ) - - # If we found the headers there we copy the folder to a bliss folder in the binary dir and use that as include - if(BLISS_HEADER_DIR) - set(COPY_BLISS_HEADERS TRUE) - endif() - endif() - - # Look for the library in the bliss directory - - if(BLISS_LIBRARY_DIR) - find_library(BLISS_LIBRARY - NAMES bliss - PATHS ${BLISS_LIBRARY_DIR} - PATH_SUFFIXES lib build - NO_DEFAULT_PATH - ) - - else() - find_library(BLISS_LIBRARY - NAMES bliss - PATHS ${BLISS_DIR} - PATH_SUFFIXES lib build - NO_DEFAULT_PATH - ) - endif() - - # If requested, copy the bliss headers to the /bliss/ and set include dir to . - if(BLISS_LIBRARY AND COPY_BLISS_HEADERS) - file(GLOB BLISS_HEADER_LIST ${BLISS_HEADER_DIR}/*.hh) - file(COPY ${BLISS_HEADER_LIST} DESTINATION ${CMAKE_BINARY_DIR}/bliss) - set(BLISS_INCLUDE_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Include path for bliss headers" FORCE) - endif() -endif() - -# If bliss is not already found by the code above we look for it including system directories -if(NOT BLISS_INCLUDE_DIR OR NOT BLISS_LIBRARY) - find_path(BLISS_INCLUDE_DIR - NAMES bliss/graph.hh - PATH_SUFFIXES include src) - - find_library(BLISS_LIBRARY - NAMES bliss - PATH_SUFFIXES lib build) -endif() - -if(BLISS_INCLUDE_DIR AND BLISS_LIBRARY) - set(BLISS_INCLUDE_DIRS ${BLISS_INCLUDE_DIR}) - set(BLISS_LIBRARIES ${BLISS_LIBRARY}) - - # Check if bliss requires GMP. - - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/check_bliss_uses_gmp.cpp" "#include \n\nint main()\n{\n bliss::Graph graph(32);\n bliss::Stats stats;\n graph.find_automorphisms(stats, NULL, NULL);\n stats.print(stdout);\n return 0;\n}\n") - try_run(RUN_RESULT COMPILE_RESULT "${CMAKE_CURRENT_BINARY_DIR}/" "${CMAKE_CURRENT_BINARY_DIR}/check_bliss_uses_gmp.cpp" LINK_LIBRARIES "${BLISS_LIBRARY}" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${BLISS_INCLUDE_DIR}") - - if(NOT COMPILE_RESULT OR RUN_RESULT MATCHES FAILED_TO_RUN) - # Bliss requires GMP. - if(BLISS_FIND_REQUIRED) - if(BLISS_FIND_QUIETLY) - find_package(GMP REQUIRED QUIET) - else() - find_package(GMP REQUIRED) - endif() - else() - if(BLISS_FIND_QUIETLY) - find_package(GMP QUIET) - else() - find_package(GMP) - endif() - endif() - if(GMP_FOUND) - set(BLISS_INCLUDE_DIRS ${BLISS_INCLUDE_DIRS} ${GMP_INCLUDE_DIRS}) - set(BLISS_LIBRARIES ${BLISS_LIBRARIES} ${GMP_LIBRARIES}) - set(BLISS_DEFINITIONS "-DBLISS_USE_GMP" CACHE STRING "Extra CXX flags required for bliss") - find_package_handle_standard_args(BLISS DEFAULT_MSG BLISS_INCLUDE_DIR BLISS_INCLUDE_DIRS BLISS_LIBRARIES BLISS_DEFINITIONS) - elseif(NOT BLISS_FIND_QUIETLY) - message(STATUS "Could NOT find BLISS (missing: GMP library)") - endif() - else() - set(BLISS_DEFINITIONS " ") - find_package_handle_standard_args(BLISS DEFAULT_MSG BLISS_INCLUDE_DIR BLISS_INCLUDE_DIRS BLISS_LIBRARIES BLISS_DEFINITIONS) - endif() - file(REMOVE "check_bliss_uses_gmp.cpp") -else() - find_package_handle_standard_args(BLISS DEFAULT_MSG BLISS_INCLUDE_DIR BLISS_INCLUDE_DIRS BLISS_LIBRARIES BLISS_DEFINITIONS) -endif() -