139 lines
5.2 KiB
CMake
139 lines
5.2 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(kima2 VERSION 1.8.0)
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake")
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
#include(InstallRequiredSystemLibraries)
|
|
|
|
if(MSVC)
|
|
add_compile_options(/W4 /WX)
|
|
else()
|
|
#add_compile_options(-Wall -Wextra -pedantic -Woverloaded-virtual -Wredundant-decls -Wshadow)
|
|
add_compile_options(-Wall -Wextra)
|
|
endif()
|
|
|
|
configure_file(config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
|
configure_file(de.rustysoft.kima2.metainfo.xml.in ${PROJECT_BINARY_DIR}/de.rustysoft.kima2.metainfo.xml)
|
|
|
|
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)
|
|
|
|
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)
|
|
|
|
#if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES Debug)
|
|
# include(CTest)
|
|
# enable_testing()
|
|
# add_subdirectory(test)
|
|
#endif()
|
|
|
|
|
|
# CPack
|
|
|
|
set(CPACK_PACKAGE_EXECUTABLES "kima2" "KIMA2")
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ein kleines Kassenprogramm für Kindersachenmärkte")
|
|
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/misc\\\\kima2.bmp")
|
|
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/misc\\\\kima2.ico")
|
|
#set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\kima2.exe")
|
|
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")
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "KIMA2")
|
|
|
|
if (WIN32 AND NOT UNIX)
|
|
set(CPACK_GENERATOR "NSIS;ZIP")
|
|
#set(CPACK_CREATE_DESKTOP_LINKS "bin/kima2")
|
|
install(FILES "${CMAKE_SOURCE_DIR}/manual/Benutzerhandbuch.pdf"
|
|
"${CMAKE_SOURCE_DIR}/misc/kima2.ico"
|
|
DESTINATION bin)
|
|
set(CPACK_NSIS_MENU_LINKS "bin\\\\Benutzerhandbuch.pdf" "Handbuch")
|
|
else(WIN32 AND NOT UNIX)
|
|
set(CPACK_SOURCE_GENERATOR "TBZ2")
|
|
set(CPACK_GENERATOR "RPM;DEB")
|
|
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5printsupport5 (>= 5.4), libusb-1.0-0")
|
|
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")
|
|
set(CPACK_STRIP_FILES "bin/kima2")
|
|
set(CPACK_SOURCE_STRIP_FILES "")
|
|
install(FILES ${CMAKE_SOURCE_DIR}/misc/kima2.desktop DESTINATION share/applications)
|
|
install(FILES "${CMAKE_SOURCE_DIR}/manual/Benutzerhandbuch.pdf"
|
|
DESTINATION share/${PROJECT_NAME})
|
|
install(FILES "${CMAKE_SOURCE_DIR}/misc/kima2.svg"
|
|
DESTINATION share/icons/hicolor/scalable/apps)
|
|
install(FILES de.rustysoft.kima2.metainfo.xml
|
|
DESTINATION share/metainfo)
|
|
endif (WIN32 AND NOT UNIX)
|
|
|
|
if( MINGW )
|
|
message( STATUS " Installing system-libraries: MinGW DLLs." )
|
|
get_filename_component( MINGW_PATH ${CMAKE_CXX_COMPILER} PATH )
|
|
set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
|
|
${MINGW_PATH}/libstdc++-6.dll
|
|
${MINGW_PATH}/libgcc_s_seh-1.dll
|
|
${MINGW_PATH}/Qt6Core.dll
|
|
${MINGW_PATH}/Qt6Gui.dll
|
|
${MINGW_PATH}/Qt6Widgets.dll
|
|
${MINGW_PATH}/Qt6PrintSupport.dll
|
|
${MINGW_PATH}/Qt6Network.dll
|
|
${MINGW_PATH}/libwinpthread-1.dll
|
|
${MINGW_PATH}/libsqlite3-0.dll
|
|
${MINGW_PATH}/libusb-1.0.dll
|
|
${MINGW_PATH}/libicuuc73.dll
|
|
${MINGW_PATH}/libicuin73.dll
|
|
${MINGW_PATH}/libicudt73.dll
|
|
${MINGW_PATH}/libpcre2-16-0.dll
|
|
${MINGW_PATH}/libpcre2-8-0.dll
|
|
${MINGW_PATH}/zlib1.dll
|
|
${MINGW_PATH}/libharfbuzz-0.dll
|
|
${MINGW_PATH}/libpng16-16.dll
|
|
${MINGW_PATH}/libfreetype-6.dll
|
|
${MINGW_PATH}/libglib-2.0-0.dll
|
|
${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
|
|
${MINGW_PATH}/libmd4c.dll
|
|
${MINGW_PATH}/libbrotlicommon.dll
|
|
${MINGW_PATH}/libbrotlidec.dll
|
|
${MINGW_PATH}/libfmt.dll
|
|
${MINGW_PATH}/libb2-1.dll
|
|
${MINGW_PATH}/libiconv-2.dll)
|
|
install(FILES ${MINGW_PATH}/../share/qt6/plugins/platforms/qwindows.dll
|
|
${MINGW_PATH}/../share/qt6/plugins/platforms/qminimal.dll
|
|
DESTINATION bin/platforms)
|
|
#install(FILES ${MINGW_PATH}/../share/qt6/plugins/printsupport/windowsprintersupport.dll
|
|
# DESTINATION bin/printsupport)
|
|
install(FILES ${MINGW_PATH}/../share/qt6/translations/qtbase_de.qm
|
|
${MINGW_PATH}/../share/qt6/translations/qt_de.qm
|
|
${MINGW_PATH}/../share/qt6/translations/qt_help_de.qm
|
|
${MINGW_PATH}/../share/qt6/translations/qtmultimedia_de.qm
|
|
#${MINGW_PATH}/../share/qt6/translations/qtquickcontrols_de.qm
|
|
#${MINGW_PATH}/../share/qt6/translations/qtscript_de.qm
|
|
#${MINGW_PATH}/../share/qt6/translations/qtxmlpatterns_de.qm
|
|
DESTINATION bin/translations)
|
|
endif( MINGW )
|
|
|
|
include(InstallRequiredSystemLibraries)
|
|
include(CPack)
|