add packaging setup

This commit is contained in:
Kyle Isom 2023-10-09 17:19:54 -07:00
parent b05cf56b1a
commit 3c99ef0f90
3 changed files with 47 additions and 8 deletions

View File

@ -1,11 +1,12 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
project(kge LANGUAGES CXX) project(kge LANGUAGES CXX VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(klib REQUIRED)
find_package(Freetype) find_package(Freetype)
if (DEFINED FREETYPE_INCLUDE_DIRS) if (DEFINED FREETYPE_INCLUDE_DIRS)
add_definitions(-DIMGUI_ENABLE_FREETYPE) add_definitions(-DIMGUI_ENABLE_FREETYPE)
@ -54,15 +55,12 @@ target_include_directories(imgui PUBLIC
ext/imgui/misc/freetype ext/imgui/misc/freetype
$<IF:$<TARGET_EXISTS:Freetype::Freetype>,${FREETYPE_INCLUDE_DIRS},>) $<IF:$<TARGET_EXISTS:Freetype::Freetype>,${FREETYPE_INCLUDE_DIRS},>)
include_directories(ext/ ${SDL2_INCLUDE_DIRS}) include_directories(ext/ ${SDL2_INCLUDE_DIRS} ${KLIB_INCLUDE_DIRS})
add_executable(BufferTest BufferTest.cc Buffer.cc)
add_test(BufferTest COMMAND BufferTest)
add_executable(kge add_executable(kge
kge.cc kge.cc
Buffer.cc
Buffer.h
) )
target_link_libraries(kge imgui) target_link_libraries(kge imgui ${KLIB_LIBRARIES})
install(TARGETS kge RUNTIME DESTINATION bin)
include(CMakePack.txt)

40
CMakePack.txt Normal file
View File

@ -0,0 +1,40 @@
# Packaging support
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_VENDOR "Shimmering Clarity")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Kyle's Graphical Editor")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# Debian settings
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "K. Isom")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Kyle's Graphical Editor")
set(CPACK_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"libc++1 (>= 3.7.0-1)"
"libsdl2-2.0-0"
"libfreetype6 (>= 2.11.1)"
)
set(CPACK_DEBIAN_PACKAGE_SECTION devel)
if(LINUX)
set(CPACK_GENERATOR "DEB;STGZ;TGZ")
elseif(APPLE)
set(CPACK_GENERATOR "PACKAGEMAKER")
elseif(MSVC OR MSYS OR MINGW)
set(CPACK_GENERATOR "NSIS;ZIP")
else()
set(CPACK_GENERATOR "ZIP")
endif()
set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
set(CPACK_SOURCE_IGNORE_FILES
/.git
/dist
/.*build.*)
include (CPack)

1
kge.cc
View File

@ -27,6 +27,7 @@ main(int argc, char *argv[])
// yet. // yet.
(void)argc; (void)argc;
(void)argv; (void)argv;
// Should this use the SDL_EVENTS subsystem? // Should this use the SDL_EVENTS subsystem?
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
std::cerr << "kge: failed to initialize SDL" << std::endl; std::cerr << "kge: failed to initialize SDL" << std::endl;