From 37d5c1a0eacb25de57cc552c13e74f559a5aa6e8 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 30 Jun 2023 17:08:44 +0300 Subject: [PATCH 1/4] cmake: add options to disable vendored quazip, igraph, spdlog & pybind11 --- CMakeLists.txt | 12 +++++-- cmake/detect_dependencies.cmake | 43 +++++++++++++++++++------- plugins/graph_algorithm/CMakeLists.txt | 4 +-- plugins/gui/CMakeLists.txt | 11 +++++-- 4 files changed, 53 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc46cb48e34..d9632df926c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,10 @@ option(HAL_VERSION_MAJOR "Pass major version via cmake options" "") option(HAL_VERSION_MINOR "Pass minor version via cmake options" "") option(HAL_VERSION_PATCH "Pass patch version via cmake options" "") option(USE_LIBCXX "Force the use of LIBCXX for e.g. gcc" FALSE) +option(USE_VENDORED_PYBIND11 "Use vendored 'pybind11' Python library" ON) +option(USE_VENDORED_SPDLOG "Use vendored 'spdlog' library" ON) +option(USE_VENDORED_QUAZIP "Use vendored 'quazip' library" ON) +option(USE_VENDORED_IGRAPH "Use vendored 'igraph' library" ON) option(BUILD_ALL_PLUGINS "Build all available plugins" OFF) option(BUILD_TESTS "Enable test builds" OFF) option(BUILD_COVERAGE "Enable code coverage build" OFF) @@ -325,8 +329,12 @@ install(FILES tools/genversion.py GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/pybind11 DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR}) -install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/spdlog-${spdlog_VERSION} DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR}) +if(USE_VENDORED_PYBIND11) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/pybind11 DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR}) +endif() +if(USE_VENDORED_SPDLOG) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/spdlog-${spdlog_VERSION} DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR}) +endif() install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/subprocess DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR}) diff --git a/cmake/detect_dependencies.cmake b/cmake/detect_dependencies.cmake index 6ee82c749e4..725702405f8 100644 --- a/cmake/detect_dependencies.cmake +++ b/cmake/detect_dependencies.cmake @@ -137,20 +137,33 @@ find_package(pybind11 2.7 CONFIG) if(${pybind11_FOUND}) message(VERBOSE "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}") message(VERBOSE "Found pybind11 >= 2.7") -else() +elseif(USE_VENDORED_PYBIND11) message(STATUS "pybind11 >= 2.7 not found, will build our provided version") add_subdirectory(deps/pybind11) +else() + message(FATAL_ERROR "pybind11 >= 2.7 not found and USE_VENDORED_PYBIND11 is OFF") endif() # ############################### # #### spdlog # ############################### -message(STATUS "using spdlog from deps") -set(spdlog_VERSION 1.9.2) -add_library(spdlog::spdlog INTERFACE IMPORTED) -set_target_properties(spdlog::spdlog PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/deps/spdlog-${spdlog_VERSION}/include" -) + +if(USE_VENDORED_SPDLOG) + message(STATUS "using spdlog from deps") + set(spdlog_VERSION 1.9.2) + add_library(spdlog::spdlog INTERFACE IMPORTED) + set_target_properties(spdlog::spdlog PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/deps/spdlog-${spdlog_VERSION}/include" + ) +else() + find_package(spdlog REQUIRED) + if(spdlog_FOUND) + get_target_property(SPDLOG_HEADERS_DIR spdlog::spdlog INTERFACE_INCLUDE_DIRECTORIES) + message(STATUS "Using system's spdlog headers at ${SPDLOG_HEADERS_DIR}") + else() + message(FATAL_ERROR "spdlog was not found and USE_VENDORED_SPDLOG is OFF") + endif() +endif() # ############################### # #### subprocess @@ -243,7 +256,15 @@ endif(Z3_FOUND) # ############################### # #### igraph # ############################### -set (IGRAPH_SUBDIR "${CMAKE_SOURCE_DIR}/deps/igraph-0.9.10") -add_subdirectory(${IGRAPH_SUBDIR}) -get_directory_property(IGRAPH_INCLUDES DIRECTORY ${IGRAPH_SUBDIR} DEFINITION IGRAPH_INCLUDES) -get_directory_property(IGRAPH_LIB DIRECTORY ${IGRAPH_SUBDIR} DEFINITION IGRAPH_LIB) +if(USE_VENDORED_IGRAPH) + set (IGRAPH_SUBDIR "${CMAKE_SOURCE_DIR}/deps/igraph-0.9.10") + add_subdirectory(${IGRAPH_SUBDIR}) + get_directory_property(igraph_INCLUDES DIRECTORY ${IGRAPH_SUBDIR} DEFINITION IGRAPH_INCLUDES) + get_directory_property(igraph_LIBRARIES DIRECTORY ${IGRAPH_SUBDIR} DEFINITION IGRAPH_LIB) + message(STATUS "Using igraph from ${IGRAPH_SUBDIR}") +else() + find_package(igraph REQUIRED) + get_target_property(igraph_LIBRARIES igraph::igraph IMPORTED_LOCATION_RELEASE) + get_target_property(igraph_INCLUDES igraph::igraph INTERFACE_INCLUDE_DIRECTORIES) + message(STATUS "Using system's igraph from ${igraph_LIBRARIES}") +endif() diff --git a/plugins/graph_algorithm/CMakeLists.txt b/plugins/graph_algorithm/CMakeLists.txt index fa2e5089017..c30514efcc7 100644 --- a/plugins/graph_algorithm/CMakeLists.txt +++ b/plugins/graph_algorithm/CMakeLists.txt @@ -10,8 +10,8 @@ if(PL_GRAPH_ALGORITHM OR BUILD_ALL_PLUGINS) PYDOC SPHINX_DOC_INDEX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/documentation/graph_algorithm.rst HEADER ${GRAPH_ALGORITHM_INC} SOURCES ${GRAPH_ALGORITHM_SRC} ${GRAPH_ALGORITHM_PYTHON_SRC} - INCLUDES PUBLIC $ - LINK_LIBRARIES PUBLIC ${IGRAPH_LIB} + INCLUDES PUBLIC $ + LINK_LIBRARIES PUBLIC ${igraph_LIBRARIES} ) endif() diff --git a/plugins/gui/CMakeLists.txt b/plugins/gui/CMakeLists.txt index 6dc2821549f..36861100ee9 100644 --- a/plugins/gui/CMakeLists.txt +++ b/plugins/gui/CMakeLists.txt @@ -66,8 +66,15 @@ if(PL_GUI OR BUILD_ALL_PLUGINS) set(CMAKE_${j}_OUTPUT_DIRECTORY${i} "${CMAKE_BINARY_DIR}/lib") endforeach() endforeach() - set (QUAZIP_SUBDIR "${CMAKE_SOURCE_DIR}/deps/quazip-1.3") - add_subdirectory(${QUAZIP_SUBDIR} ${CMAKE_BINARY_DIR}/quazip) + if(USE_VENDORED_QUAZIP) + set (QUAZIP_SUBDIR "${CMAKE_SOURCE_DIR}/deps/quazip-1.3") + add_subdirectory(${QUAZIP_SUBDIR} ${CMAKE_BINARY_DIR}/quazip) + message(STATUS "Using quazip from ${QUAZIP_SUBDIR}") + else() + find_package(QuaZip-Qt5 REQUIRED) + get_target_property(QUAZIP_LIBRARIES QuaZip::QuaZip IMPORTED_LOCATION_RELEASE) + message(STATUS "Using system's quazip from ${QUAZIP_LIBRARIES}") + endif() foreach(i IN ITEMS "" "_DEBUG" "_RELEASE" "_MINSIZEREL" "_RELWITHDEBINFO") foreach(j IN ITEMS "RUNTIME" "ARCHIVE" "LIBRARY") From 13eadc7a172487b20a8f991fd3db01230c3fc451 Mon Sep 17 00:00:00 2001 From: joern274 Date: Fri, 26 Apr 2024 22:35:26 +0200 Subject: [PATCH 2/4] Fix Ubuntu 24.04 LTS build --- .../include/netlist_simulator_controller/saleae_directory.h | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/saleae_directory.h b/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/saleae_directory.h index 94426408607..6583b37ddbb 100644 --- a/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/saleae_directory.h +++ b/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/saleae_directory.h @@ -28,6 +28,7 @@ #include #include #include +#include // unfortunately std::filesystem::path is not available for all platforms #ifdef _WIN32 From e403bf57ad436124f728d0eacc26de30a9d239c9 Mon Sep 17 00:00:00 2001 From: RenWal Date: Mon, 6 May 2024 17:38:32 +0200 Subject: [PATCH 3/4] Fix Docker build on modern Docker Buildx (#560) Co-authored-by: SJulianS <18482153+SJulianS@users.noreply.github.com> --- Dockerfile | 2 +- install_dependencies.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c70c7ef07c..b94c0f4385c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update -y && \ apt-get install -y lsb-release COPY . . -RUN ./install_dependencies.sh +RUN HAL_DOCKER=1 ./install_dependencies.sh RUN mkdir build WORKDIR ${hal_path}/build/ diff --git a/install_dependencies.sh b/install_dependencies.sh index 510bc6e961e..747610604c7 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -4,7 +4,7 @@ platform='unknown' unamestr=$(uname) distribution='unknown' release='unknown' -if [[ -f "/.dockerenv" ]]; then +if [[ "${HAL_DOCKER:-0}" == "1" ]]; then platform='docker' distribution=$(lsb_release -is) release=$(lsb_release -rs) From 46d627b3e73729de02167ad7e876551d25841b1b Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Wed, 8 May 2024 15:26:21 +0100 Subject: [PATCH 4/4] netlist_simulator_controller: fix build with gcc 13 (#557)