build: Add daemon submodule and optionally use it.

This allows invoking cmake with -DWITH_DAEMON_SUBMODULE=true to use
the daemon header files and library from the submodule.  Note that it
is currently still necessary to build the daemon separately first,
either manually or using the build.py convenience script.

The goal is to eventually add support for building the daemon with
CMake in the future, so that we could add_subdirectory(${DAEMON_DIR})
in client-qt's CMakeLists.txt and have CMake take care of everything.

Change-Id: I3a16c44837e6c79616b3101fea8a6ff3defa3ab5
This commit is contained in:
Amin Bandali
2022-10-14 10:55:36 -04:00
committed by Sébastien Blin
parent 3f1bc76c08
commit ca7b1e70e4
4 changed files with 64 additions and 32 deletions

View File

@@ -39,6 +39,8 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Main project directories:
# daemon
set(DAEMON_DIR ${PROJECT_SOURCE_DIR}/daemon)
# src
set(LIBCLIENT_SRC_DIR ${PROJECT_SOURCE_DIR}/src/libclient)
set(APP_SRC_DIR ${PROJECT_SOURCE_DIR}/src/app)
@@ -102,6 +104,16 @@ set(CMAKE_CXX_FLAGS
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
# jami-daemon
if(NOT DEFINED WITH_DAEMON_SUBMODULE)
set(WITH_DAEMON_SUBMODULE false)
endif()
if (WITH_DAEMON_SUBMODULE AND NOT EXISTS ${DAEMON_DIR}/src)
message(FATAL_ERROR
"Jami Daemon sources not found in ${DAEMON_DIR}/src. If you \
cloned this repository via git, perhaps you did not initialize its \
submodules afterwards. You can do so by running \"git submodule \
update --init\" in the repository.")
endif()
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH} "${EXTRAS_DIR}/build/cmake/modules")
find_package(LibJami REQUIRED)