Allow fetching locally ZeroMQ if not already installed
continuous-integration/drone/push Build is passing Details

pull/1/head
Clément FRÉVILLE 2 years ago
parent 2d75822ed9
commit 3bc8f547f6

@ -6,5 +6,5 @@ steps:
- name: build
image: hub.codefirst.iut.uca.fr/clement.freville2/planificador-build-image:latest
commands:
- mkdir build && cd build && cmake ..
- make
- cmake -B build -S .
- cmake --build build --parallel $(nproc)

4
.gitignore vendored

@ -1,3 +1,7 @@
bin
build
obj
.idea
.vscode
cmake-build-debug

@ -1,19 +1,45 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
project(planificador)
add_compile_options(-Wall -Wextra -pedantic)
include(FetchContent)
FetchContent_Declare(
tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.3.0
tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.3.0
)
FetchContent_MakeAvailable(tomlplusplus)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
find_package(ZeroMQ QUIET)
if (NOT ZeroMQ_FOUND)
message(STATUS "ZeroMQ not found, using bundled version")
FetchContent_Declare(
zeromq
GIT_REPOSITORY https://github.com/zeromq/libzmq.git
GIT_TAG v4.3.5
)
FetchContent_Declare(
cppzmq
GIT_REPOSITORY https://github.com/zeromq/cppzmq.git
GIT_TAG v4.10.0
)
set(WITH_PERF_TOOL OFF)
set(ENABLE_CPACK OFF)
set(ZMQ_BUILD_TESTS OFF)
set(WITH_TLS OFF)
set(WITH_DOC OFF)
set(CPPZMQ_BUILD_TESTS OFF)
FetchContent_MakeAvailable(zeromq cppzmq)
include_directories(${zeromq_SOURCE_DIR}/include)
include_directories(${cppzmq_SOURCE_DIR})
endif ()
add_executable(planificador src/host.cpp src/runner.cpp src/config.cpp src/main.cpp)
target_compile_options(planificador PUBLIC -Wall -Wextra -pedantic)
target_compile_features(planificador PUBLIC cxx_std_17)
include_directories(${tomlplusplus_SOURCE_DIR}/include)

@ -0,0 +1,28 @@
# Adapted from https://github.com/zeromq/cppzmq/blob/master/CMakeLists.txt
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
find_package(PkgConfig)
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
find_path(ZeroMQ_INCLUDE_DIR zmq.h
PATHS ${ZeroMQ_DIR}/include
${PC_LIBZMQ_INCLUDE_DIRS})
find_library(ZeroMQ_LIBRARY
NAMES zmq
PATHS ${ZeroMQ_DIR}/lib
${PC_LIBZMQ_LIBDIR}
${PC_LIBZMQ_LIBRARY_DIRS})
if(ZeroMQ_LIBRARY)
set(ZeroMQ_FOUND ON)
endif()
set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )
include ( FindPackageHandleStandardArgs )
# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS )
Loading…
Cancel
Save