diff options
author | stehu <[email protected]> | 2022-03-04 15:53:59 +0000 |
---|---|---|
committer | stehu <[email protected]> | 2022-03-04 15:53:59 +0000 |
commit | 912fb33a874e7f92ef8a6b206cffd45e0d6146fe (patch) | |
tree | c0bf02a58d0766469bb8c5e17d13e7719986c7ed /src | |
parent | <fix>(ci): Minor bug in modifying OS labels in ci files (diff) | |
download | GpgFrontend-912fb33a874e7f92ef8a6b206cffd45e0d6146fe.tar.gz GpgFrontend-912fb33a874e7f92ef8a6b206cffd45e0d6146fe.zip |
<fix, refactor, feat> adjust the project configuration
1. Fix possible problems with mac compilation
2. Add new third-party dependency libconfig
3. Use the correct project configuration to specify the C++ standard
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 83 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/ui/CMakeLists.txt | 6 |
3 files changed, 53 insertions, 43 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 45f28421..0769f11a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -253,6 +253,7 @@ if (APPLICATION_BUILD) endif () +# link options for GpgFrontend if (APPLICATION_BUILD) target_link_libraries(${AppName} gpgfrontend_ui) IF (MINGW) @@ -260,52 +261,54 @@ if (APPLICATION_BUILD) target_link_libraries(${AppName} crypto) elseif (APPLE) message(STATUS "Link Application Static Library For macOS") - target_link_libraries(${AppName} crypto intl) + target_link_libraries(${AppName} intl) else () message(STATUS "Link Application Static Library For Linux") target_link_libraries(${AppName} crypto pthread) endif () endif () -if (LINUX_INSTALL_SOFTWARE) - if (LINUX) - if (INSTALL_GPGFRONTEND_APP) - install(TARGETS ${AppName} - EXPORT GpgFrontendTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) - install(FILES ${CMAKE_SOURCE_DIR}/TRANSLATORS - DESTINATION /usr/local/share/${AppName}/) - install(FILES ${CMAKE_SOURCE_DIR}/resource/meta/pub.gpgfrontend.gpgfrontend.appdata.xml - DESTINATION /usr/share/metainfo/) - install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/desktop/ - DESTINATION /usr/share/applications/) - install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/pixmaps/ - DESTINATION /usr/share/pixmaps/) - install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/hicolor/ - DESTINATION /usr/share/icons/hicolor/) - endif () - if (MULTI_LANG_SUPPORT) - install(DIRECTORY ${LOCALE_OUTPUT_PATH}/ - DESTINATION ${CMAKE_INSTALL_FULL_LOCALEDIR}) - endif () - if (APP_PACKAGE_DEB) - message(STATUS "Configure Deb Package") - SET(CPACK_GENERATOR "DEB") - set(CPACK_INSTALL_PREFIX "/usr/local/") - set(CPACK_PACKAGE_NAME "gpgfrontend") - set(CPACK_DEBIAN_PACKAGE_NAME "gpgfrontend") - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") - set(CPACK_PACKAGE_CONTACT "[email protected]") - SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Saturneric") - set(CPACK_DEBIAN_PACKAGE_DEPENDS "gpg (>= 2.2), libqt5core5a (>= 5.9), libqt5gui5 (>= 5.9), libqt5widgets5 (>= 5.9), libqt5network5 (>= 5.9), libqt5printsupport5 (>= 5.9), libconfig++-dev (>=1.5)") - set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") - set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") - set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") - include(CPack) - endif () +# using c++ standard 17 +target_compile_features(${AppName} PUBLIC cxx_std_17) + +# if building linux package +if (LINUX AND LINUX_INSTALL_SOFTWARE) + if (INSTALL_GPGFRONTEND_APP) + install(TARGETS ${AppName} + EXPORT GpgFrontendTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + install(FILES ${CMAKE_SOURCE_DIR}/TRANSLATORS + DESTINATION /usr/local/share/${AppName}/) + install(FILES ${CMAKE_SOURCE_DIR}/resource/meta/pub.gpgfrontend.gpgfrontend.appdata.xml + DESTINATION /usr/share/metainfo/) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/desktop/ + DESTINATION /usr/share/applications/) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/pixmaps/ + DESTINATION /usr/share/pixmaps/) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource/hicolor/ + DESTINATION /usr/share/icons/hicolor/) + endif () + if (MULTI_LANG_SUPPORT) + install(DIRECTORY ${LOCALE_OUTPUT_PATH}/ + DESTINATION ${CMAKE_INSTALL_FULL_LOCALEDIR}) + endif () + if (APP_PACKAGE_DEB) + message(STATUS "Configure Deb Package") + SET(CPACK_GENERATOR "DEB") + set(CPACK_INSTALL_PREFIX "/usr/local/") + set(CPACK_PACKAGE_NAME "gpgfrontend") + set(CPACK_DEBIAN_PACKAGE_NAME "gpgfrontend") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") + set(CPACK_PACKAGE_CONTACT "[email protected]") + SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Saturneric") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "gpg (>= 2.2), libqt5core5a (>= 5.9), libqt5gui5 (>= 5.9), libqt5widgets5 (>= 5.9), libqt5network5 (>= 5.9), libqt5printsupport5 (>= 5.9), libconfig++-dev (>=1.5)") + set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") + set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") + set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") + include(CPack) endif () endif () diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 79f2bdc4..a72a1bf3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -49,8 +49,9 @@ target_link_libraries(gpgfrontend_core OpenSSL::SSL OpenSSL::Crypto) target_link_libraries(gpgfrontend_core QtAES) # link vmime if (NOT LINUX) + # macOS target_link_libraries(gpgfrontend_core - gpgfrontend_vmime ssl crypto intl iconv) + gpgfrontend_vmime intl iconv) if (MINGW) target_link_libraries(gpgfrontend_core ws2_32) endif () @@ -76,11 +77,13 @@ target_precompile_headers(gpgfrontend_core PUBLIC ${CMAKE_SOURCE_DIR}/src/GpgFrontend.h PUBLIC GpgFrontendCore.h) +# using std c++ 17 +target_compile_features(gpgfrontend_core PUBLIC cxx_std_17) + # link for different platforms if (MINGW) message(STATUS "Link GPG Static Library For MINGW") target_link_libraries(gpgfrontend_core wsock32) - target_compile_features(gpgfrontend_core PUBLIC cxx_std_17) elseif (APPLE) message(STATUS "Link GPG Static Library For macOS") target_link_libraries(gpgfrontend_core dl) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 12810174..001a776d 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -57,8 +57,9 @@ target_link_libraries(gpgfrontend_ui # link vmime if (NOT LINUX) + # macOS target_link_libraries(gpgfrontend_ui - gpgfrontend_vmime ssl crypto intl iconv) + gpgfrontend_vmime intl iconv) if (MINGW) target_link_libraries(gpgfrontend_ui ws2_32) endif () @@ -81,6 +82,9 @@ target_precompile_headers(gpgfrontend_ui PUBLIC GpgFrontendUI.h) target_include_directories(gpgfrontend_ui PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/gpgfrontend_ui_autogen/include) +# using std c++ 17 +target_compile_features(gpgfrontend_ui PUBLIC cxx_std_17) + # for xcode archive build if (XCODE_BUILD) set_target_properties(gpgfrontend_ui |