From 8d290c740db5da695ca447668e14b73e68e47a0e Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 27 Jul 2024 11:10:43 -0400 Subject: [PATCH] build: Simple CPack Package --- CMakeLists.txt | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 752aa1c..8c7cc86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ endif() set(QTAWESOME_VERSION "${QTAWESOME_VERSION_MAJOR}.${QTAWESOME_VERSION_MINOR}.${QTAWESOME_VERSION_PATCH}.${QTAWESOME_VERSION_TWEAK}") message(STATUS "Building QTAWESOME: ${QTAWESOME_VERSION}") -project(QtAwesome VERSION ${QTAWESOME_VERSION}) +project(QtAwesome VERSION ${QTAWESOME_VERSION} DESCRIPTION "Add Font Awesome icons to your Qt application") find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets) @@ -93,3 +93,51 @@ install(EXPORT QtAwesomeConfig ) export(EXPORT QtAwesomeConfig NAMESPACE QtAwesome::) + +## PACKAGES +#Generic Info +set(CPACK_PACKAGE_CONTACT "rick@blommersit.nl") +set(CPACK_STRIP_FILES TRUE) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.md") +set(CPACK_PACKAGE_NAME "QtAwesome") +set(CPACK_PACKAGE_VENDOR "gamecreature") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/gamecreature/QtAwesome") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMAKE_PROJECT_DESCRIPTION}) + +## SET OS NAME +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(OS_STRING "macos") +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(OS_STRING "win64") + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(OS_STRING "win32") + endif() +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(OS_STRING "linux_${CMAKE_SYSTEM_PROCESSOR}") +else() + set(OS_STRING ${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}) +endif() + +if (NOT CPACK_PACKAGE_VERSION) + set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION}) +endif() + +if(NOT BUILD_SHARED_LIBS) + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${OS_STRING}") +else() + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-static-${OS_STRING}") +endif() +set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}) +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) + +#Set base Name And Generator Based on the system +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(CPACK_GENERATOR "ZIP") +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") + set(CPACK_GENERATOR "7Z") +elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(CPACK_GENERATOR "TGZ") +endif() + +include(CPack)