diff --git a/CMakeLists.txt b/CMakeLists.txt index c9a085f0d64a38575d178b6516c9bff00a039976..3e3bdbbc07a7d00d7e1631dd468fe63a4db4a0c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ else() endif() option(WITH_DAEMON_SUBMODULE "Build with daemon submodule" ON) +option(JAMICORE_AS_SUBDIR "Build Jami-core as a subdir dependency" OFF) option(ENABLE_TESTS "Build with tests" OFF) option(WITH_WEBENGINE "Build with WebEngine" ON) if(WITH_WEBENGINE) @@ -50,6 +51,19 @@ if(ENABLE_ASAN AND NOT MSVC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") endif() +# jami-core +if(NOT WITH_DAEMON_SUBMODULE) + set(DAEMON_DIR ${PROJECT_SOURCE_DIR}/../daemon) +else() + set(DAEMON_DIR ${PROJECT_SOURCE_DIR}/daemon) +endif() + +# For now only MSVC is supported for building Jami-core within the +# client cmake. +if(JAMICORE_AS_SUBDIR) + add_subdirectory(${DAEMON_DIR}) +endif() + # init some variables for includes, libs, etc. set(CLIENT_INCLUDE_DIRS, "") set(CLIENT_LINK_DIRS, "") @@ -67,14 +81,6 @@ set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Main project directories: - -# jami-daemon -if(NOT WITH_DAEMON_SUBMODULE) - set(DAEMON_DIR ${PROJECT_SOURCE_DIR}/../daemon) -else() - set(DAEMON_DIR ${PROJECT_SOURCE_DIR}/daemon) -endif() # src set(LIBCLIENT_SRC_DIR ${PROJECT_SOURCE_DIR}/src/libclient) set(APP_SRC_DIR ${PROJECT_SOURCE_DIR}/src/app) @@ -106,16 +112,6 @@ else() message(FATAL_ERROR "Qt 6.4 or higher is required. Found ${QT_VERSION}") endif() -if(MSVC) - set(DEFAULT_BUILD_TYPE "Debug") - if(NOT CMAKE_BUILD_TYPE) - message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") - set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE - STRING "Choose the type of build." FORCE) - endif() - set(OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/x64/${CMAKE_BUILD_TYPE}") -endif() - # libjamiclient add_subdirectory(${LIBCLIENT_SRC_DIR}) diff --git a/build.py b/build.py index a61c40347ead5774ee2ef1310c0b8721ee3f2108..04e865aa1160591bf0a7718f0d945c031a41bb99 100755 --- a/build.py +++ b/build.py @@ -364,13 +364,7 @@ def cwd(path): def run_install(args): # Platforms with special compilation scripts if args.distribution == WIN32_DISTRIBUTION_NAME: - if args.pywinmake: - with cwd('daemon'): - execute_script(['git submodule update --init']) - execute_script(['python -m pip install extras/scripts/pywinmake']) - execute_script(['python extras/scripts/winmake.py']) - execute_script(['python extras/scripts/winmake.py --base-dir compat/msvc']) - else: + if not args.pywinmake: with cwd('daemon/compat/msvc'): execute_script([f'python winmake.py -iv -s {args.sdk} -b daemon']) diff --git a/extras/scripts/build-windows.py b/extras/scripts/build-windows.py index 8a7b5e7d0aff1b185a4f2e24db2f24ff6f879435..3476990963f7869f54f3922f450292dc742fabdb 100644 --- a/extras/scripts/build-windows.py +++ b/extras/scripts/build-windows.py @@ -190,13 +190,9 @@ def init_submodules(): """Initialize any git submodules in the project.""" print("Initializing submodules...") - if execute_cmd(["git", "submodule", "update", "--init"], False): + if execute_cmd(["git", "submodule", "update", "--init", "--recursive"], False): print("Submodule initialization error.") - else: - if execute_cmd(["git", "submodule", "update", "--recursive"], False): - print("Submodule recursive checkout error.") - else: - print("Submodule recursive checkout finished.") + sys.exit(1) def build_deps(): @@ -269,7 +265,7 @@ def build(config_str, qt_dir, tests): # We need to update the minimum SDK version to be able to # build with system theme support cmake_options = [ - "-DWITH_DAEMON_SUBMODULE=ON", + "-DJAMICORE_AS_SUBDIR=ON", "-DCMAKE_PREFIX_PATH=" + qt_dir, "-DCMAKE_MSVCIDE_RUN_PATH=" + qt_dir + "\\bin", "-DCMAKE_INSTALL_PREFIX=" + os.getcwd(), diff --git a/src/libclient/CMakeLists.txt b/src/libclient/CMakeLists.txt index ecb21bcf6e34f9cdca80fcd4d1e60c21e3895ed1..21ddca3ce6f9ffdaf4613735b44f7bf31d9edc46 100644 --- a/src/libclient/CMakeLists.txt +++ b/src/libclient/CMakeLists.txt @@ -225,6 +225,10 @@ Qt${QT_VERSION_MAJOR} enabled.") add_subdirectory(qtwrapper) include_directories(qtwrapper) + if(JAMICORE_AS_SUBDIR) + add_dependencies(qtwrapper jami-core) + endif() + if(${VERBOSE_IPC} MATCHES true) message(STATUS "Adding more debug output") add_definitions(-DVERBOSE_IPC=true) @@ -470,6 +474,17 @@ add_library(${LIBCLIENT_NAME} STATIC ${LIBCLIENT_SOURCES} ${LIBCLIENT_HEADERS_API} ${LIBCLIENT_HEADERS_MOC}) + +if(JAMICORE_AS_SUBDIR) + # Define the project dependencies depending on the build type. + if(ENABLE_LIBWRAP) + add_dependencies(qtwrapper jami-core) + add_dependencies(${LIBCLIENT_NAME} qtwrapper) + else() + add_dependencies(${LIBCLIENT_NAME} jami-core) + endif() +endif() + foreach(QT_LIB ${QT_LIBS}) target_link_libraries(${LIBCLIENT_NAME} ${QT_LIB}) endforeach()