103a02ad0SJames Feistcmake_minimum_required (VERSION 3.1 FATAL_ERROR) 203a02ad0SJames Feistset (BUILD_SHARED_LIBRARIES OFF) 303a02ad0SJames Feistinclude (ExternalProject) 4ffcaad8bSPatrick Williamsset (CMAKE_CXX_STANDARD 20) 503a02ad0SJames Feistset (CMAKE_CXX_STANDARD_REQUIRED ON) 603a02ad0SJames Feistset (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") 703a02ad0SJames Feistset (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") 803a02ad0SJames Feist 903a02ad0SJames Feistoption (YOCTO "Enable Building in Yocto" OFF) 1003a02ad0SJames Feist 1103a02ad0SJames Feistif (NOT YOCTO) 1203a02ad0SJames Feist externalproject_add ( 1303a02ad0SJames Feist Boost URL 149dc4abd5SPatrick Williams https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.gz 159dc4abd5SPatrick Williams URL_MD5 5f521b41b79bf8616582c4a8a2c10177 SOURCE_DIR 1603a02ad0SJames Feist "${CMAKE_BINARY_DIR}/boost-src" BINARY_DIR 1703a02ad0SJames Feist "${CMAKE_BINARY_DIR}/boost-build" CONFIGURE_COMMAND "" BUILD_COMMAND "" 1803a02ad0SJames Feist INSTALL_COMMAND mkdir -p "${CMAKE_BINARY_DIR}/prefix/include/" && cp -R 1903a02ad0SJames Feist ${CMAKE_BINARY_DIR}/boost-src/boost ${CMAKE_BINARY_DIR}/prefix/include 2003a02ad0SJames Feist ) # requires apt install autoconf-archive and autoconf 2103a02ad0SJames Feist externalproject_add (sdbusplus-project PREFIX 2203a02ad0SJames Feist ${CMAKE_BINARY_DIR}/sdbusplus-project GIT_REPOSITORY 2303a02ad0SJames Feist https://github.com/openbmc/sdbusplus.git GIT_TAG 246fc0ed7cSPatrick Williams 8a97100b806225df40c490eb748c9a4e1b3c11b3 SOURCE_DIR 2503a02ad0SJames Feist ${CMAKE_BINARY_DIR}/sdbusplus-src BINARY_DIR 2603a02ad0SJames Feist ${CMAKE_BINARY_DIR}/sdbusplus-build CONFIGURE_COMMAND 2703a02ad0SJames Feist "" BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/sdbusplus-src 280d26db38SPatrick Williams && meson build -Ddefault_library=static && ninja -C 290d26db38SPatrick Williams build libsdbusplus.a INSTALL_COMMAND "" 3003a02ad0SJames Feist LOG_DOWNLOAD ON) 3103a02ad0SJames Feist 3203a02ad0SJames Feist include_directories (${CMAKE_BINARY_DIR}/sdbusplus-src) 3303a02ad0SJames Feist include_directories (${CMAKE_BINARY_DIR}/nlohmann/include) 3403a02ad0SJames Feist include_directories (${CMAKE_BINARY_DIR}/nlohmann/include/nlohmann) 3503a02ad0SJames Feist include_directories (${CMAKE_BINARY_DIR}/phosphor-dbus-interfaces/include) 360d26db38SPatrick Williams link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/build) 3703a02ad0SJames Feist 3803a02ad0SJames Feist include_directories (${CMAKE_BINARY_DIR}/boost-src) 3903a02ad0SJames Feist set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/boost-src ${CMAKE_PREFIX_PATH}) 4003a02ad0SJames Feistendif () 4103a02ad0SJames Feist 4203a02ad0SJames Feistadd_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY) 4303a02ad0SJames Feistadd_definitions (-DBOOST_SYSTEM_NO_DEPRECATED) 4403a02ad0SJames Feistadd_definitions (-DBOOST_ALL_NO_LIB) 4503a02ad0SJames Feistadd_definitions (-DBOOST_NO_RTTI) 4603a02ad0SJames Feistadd_definitions (-DBOOST_NO_TYPEID) 4703a02ad0SJames Feistadd_definitions (-DBOOST_ASIO_DISABLE_THREADS) 4803a02ad0SJames Feist 4903a02ad0SJames Feistinclude_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) 5003a02ad0SJames Feistinclude_directories (${Boost_INCLUDE_DIRS}) 5103a02ad0SJames Feistinclude_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) 5203a02ad0SJames Feist 5303a02ad0SJames Feistadd_executable (callback-manager src/callback_manager.cpp) 5403a02ad0SJames Feist 5503a02ad0SJames Feisttarget_link_libraries (callback-manager -lsystemd) 5603a02ad0SJames Feisttarget_link_libraries (callback-manager stdc++fs) 5703a02ad0SJames Feisttarget_link_libraries (callback-manager ${Boost_LIBRARIES}) 5803a02ad0SJames Feisttarget_link_libraries (callback-manager sdbusplus) 5903a02ad0SJames Feist 6003a02ad0SJames Feistif (NOT YOCTO) 6103a02ad0SJames Feist add_dependencies (callback-manager sdbusplus-project) 6203a02ad0SJames Feistendif () 6303a02ad0SJames Feist 6403a02ad0SJames Feistset (SERVICE_FILES ${PROJECT_SOURCE_DIR}/service_files/callback-manager.service) 6503a02ad0SJames Feist 66*01a3964aSJason M. Billsfind_package (PkgConfig REQUIRED) 67*01a3964aSJason M. Billspkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir) 68*01a3964aSJason M. Bills 6903a02ad0SJames Feistinstall (TARGETS callback-manager DESTINATION sbin) 70*01a3964aSJason M. Billsinstall (FILES ${SERVICE_FILES} DESTINATION "${SYSTEMD_SYSTEM_UNIT_DIR}") 71