[qet] Patches for CMake build system. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Hello.
Here are some patches I developed while porting the newest QElectrotech release to FreeBSD. It'd be great if they can be included upstream, so we don't carry these patches in our tree.
Please CC me in replies, as I'm not subscribed to the list.
From 07744307d3538f0082cc42e8c3169a8ec2be629b Mon Sep 17 00:00:00 2001
From: Gleb Popov <6yearold@xxxxxxxxx>
Date: Mon, 15 Mar 2021 10:25:04 +0300
Subject: [PATCH 1/4] Add CMake option to allow using system KF5 libraries
---
cmake/fetch_kdeaddons.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/fetch_kdeaddons.cmake b/cmake/fetch_kdeaddons.cmake
index 96a60a169..ac5a340f9 100644
--- a/cmake/fetch_kdeaddons.cmake
+++ b/cmake/fetch_kdeaddons.cmake
@@ -19,9 +19,9 @@ message(" - fetch_kdeaddons")
if(DEFINED BUILD_WITH_KF5)
Include(FetchContent)
- set(BUILD_KF5_YES "YES")
+ option(BUILD_KF5 "Build KF5 libraries, use system ones otherwise" YES)
- if(DEFINED BUILD_KF5_YES)
+ if(BUILD_KF5)
if(NOT DEFINED KF5_GIT_TAG)
#https://qelectrotech.org/forum/viewtopic.php?pid=13924#p13924
--
2.30.0
From 53e75c485fc97be2af37734846d0867694aedf78 Mon Sep 17 00:00:00 2001
From: Gleb Popov <6yearold@xxxxxxxxx>
Date: Mon, 15 Mar 2021 10:26:22 +0300
Subject: [PATCH 4/4] Add installation phase to CMake build system
---
CMakeLists.txt | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5dd6eb707..0ff30a7b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,3 +131,28 @@ target_include_directories(
${QET_DIR}/sources/factory/ui
${QET_DIR}/sources/print
)
+
+install(TARGETS ${PROJECT_NAME})
+install(DIRECTORY ico/breeze-icons/16x16 DESTINATION ${QET_ICONS_PATH})
+install(DIRECTORY ico/breeze-icons/22x22 DESTINATION ${QET_ICONS_PATH})
+install(DIRECTORY ico/breeze-icons/32x32 DESTINATION ${QET_ICONS_PATH})
+install(DIRECTORY ico/breeze-icons/48x48 DESTINATION ${QET_ICONS_PATH})
+install(DIRECTORY ico/breeze-icons/64x64 DESTINATION ${QET_ICONS_PATH})
+install(DIRECTORY ico/breeze-icons/128x128 DESTINATION ${QET_ICONS_PATH})
+install(DIRECTORY ico/breeze-icons/256x256 DESTINATION ${QET_ICONS_PATH})
+install(DIRECTORY elements DESTINATION share/qelectrotech)
+install(DIRECTORY examples DESTINATION share/qelectrotech)
+install(DIRECTORY titleblocks DESTINATION share/qelectrotech)
+install(FILES LICENSE ELEMENTS.LICENSE CREDIT README ChangeLog DESTINATION share/doc/qelectrotech)
+install(FILES misc/qelectrotech.desktop DESTINATION share/applications)
+install(FILES misc/x-qet-element.xml
+ misc/x-qet-project.xml
+ misc/x-qet-titleblock.xml
+ DESTINATION share/mime/application)
+install(FILES misc/x-qet-element.desktop
+ misc/x-qet-project.desktop
+ misc/x-qet-titleblock.desktop
+ DESTINATION share/mimelnk/application)
+install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages)
+install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
+install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})
--
2.30.0
From 5dd9908f3df9399da49859c1d5f4869253aa8cd5 Mon Sep 17 00:00:00 2001
From: Gleb Popov <6yearold@xxxxxxxxx>
Date: Mon, 15 Mar 2021 10:25:54 +0300
Subject: [PATCH 3/4] Fix CMake build when git revision can't be determined
---
cmake/git_last_commit_sha.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmake/git_last_commit_sha.cmake b/cmake/git_last_commit_sha.cmake
index 931aa0876..0e8164121 100644
--- a/cmake/git_last_commit_sha.cmake
+++ b/cmake/git_last_commit_sha.cmake
@@ -28,9 +28,6 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# This strips terminating newline in the variable
string(REGEX REPLACE "\n$" "" GIT_COMMIT_SHA "${GIT_COMMIT_SHA}")
- # This adds to definitions => .cpp
- add_definitions(-DGIT_COMMIT_SHA="${GIT_COMMIT_SHA}")
-
if(NOT GIT_COMMIT_RESULT EQUAL "0")
message(
FATAL_ERROR
@@ -39,3 +36,6 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
", please check")
endif()
endif()
+
+# This adds to definitions => .cpp
+add_definitions(-DGIT_COMMIT_SHA="${GIT_COMMIT_SHA}")
--
2.30.0
From 6581a98d1d32c59daeb8ec79988ec7896c711aef Mon Sep 17 00:00:00 2001
From: Gleb Popov <6yearold@xxxxxxxxx>
Date: Mon, 15 Mar 2021 10:25:20 +0300
Subject: [PATCH 2/4] Add CMake option to allow using system pugixml library
---
cmake/fetch_pugixml.cmake | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/cmake/fetch_pugixml.cmake b/cmake/fetch_pugixml.cmake
index b5f870bea..88ac3cf7b 100644
--- a/cmake/fetch_pugixml.cmake
+++ b/cmake/fetch_pugixml.cmake
@@ -18,9 +18,16 @@ message(" - fetch_pugixml")
Include(FetchContent)
-FetchContent_Declare(
- pugixml
- GIT_REPOSITORY https://github.com/zeux/pugixml.git
- GIT_TAG v1.11.4)
+option(BUILD_PUGIXML "Build pugixml library, use system one otherwise" YES)
-FetchContent_MakeAvailable(pugixml)
+if(BUILD_PUGIXML)
+
+ FetchContent_Declare(
+ pugixml
+ GIT_REPOSITORY https://github.com/zeux/pugixml.git
+ GIT_TAG v1.11.4)
+
+ FetchContent_MakeAvailable(pugixml)
+else()
+ find_package(pugixml REQUIRED)
+endif()
--
2.30.0