kima2/CMakeLists.txt

135 lines
4.9 KiB
Text
Raw Normal View History

2018-07-06 10:53:13 +02:00
cmake_minimum_required(VERSION 3.8)
2018-07-03 16:35:00 +02:00
2021-09-20 08:05:37 +02:00
project(kima2 VERSION 1.5.3)
2018-07-05 16:29:43 +02:00
2019-04-12 12:49:09 +02:00
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake")
2018-07-06 13:29:53 +02:00
2022-07-07 15:31:32 +02:00
set(CMAKE_CXX_STANDARD 20)
2018-07-06 10:53:13 +02:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2018-08-07 12:52:24 +02:00
#include(InstallRequiredSystemLibraries)
2018-07-03 16:35:00 +02:00
if(MSVC)
add_compile_options(/W4 /WX)
else()
2019-10-06 10:22:11 +02:00
#add_compile_options(-Wall -Wextra -pedantic -Woverloaded-virtual -Wredundant-decls -Wshadow)
add_compile_options(-Wall -Wextra)
2018-07-03 16:35:00 +02:00
endif()
2018-07-05 16:29:43 +02:00
2018-07-30 16:39:33 +02:00
configure_file(config.h.in ${PROJECT_BINARY_DIR}/config.h)
2018-07-05 16:40:45 +02:00
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
2018-07-05 16:29:43 +02:00
2018-10-18 12:06:36 +02:00
option(KIMA2_USE_EXTERNAL_JSON "Use an external JSON library" OFF)
if(KIMA2_USE_EXTERNAL_JSON)
find_package(nlohmann_json REQUIRED)
endif()
add_subdirectory(subprojects)
add_subdirectory(src)
2018-07-11 16:08:36 +02:00
2019-10-04 15:15:43 +02:00
#if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug)
# include(CTest)
# enable_testing()
# add_subdirectory(test)
#endif()
2018-07-11 16:08:36 +02:00
2018-08-07 12:52:24 +02:00
# CPack
set(CPACK_PACKAGE_EXECUTABLES "kima2" "KIMA2")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ein kleines Kassenprogramm für Kindersachenmärkte")
2018-08-07 13:45:33 +02:00
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/misc\\\\kima2.bmp")
2018-08-07 14:47:52 +02:00
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/misc\\\\kima2.ico")
2018-08-09 14:14:25 +02:00
#set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\kima2.exe")
2018-08-07 12:52:24 +02:00
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VENDOR "Martin Brodbeck")
set(CPACK_PACKAGE_CONTACT "Martin Brodbeck <info@rustysoft.de>")
set(CPACK_SOURCE_IGNORE_FILES "/.git/;/.vscode")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
2018-08-07 13:51:10 +02:00
set(CPACK_PACKAGE_INSTALL_DIRECTORY "KIMA2")
2018-08-07 12:52:24 +02:00
if (WIN32 AND NOT UNIX)
set(CPACK_GENERATOR "NSIS;ZIP")
2018-08-07 16:06:01 +02:00
#set(CPACK_CREATE_DESKTOP_LINKS "bin/kima2")
2018-08-07 16:14:47 +02:00
install(FILES "${CMAKE_SOURCE_DIR}/manual/Benutzerhandbuch.pdf"
2018-08-07 16:39:46 +02:00
"${CMAKE_SOURCE_DIR}/misc/kima2.ico"
DESTINATION bin)
2018-08-07 16:14:47 +02:00
set(CPACK_NSIS_MENU_LINKS "bin\\\\Benutzerhandbuch.pdf" "Handbuch")
2018-08-07 12:52:24 +02:00
else(WIN32 AND NOT UNIX)
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_GENERATOR "RPM;DEB")
2018-08-08 15:52:49 +02:00
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
2018-10-18 13:55:57 +02:00
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5printsupport5 (>= 5.4), libusb-1.0-0")
2018-08-16 15:23:23 +02:00
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
"/usr/share/applications"
"/usr/share/icons"
"/usr/share/icons/hicolor"
"/usr/share/icons/hicolor/scalable"
"/usr/share/icons/hicolor/scalable/apps")
2018-08-07 12:52:24 +02:00
set(CPACK_STRIP_FILES "bin/kima2")
set(CPACK_SOURCE_STRIP_FILES "")
2018-08-07 17:33:17 +02:00
install(FILES ${CMAKE_SOURCE_DIR}/misc/kima2.desktop DESTINATION share/applications)
2018-08-07 16:14:47 +02:00
install(FILES "${CMAKE_SOURCE_DIR}/manual/Benutzerhandbuch.pdf"
2018-08-07 17:45:01 +02:00
DESTINATION share/${PROJECT_NAME})
2018-08-07 17:33:17 +02:00
install(FILES "${CMAKE_SOURCE_DIR}/misc/kima2.svg"
DESTINATION share/icons/hicolor/scalable/apps)
2018-08-07 12:52:24 +02:00
endif (WIN32 AND NOT UNIX)
2018-08-07 13:17:30 +02:00
if( MINGW )
message( STATUS " Installing system-libraries: MinGW DLLs." )
get_filename_component( MINGW_PATH ${CMAKE_CXX_COMPILER} PATH )
2018-08-07 13:29:56 +02:00
set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${MINGW_PATH}/libstdc++-6.dll
${MINGW_PATH}/libgcc_s_seh-1.dll
${MINGW_PATH}/Qt5Core.dll
${MINGW_PATH}/Qt5Gui.dll
${MINGW_PATH}/Qt5Widgets.dll
${MINGW_PATH}/Qt5PrintSupport.dll
2020-02-12 16:12:40 +01:00
${MINGW_PATH}/Qt5Network.dll
2018-08-07 13:29:56 +02:00
${MINGW_PATH}/libwinpthread-1.dll
${MINGW_PATH}/libsqlite3-0.dll
${MINGW_PATH}/libusb-1.0.dll
${MINGW_PATH}/libxlnt.dll
2021-09-21 10:36:43 +02:00
${MINGW_PATH}/libicuuc69.dll
${MINGW_PATH}/libicuin69.dll
${MINGW_PATH}/libicudt69.dll
2018-08-07 13:29:56 +02:00
${MINGW_PATH}/libpcre2-16-0.dll
${MINGW_PATH}/zlib1.dll
${MINGW_PATH}/libharfbuzz-0.dll
${MINGW_PATH}/libpng16-16.dll
${MINGW_PATH}/libfreetype-6.dll
2018-08-07 13:38:21 +02:00
${MINGW_PATH}/libglib-2.0-0.dll
2018-08-07 13:29:56 +02:00
${MINGW_PATH}/libgraphite2.dll
${MINGW_PATH}/libbz2-1.dll
${MINGW_PATH}/libintl-8.dll
${MINGW_PATH}/libpcre-1.dll
${MINGW_PATH}/libdouble-conversion.dll
${MINGW_PATH}/libzstd.dll
2021-09-21 10:36:43 +02:00
${MINGW_PATH}/libmd4c.dll
2021-09-21 10:49:54 +02:00
${MINGW_PATH}/libbrotlicommon.dll
2021-09-21 10:36:43 +02:00
${MINGW_PATH}/libbrotlidec.dll
2018-08-07 14:35:27 +02:00
${MINGW_PATH}/libiconv-2.dll)
install(FILES ${MINGW_PATH}/../share/qt5/plugins/platforms/qwindows.dll
2018-10-19 11:26:05 +02:00
${MINGW_PATH}/../share/qt5/plugins/platforms/qminimal.dll
2018-08-07 14:35:27 +02:00
DESTINATION bin/platforms)
install(FILES ${MINGW_PATH}/../share/qt5/plugins/printsupport/windowsprintersupport.dll
DESTINATION bin/printsupport)
2018-08-07 14:35:27 +02:00
install(FILES ${MINGW_PATH}/../share/qt5/translations/qtbase_de.qm
2018-08-07 14:39:54 +02:00
${MINGW_PATH}/../share/qt5/translations/qt_de.qm
${MINGW_PATH}/../share/qt5/translations/qt_help_de.qm
2018-08-07 14:44:36 +02:00
${MINGW_PATH}/../share/qt5/translations/qtmultimedia_de.qm
2019-04-10 13:29:51 +02:00
${MINGW_PATH}/../share/qt5/translations/qtquickcontrols_de.qm
2018-08-07 14:44:36 +02:00
${MINGW_PATH}/../share/qt5/translations/qtscript_de.qm
${MINGW_PATH}/../share/qt5/translations/qtxmlpatterns_de.qm
2018-08-07 14:35:27 +02:00
DESTINATION bin/translations)
2018-08-07 13:17:30 +02:00
endif( MINGW )
2018-08-07 12:52:24 +02:00
2018-08-07 13:17:30 +02:00
include(InstallRequiredSystemLibraries)
2018-08-07 17:33:17 +02:00
include(CPack)