aboutsummaryrefslogtreecommitdiff
From cfdf6d1c2051d6a20d0cbb94d81fe398f70dea4d Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <rg@raghavgururajan.name>
Date: Sun, 21 Mar 2021 21:13:53 -0400
Subject: [PATCH] [PATCH]: Fix building from git.

---
 CMakeLists.txt                                | 73 +------------------
 linphone-app/CMakeLists.txt                   | 12 +--
 .../cmake_builder/additional_steps.cmake      |  2 +-
 .../linphone_package/CMakeLists.txt           | 38 ----------
 linphone-app/linphoneqt_version.cmake         |  1 +
 linphone-app/src/config.h.cmake               |  1 +
 6 files changed, 6 insertions(+), 121 deletions(-)
 create mode 100644 linphone-app/linphoneqt_version.cmake

diff -ru a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt	1970-01-01 01:00:01.000000000 +0100
+++ b/CMakeLists.txt	2023-04-08 16:00:45.487927870 +0200
@@ -51,23 +51,6 @@
 
 set(CMAKE_CXX_STANDARD 11)
 
-# Prepare gobal CMAKE configuration specific to the current project
-set(SDK_BUILD_DIR "${CMAKE_BINARY_DIR}/WORK")       # SDK build in WORK. Keep all in it.
-set(LINPHONE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/linphone-sdk/desktop")
-
-set(APPLICATION_OUTPUT_DIR "${CMAKE_BINARY_DIR}/OUTPUT")
-
-set(CMAKE_PREFIX_PATH "${LINPHONE_OUTPUT_DIR};${APPLICATION_OUTPUT_DIR};${APPLICATION_OUTPUT_DIR}/include${PREFIX_PATH}")
-if(WIN32)
-	set( CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${APPLICATION_OUTPUT_DIR}/${CMAKE_INSTALL_BINDIR}")
-elseif(APPLE)
-	set( CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${APPLICATION_NAME}.app/Contents/Frameworks")
-else()
-	set( CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${APPLICATION_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}")
-endif()
-string(REPLACE ";" "|" PREFIX_PATH "${CMAKE_PREFIX_PATH}")
-#set(PREFIX_PATH "${LINPHONE_OUTPUT_DIR}|${APPLICATION_OUTPUT_DIR}${PREFIX_PATH}")
-
 # Avoid cmake warning if CMP0071 is not set.
 if (POLICY CMP0071)
     cmake_policy(SET CMP0071 NEW)
@@ -177,10 +160,8 @@
 endif()
 list(APPEND APP_OPTIONS "-DENABLE_RELATIVE_PREFIX=${ENABLE_RELATIVE_PREFIX}")
 
-list(APPEND APP_OPTIONS "-DLINPHONE_OUTPUT_DIR=${LINPHONE_OUTPUT_DIR}")
 list(APPEND APP_OPTIONS "-DENABLE_QT_GL=${ENABLE_VIDEO}")#Activate on video
 
-include(ExternalProject)
 set(PROJECT_BUILD_COMMAND "")
 if(CMAKE_BUILD_PARALLEL_LEVEL)
 	list(APPEND APP_OPTIONS "-DCMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL}")
@@ -195,7 +176,6 @@
 	endif()
 endif()
 if(UNIX AND NOT APPLE)
-	set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/lib64:$ORIGIN/../lib64:$ORIGIN/lib:$ORIGIN/../lib:${LINPHONE_OUTPUT_DIR}/${CMAKE_INSTALL_LIBDIR}")
 	list(APPEND APP_OPTIONS "-DCMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH}")
 elseif(APPLE)
 	list(APPEND APP_OPTIONS "-DENABLE_FAT_BINARY=ON")	#Disable XCFrameworks as it is not supported.
@@ -222,28 +202,9 @@
 
 
 if(NOT LINPHONE_QT_ONLY)
-ExternalProject_Add(sdk PREFIX "${CMAKE_BINARY_DIR}/sdk"
-    SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-sdk"
-    INSTALL_DIR "${LINPHONE_OUTPUT_DIR}"
-    STAMP_DIR "${SDK_BUILD_DIR}/stamp"
-    BINARY_DIR "${SDK_BUILD_DIR}"
-    STEP_TARGETS build
-    BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
-    INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
-    LIST_SEPARATOR | # Use the alternate list separator
-    CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
-    BUILD_ALWAYS NO #${DO_BUILD}
-)
-ExternalProject_Add_Step(sdk force_build
-	COMMENT "Forcing build for 'desktop'"
-	DEPENDEES configure
-	DEPENDERS build
-	ALWAYS 1
-)
 endif()
 include(FindPkgConfig)
 
-set(APP_DEPENDS sdk)
 find_package(Qt5 5.10 COMPONENTS Core REQUIRED)
 
 if ( NOT Qt5_FOUND )
@@ -257,62 +218,5 @@
 find_package(Mediastreamer2 CONFIG QUIET)
 find_package(ortp CONFIG QUIET)
 
-if(NOT (LinphoneCxx_FOUND) OR NOT (Linphone_FOUND) OR NOT (bctoolbox_FOUND) OR NOT (belcard_FOUND) OR NOT (Mediastreamer2_FOUND) OR NOT (ortp_FOUND) OR FORCE_APP_EXTERNAL_PROJECTS)
-	message("Projects are set as External projects. You can start building them by using for example : cmake --build . --target install")
-	ExternalProject_Add(linphone-qt PREFIX "${CMAKE_BINARY_DIR}/linphone-app"
-		SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app"
-		INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
-		BINARY_DIR "${CMAKE_BINARY_DIR}/linphone-app"
-		DEPENDS ${APP_DEPENDS}
-		BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
-		INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
-		LIST_SEPARATOR | # Use the alternate list separator
-		CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
-	# ${APP_OPTIONS}
-		BUILD_ALWAYS ON
-	)
-	if( ENABLE_BUILD_APP_PLUGINS)
-		ExternalProject_Add(app-plugins PREFIX "${CMAKE_BINARY_DIR}/plugins-app"
-			SOURCE_DIR "${CMAKE_SOURCE_DIR}/plugins"
-			INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
-			BINARY_DIR "${CMAKE_BINARY_DIR}/plugins-app"
-			DEPENDS linphone-qt
-			BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
-			INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
-			LIST_SEPARATOR | # Use the alternate list separator
-			CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
-		)
-	endif()
-	install(CODE "message(STATUS Running install)")
-	set(AUTO_REGENERATION auto_regeneration)
-	if(	ENABLE_BUILD_APP_PLUGINS)
-		add_custom_target(${AUTO_REGENERATION} ALL
-			COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}
-			DEPENDS app-plugins)
-	else()
-		add_custom_target(${AUTO_REGENERATION} ALL
-			COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}
-			DEPENDS linphone-qt)
-	endif()
-else()
-	message("Adding Linphone Desktop in an IDE-friendly state")
-	set(CMAKE_INSTALL_PREFIX "${APPLICATION_OUTPUT_DIR}")
-	add_subdirectory(${CMAKE_SOURCE_DIR}/linphone-app)
-	if(NOT LINPHONE_QT_ONLY)
-		add_dependencies(app-library ${APP_DEPENDS})
-	endif()
-	if( ENABLE_BUILD_APP_PLUGINS)
-		add_subdirectory(${CMAKE_SOURCE_DIR}/plugins "plugins-app")
-	endif()
-endif()
-ExternalProject_Add(linphone-qt-only PREFIX "${CMAKE_BINARY_DIR}/linphone-app"
-    SOURCE_DIR "${CMAKE_SOURCE_DIR}/linphone-app"
-    INSTALL_DIR "${APPLICATION_OUTPUT_DIR}"
-    BINARY_DIR "${CMAKE_BINARY_DIR}/linphone-app"
-    BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --config $<CONFIG> ${PROJECT_BUILD_COMMAND}
-#    INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Install step is already done at build time."
-    LIST_SEPARATOR | # Use the alternate list separator
-    CMAKE_ARGS ${APP_OPTIONS} ${USER_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -DCMAKE_PREFIX_PATH=${PREFIX_PATH}
-    EXCLUDE_FROM_ALL ON
-    #BUILD_ALWAYS ON
-)
+message("Adding Linphone Desktop in an IDE-friendly state")
+add_subdirectory(${CMAKE_SOURCE_DIR}/linphone-app)
diff -ru a/linphone-app/cmake_builder/additional_steps.cmake ./linphone-app/cmake_builder/additional_steps.cmake
--- a/linphone-app/cmake_builder/additional_steps.cmake	1970-01-01 01:00:01.000000000 +0100
+++ ./linphone-app/cmake_builder/additional_steps.cmake	2023-04-08 16:02:33.005843116 +0200
@@ -61,7 +61,7 @@
       SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/linphone_package"
       DOWNLOAD_COMMAND ""
       CMAKE_GENERATOR ${CMAKE_GENERATOR}
-      CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DCMAKE_INSTALL_PREFIX=${LINPHONE_BUILDER_WORK_DIR}/PACKAGE -DTOOLS_DIR=${CMAKE_BINARY_DIR}/programs -DLINPHONE_OUTPUT_DIR=${CMAKE_INSTALL_PREFIX} -DLINPHONE_DESKTOP_DIR=${CMAKE_CURRENT_LIST_DIR}/.. -DLINPHONE_SOURCE_DIR=${EP_linphone_SOURCE_DIR} ${ENABLE_VARIABLES} -DLINPHONE_BUILDER_SIGNING_IDENTITY=${LINPHONE_BUILDER_SIGNING_IDENTITY}
+      CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DCMAKE_INSTALL_PREFIX=${LINPHONE_BUILDER_WORK_DIR}/PACKAGE -DTOOLS_DIR=${CMAKE_BINARY_DIR}/programs -DLINPHONE_DESKTOP_DIR=${CMAKE_CURRENT_LIST_DIR}/.. -DLINPHONE_SOURCE_DIR=${EP_linphone_SOURCE_DIR} ${ENABLE_VARIABLES} -DLINPHONE_BUILDER_SIGNING_IDENTITY=${LINPHONE_BUILDER_SIGNING_IDENTITY}
     )
   endif ()
 endif ()
diff -ru a/linphone-app/CMakeLists.txt ./linphone-app/CMakeLists.txt
--- a/linphone-app/CMakeLists.txt	1970-01-01 01:00:01.000000000 +0100
+++ ./linphone-app/CMakeLists.txt	2023-04-08 16:01:32.699012115 +0200
@@ -21,17 +21,8 @@
 ################################################################################
 cmake_minimum_required(VERSION 3.1)
 
+include(linphoneqt_version.cmake)
 find_package(bctoolbox CONFIG)
-set(FULL_VERSION )
-bc_compute_full_version(FULL_VERSION)
-set(version_major )
-set(version_minor )
-set(version_patch )
-set(identifiers )
-set(metadata )
-bc_parse_full_version("${FULL_VERSION}" version_major version_minor version_patch identifiers metadata)
-
-project(linphoneqt VERSION "${version_major}.${version_minor}.${version_patch}")
 
 
 if(ENABLE_BUILD_VERBOSE)
@@ -51,7 +42,6 @@
 	set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 endif()
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
-list(APPEND CMAKE_MODULE_PATH "${LINPHONE_OUTPUT_DIR}/cmake")
 
 set(APP_LIBRARY app-library)
 set(APP_PLUGIN app-plugin)
diff --git a/linphone-app/linphoneqt_version.cmake b/linphone-app/linphoneqt_version.cmake
new file mode 100644
index 00000000..a85d3455
--- /dev/null
+++ b/linphone-app/linphoneqt_version.cmake
@@ -0,0 +1,1 @@
+project(linphoneqt VERSION ${GUIX-SET-VERSION})
\ No newline at end of file
diff -ru a/linphone-app/src/config.h.cmake b/linphone-app/src/config.h.cmake
--- a/linphone-app/src/config.h.cmake	1970-01-01 01:00:01.000000000 +0100
+++ b/linphone-app/src/config.h.cmake	2023-04-08 16:05:33.458349986 +0200
@@ -32,3 +32,4 @@
 #cmakedefine EXECUTABLE_NAME "${EXECUTABLE_NAME}"
 #cmakedefine MSPLUGINS_DIR "${MSPLUGINS_DIR}"
 #cmakedefine ENABLE_APP_WEBVIEW "${ENABLE_APP_WEBVIEW}"
+#define LINPHONE_QT_GIT_VERSION "${PROJECT_VERSION}"
\ No newline at end of file