127 lines
4.7 KiB
CMake
127 lines
4.7 KiB
CMake
cmake_minimum_required(VERSION 3.8)
|
|
|
|
project(kima2 VERSION 1.1.0)
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake")
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
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)
|
|
endif()
|
|
|
|
configure_file(config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
|
|
|
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(3rdparty)
|
|
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)
|
|
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}/Qt5Core.dll
|
|
${MINGW_PATH}/Qt5Gui.dll
|
|
${MINGW_PATH}/Qt5Widgets.dll
|
|
${MINGW_PATH}/Qt5PrintSupport.dll
|
|
${MINGW_PATH}/libwinpthread-1.dll
|
|
${MINGW_PATH}/libsqlite3-0.dll
|
|
${MINGW_PATH}/libusb-1.0.dll
|
|
${MINGW_PATH}/libxlnt.dll
|
|
${MINGW_PATH}/libicuuc62.dll
|
|
${MINGW_PATH}/libicuin62.dll
|
|
${MINGW_PATH}/libicudt62.dll
|
|
${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
|
|
${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}/libiconv-2.dll)
|
|
install(FILES ${MINGW_PATH}/../share/qt5/plugins/platforms/qwindows.dll
|
|
${MINGW_PATH}/../share/qt5/plugins/platforms/qminimal.dll
|
|
DESTINATION bin/platforms)
|
|
install(FILES ${MINGW_PATH}/../share/qt5/plugins/printsupport/windowsprintersupport.dll
|
|
DESTINATION bin/printsupport)
|
|
install(FILES ${MINGW_PATH}/../share/qt5/translations/qtbase_de.qm
|
|
${MINGW_PATH}/../share/qt5/translations/qt_de.qm
|
|
${MINGW_PATH}/../share/qt5/translations/qt_help_de.qm
|
|
${MINGW_PATH}/../share/qt5/translations/qtmultimedia_de.qm
|
|
${MINGW_PATH}/../share/qt5/translations/qtquickcontrols_de.qm
|
|
${MINGW_PATH}/../share/qt5/translations/qtscript_de.qm
|
|
${MINGW_PATH}/../share/qt5/translations/qtxmlpatterns_de.qm
|
|
DESTINATION bin/translations)
|
|
endif( MINGW )
|
|
|
|
include(InstallRequiredSystemLibraries)
|
|
include(CPack)
|