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/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/cmake/detect_dependencies.cmake b/cmake/detect_dependencies.cmake index 49dab17fe77..55460618841 100644 --- a/cmake/detect_dependencies.cmake +++ b/cmake/detect_dependencies.cmake @@ -153,20 +153,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 @@ -259,7 +272,15 @@ endif(Z3_FOUND) # ############################### # #### igraph # ############################### -set(IGRAPH_SUBDIR "${CMAKE_SOURCE_DIR}/deps/igraph-0.10.x") -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.10.x") + 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/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) diff --git a/plugins/graph_algorithm/CMakeLists.txt b/plugins/graph_algorithm/CMakeLists.txt index d4f936101ed..71f73d11ba0 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") 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