From d42955789ce1015466d2de8062bdfa852e9107b5 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sat, 8 Dec 2018 01:46:08 +0100 Subject: [PATCH] clean up cmake files and import include templates into the engine --- CMakeLists.txt | 2 - cmake/FindAllegro5.cmake | 9 +- cmake/FindAllegro5ACodec.cmake | 6 +- cmake/FindAllegro5Audio.cmake | 6 +- cmake/FindAllegro5Color.cmake | 6 +- cmake/FindAllegro5Font.cmake | 6 +- cmake/FindAllegro5Image.cmake | 6 +- cmake/FindAllegro5Main.cmake | 5 +- cmake/FindAllegro5Primitives.cmake | 6 +- cmake/FindAllegro5TTF.cmake | 6 +- cmake/FindAllegro5Video.cmake | 6 +- cmake/SetPaths.cmake | 269 --------------------------- cmake/libsuperderpy-data.cmake | 27 +++ cmake/libsuperderpy-gamestates.cmake | 11 ++ cmake/libsuperderpy-icons.cmake | 12 ++ cmake/libsuperderpy-src.cmake | 30 +++ cmake/libsuperderpy.cmake | 38 +++- src/CMakeLists.txt | 2 +- 18 files changed, 143 insertions(+), 310 deletions(-) delete mode 100644 cmake/SetPaths.cmake create mode 100644 cmake/libsuperderpy-data.cmake create mode 100644 cmake/libsuperderpy-gamestates.cmake create mode 100644 cmake/libsuperderpy-icons.cmake create mode 100644 cmake/libsuperderpy-src.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 494e4ae..a61e3a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,5 @@ project(libsuperderpy C) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") include(libsuperderpy) -include(SetPaths) add_subdirectory(src) - diff --git a/cmake/FindAllegro5.cmake b/cmake/FindAllegro5.cmake index ee94afe..74e6d9e 100644 --- a/cmake/FindAllegro5.cmake +++ b/cmake/FindAllegro5.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_INCLUDE_DIR allegro5/allegro.h) SET(ALLEGRO5_NAMES ${ALLEGRO5_NAMES} allegro liballegro Allegro-5.2 allegro-debug allegro-static liballegro_static allegro_static) -FIND_LIBRARY(ALLEGRO5_LIBRARY NAMES ${ALLEGRO5_NAMES} ) +FIND_LIBRARY(ALLEGRO5_LIBRARY NAMES ${ALLEGRO5_NAMES}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,9 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5 DEFAULT_MSG ALLEGRO5_LIBRARY ALLEGRO5_INCLUDE_DIR) IF(ALLEGRO5_FOUND) - SET(ALLEGRO5_LIBRARIES ${ALLEGRO5_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_LIBRARIES}) + SET(ALLEGRO5_LIBRARIES ${ALLEGRO5_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_LIBRARIES}) + get_filename_component(ALLEGRO5_DIRECTORY ${ALLEGRO5_LIBRARY} PATH) ENDIF(ALLEGRO5_FOUND) -MARK_AS_ADVANCED(ALLEGRO5_LIBRARY ALLEGRO5_INCLUDE_DIR ) +MARK_AS_ADVANCED(ALLEGRO5_LIBRARY ALLEGRO5_INCLUDE_DIR ALLEGRO5_DIRECTORY) diff --git a/cmake/FindAllegro5ACodec.cmake b/cmake/FindAllegro5ACodec.cmake index a016980..3125c5c 100644 --- a/cmake/FindAllegro5ACodec.cmake +++ b/cmake/FindAllegro5ACodec.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_ACODEC_INCLUDE_DIR allegro5/allegro_acodec.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_ACODEC_NAMES ${ALLEGRO5_ACODEC_NAMES} allegro_acodec liballegro_acodec AllegroAcodec-5.2 allegro_acodec-debug allegro_acodec_static liballegro_acodec_static allegro_acodec-static) -FIND_LIBRARY(ALLEGRO5_ACODEC_LIBRARY NAMES ${ALLEGRO5_ACODEC_NAMES} ) +FIND_LIBRARY(ALLEGRO5_ACODEC_LIBRARY NAMES ${ALLEGRO5_ACODEC_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_ACODEC_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_ACODEC DEFAULT_MSG ALLEGRO5_ACODEC_LIBRARY ALLEGRO5_ACODEC_INCLUDE_DIR) IF(ALLEGRO5_ACODEC_FOUND) - SET(ALLEGRO5_ACODEC_LIBRARIES ${ALLEGRO5_ACODEC_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_ACODEC_LIBRARIES}) + SET(ALLEGRO5_ACODEC_LIBRARIES ${ALLEGRO5_ACODEC_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_ACODEC_LIBRARIES}) ENDIF(ALLEGRO5_ACODEC_FOUND) MARK_AS_ADVANCED(ALLEGRO5_ACODEC_LIBRARY ALLEGRO5_ACODEC_INCLUDE_DIR ) diff --git a/cmake/FindAllegro5Audio.cmake b/cmake/FindAllegro5Audio.cmake index 78c113c..244b864 100644 --- a/cmake/FindAllegro5Audio.cmake +++ b/cmake/FindAllegro5Audio.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_AUDIO_INCLUDE_DIR allegro5/allegro_audio.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_AUDIO_NAMES ${ALLEGRO5_AUDIO_NAMES} allegro_audio liballegro_audio AllegroAudio-5.2 allegro_audio-debug allegro_audio-static liballegro_audio_static allegro_audio_static) -FIND_LIBRARY(ALLEGRO5_AUDIO_LIBRARY NAMES ${ALLEGRO5_AUDIO_NAMES} ) +FIND_LIBRARY(ALLEGRO5_AUDIO_LIBRARY NAMES ${ALLEGRO5_AUDIO_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_AUDIO_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_AUDIO DEFAULT_MSG ALLEGRO5_AUDIO_LIBRARY ALLEGRO5_AUDIO_INCLUDE_DIR) IF(ALLEGRO5_AUDIO_FOUND) - SET(ALLEGRO5_AUDIO_LIBRARIES ${ALLEGRO5_AUDIO_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_AUDIO_LIBRARIES}) + SET(ALLEGRO5_AUDIO_LIBRARIES ${ALLEGRO5_AUDIO_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_AUDIO_LIBRARIES}) ENDIF(ALLEGRO5_AUDIO_FOUND) MARK_AS_ADVANCED(ALLEGRO5_AUDIO_LIBRARY ALLEGRO5_AUDIO_INCLUDE_DIR ) diff --git a/cmake/FindAllegro5Color.cmake b/cmake/FindAllegro5Color.cmake index 129b5bd..de555a4 100644 --- a/cmake/FindAllegro5Color.cmake +++ b/cmake/FindAllegro5Color.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_COLOR_INCLUDE_DIR allegro5/allegro_color.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_COLOR_NAMES ${ALLEGRO5_COLOR_NAMES} allegro_color liballegro_color AllegroColor-5.2 allegro_color-debug allegro_color-static allegro_color_static liballegro_color_static) -FIND_LIBRARY(ALLEGRO5_COLOR_LIBRARY NAMES ${ALLEGRO5_COLOR_NAMES} ) +FIND_LIBRARY(ALLEGRO5_COLOR_LIBRARY NAMES ${ALLEGRO5_COLOR_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_COLOR_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_COLOR DEFAULT_MSG ALLEGRO5_COLOR_LIBRARY ALLEGRO5_COLOR_INCLUDE_DIR) IF(ALLEGRO5_COLOR_FOUND) - SET(ALLEGRO5_COLOR_LIBRARIES ${ALLEGRO5_COLOR_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_COLOR_LIBRARIES}) + SET(ALLEGRO5_COLOR_LIBRARIES ${ALLEGRO5_COLOR_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_COLOR_LIBRARIES}) ENDIF(ALLEGRO5_COLOR_FOUND) MARK_AS_ADVANCED(ALLEGRO5_COLOR_LIBRARY ALLEGRO5_COLOR_INCLUDE_DIR ) diff --git a/cmake/FindAllegro5Font.cmake b/cmake/FindAllegro5Font.cmake index 299ad79..11b55a7 100644 --- a/cmake/FindAllegro5Font.cmake +++ b/cmake/FindAllegro5Font.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_FONT_INCLUDE_DIR allegro5/allegro_font.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_FONT_NAMES ${ALLEGRO5_FONT_NAMES} allegro_font liballegro_font AllegroFont-5.2 allegro_font-debug allegro_font_static liballegro_font_static allegro_font-static) -FIND_LIBRARY(ALLEGRO5_FONT_LIBRARY NAMES ${ALLEGRO5_FONT_NAMES} ) +FIND_LIBRARY(ALLEGRO5_FONT_LIBRARY NAMES ${ALLEGRO5_FONT_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_FONT_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_FONT DEFAULT_MSG ALLEGRO5_FONT_LIBRARY ALLEGRO5_FONT_INCLUDE_DIR) IF(ALLEGRO5_FONT_FOUND) - SET(ALLEGRO5_FONT_LIBRARIES ${ALLEGRO5_FONT_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_FONT_LIBRARIES}) + SET(ALLEGRO5_FONT_LIBRARIES ${ALLEGRO5_FONT_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_FONT_LIBRARIES}) ENDIF(ALLEGRO5_FONT_FOUND) MARK_AS_ADVANCED(ALLEGRO5_FONT_LIBRARY ALLEGRO5_FONT_INCLUDE_DIR ) diff --git a/cmake/FindAllegro5Image.cmake b/cmake/FindAllegro5Image.cmake index 9982fc8..fc814cd 100644 --- a/cmake/FindAllegro5Image.cmake +++ b/cmake/FindAllegro5Image.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_IMAGE_INCLUDE_DIR allegro5/allegro_image.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_IMAGE_NAMES ${ALLEGRO5_IMAGE_NAMES} allegro_image liballegro_image AllegroImage-5.2 allegro_image-debug allegro_image-static liballegro_image_static allegro_image_static) -FIND_LIBRARY(ALLEGRO5_IMAGE_LIBRARY NAMES ${ALLEGRO5_IMAGE_NAMES} ) +FIND_LIBRARY(ALLEGRO5_IMAGE_LIBRARY NAMES ${ALLEGRO5_IMAGE_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_IMAGE_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_IMAGE DEFAULT_MSG ALLEGRO5_IMAGE_LIBRARY ALLEGRO5_IMAGE_INCLUDE_DIR) IF(ALLEGRO5_IMAGE_FOUND) - SET(ALLEGRO5_IMAGE_LIBRARIES ${ALLEGRO5_IMAGE_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_IMAGE_LIBRARIES}) + SET(ALLEGRO5_IMAGE_LIBRARIES ${ALLEGRO5_IMAGE_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_IMAGE_LIBRARIES}) ENDIF(ALLEGRO5_IMAGE_FOUND) MARK_AS_ADVANCED(ALLEGRO5_IMAGE_LIBRARY ALLEGRO5_IMAGE_INCLUDE_DIR ) diff --git a/cmake/FindAllegro5Main.cmake b/cmake/FindAllegro5Main.cmake index d5a06a6..727c5ab 100644 --- a/cmake/FindAllegro5Main.cmake +++ b/cmake/FindAllegro5Main.cmake @@ -5,7 +5,7 @@ # SET(ALLEGRO5_MAIN_NAMES ${ALLEGRO5_MAIN_NAMES} allegro_main allegro_main_static liballegro_main liballegro_main_static allegro_main-debug) -FIND_LIBRARY(ALLEGRO5_MAIN_LIBRARY NAMES ${ALLEGRO5_MAIN_NAMES} ) +FIND_LIBRARY(ALLEGRO5_MAIN_LIBRARY NAMES ${ALLEGRO5_MAIN_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_MAIN_FOUND to TRUE if # all listed variables are TRUE @@ -13,7 +13,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_MAIN DEFAULT_MSG ALLEGRO5_MAIN_LIBRARY) IF(ALLEGRO5_MAIN_FOUND) - SET(ALLEGRO5_MAIN_LIBRARIES ${ALLEGRO5_MAIN_LIBRARY}) + SET(ALLEGRO5_MAIN_LIBRARIES ${ALLEGRO5_MAIN_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_MAIN_LIBRARIES}) ENDIF(ALLEGRO5_MAIN_FOUND) MARK_AS_ADVANCED(ALLEGRO5_MAIN_LIBRARY ) diff --git a/cmake/FindAllegro5Primitives.cmake b/cmake/FindAllegro5Primitives.cmake index 1036f8d..0a36bf4 100644 --- a/cmake/FindAllegro5Primitives.cmake +++ b/cmake/FindAllegro5Primitives.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_PRIMITIVES_INCLUDE_DIR allegro5/allegro_primitives.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_PRIMITIVES_NAMES ${ALLEGRO5_PRIMITIVES_NAMES} allegro_primitives liballegro_primitives AllegroPrimitives-5.2 allegro_primitives-debug allegro_primitives-static allegro_primitives_static liballegro_primitives_static) -FIND_LIBRARY(ALLEGRO5_PRIMITIVES_LIBRARY NAMES ${ALLEGRO5_PRIMITIVES_NAMES} ) +FIND_LIBRARY(ALLEGRO5_PRIMITIVES_LIBRARY NAMES ${ALLEGRO5_PRIMITIVES_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_PRIMITIVES_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_PRIMITIVES DEFAULT_MSG ALLEGRO5_PRIMITIVES_LIBRARY ALLEGRO5_PRIMITIVES_INCLUDE_DIR) IF(ALLEGRO5_PRIMITIVES_FOUND) - SET(ALLEGRO5_PRIMITIVES_LIBRARIES ${ALLEGRO5_PRIMITIVES_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_PRIMITIVES_LIBRARIES}) + SET(ALLEGRO5_PRIMITIVES_LIBRARIES ${ALLEGRO5_PRIMITIVES_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_PRIMITIVES_LIBRARIES}) ENDIF(ALLEGRO5_PRIMITIVES_FOUND) MARK_AS_ADVANCED(ALLEGRO5_PRIMITIVES_LIBRARY ALLEGRO5_PRIMITIVES_INCLUDE_DIR ) diff --git a/cmake/FindAllegro5TTF.cmake b/cmake/FindAllegro5TTF.cmake index b742da2..53a64ff 100644 --- a/cmake/FindAllegro5TTF.cmake +++ b/cmake/FindAllegro5TTF.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_TTF_INCLUDE_DIR allegro5/allegro_ttf.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_TTF_NAMES ${ALLEGRO5_TTF_NAMES} allegro_ttf liballegro_ttf AllegroTTF-5.2 allegro_ttf-debug allegro_ttf-static allegro_ttf_static liballegro_ttf_static) -FIND_LIBRARY(ALLEGRO5_TTF_LIBRARY NAMES ${ALLEGRO5_TTF_NAMES} ) +FIND_LIBRARY(ALLEGRO5_TTF_LIBRARY NAMES ${ALLEGRO5_TTF_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_TTF_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_TTF DEFAULT_MSG ALLEGRO5_TTF_LIBRARY ALLEGRO5_TTF_INCLUDE_DIR) IF(ALLEGRO5_TTF_FOUND) - SET(ALLEGRO5_TTF_LIBRARIES ${ALLEGRO5_TTF_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_TTF_LIBRARIES}) + SET(ALLEGRO5_TTF_LIBRARIES ${ALLEGRO5_TTF_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_TTF_LIBRARIES}) ENDIF(ALLEGRO5_TTF_FOUND) MARK_AS_ADVANCED(ALLEGRO5_TTF_LIBRARY ALLEGRO5_TTF_INCLUDE_DIR ) diff --git a/cmake/FindAllegro5Video.cmake b/cmake/FindAllegro5Video.cmake index d58b313..937a746 100644 --- a/cmake/FindAllegro5Video.cmake +++ b/cmake/FindAllegro5Video.cmake @@ -8,7 +8,7 @@ FIND_PATH(ALLEGRO5_VIDEO_INCLUDE_DIR allegro5/allegro_video.h HINTS ${ALLEGRO5_INCLUDE_DIR}) SET(ALLEGRO5_VIDEO_NAMES ${ALLEGRO5_VIDEO_NAMES} allegro_video liballegro_video AllegroVideo-5.2 allegro_video-debug allegro_video-static allegro_video_static liballegro_video_static) -FIND_LIBRARY(ALLEGRO5_VIDEO_LIBRARY NAMES ${ALLEGRO5_VIDEO_NAMES} ) +FIND_LIBRARY(ALLEGRO5_VIDEO_LIBRARY NAMES ${ALLEGRO5_VIDEO_NAMES} HINTS ${ALLEGRO5_DIRECTORY}) # handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_VIDEO_FOUND to TRUE if # all listed variables are TRUE @@ -16,8 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_VIDEO DEFAULT_MSG ALLEGRO5_VIDEO_LIBRARY ALLEGRO5_VIDEO_INCLUDE_DIR) IF(ALLEGRO5_VIDEO_FOUND) - SET(ALLEGRO5_VIDEO_LIBRARIES ${ALLEGRO5_VIDEO_LIBRARY}) - SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_VIDEO_LIBRARIES}) + SET(ALLEGRO5_VIDEO_LIBRARIES ${ALLEGRO5_VIDEO_LIBRARY}) + SET(ALLEGRO5_LIBS ${ALLEGRO5_LIBS} ${ALLEGRO5_VIDEO_LIBRARIES}) ENDIF(ALLEGRO5_VIDEO_FOUND) MARK_AS_ADVANCED(ALLEGRO5_VIDEO_LIBRARY ALLEGRO5_VIDEO_INCLUDE_DIR ) diff --git a/cmake/SetPaths.cmake b/cmake/SetPaths.cmake deleted file mode 100644 index b0c948b..0000000 --- a/cmake/SetPaths.cmake +++ /dev/null @@ -1,269 +0,0 @@ -# - Find include and library dirs, and define a some macros -# -# This module defines a bunch of variables used as locations for install directories. -# They can be relative (to CMAKE_INSTALL_PREFIX) or absolute. -# Under Windows they are always relative. -# -# BIN_INSTALL_DIR - the directory where executables will be installed (default is prefix/bin) -# BUNDLE_INSTALL_DIR - Mac only: the directory where application bundles will be installed (default is /Applications/KDE4 ) -# SBIN_INSTALL_DIR - the directory where system executables will be installed (default is prefix/sbin) -# LIB_INSTALL_DIR - the directory where libraries will be installed (default is prefix/lib) -# CONFIG_INSTALL_DIR - the config file install dir -# DATA_INSTALL_DIR - the parent directory where applications can install their data -# HTML_INSTALL_DIR - the HTML install dir for documentation -# ICON_INSTALL_DIR - the icon install dir (default prefix/share/icons/) -# INFO_INSTALL_DIR - the kde info install dir (default prefix/info) -# KCFG_INSTALL_DIR - the install dir for kconfig files -# TRANSLATIONS_INSTALL_DIR - the install dir for translations -# MAN_INSTALL_DIR - the kde man page install dir (default prefix/man/) -# MIME_INSTALL_DIR - the install dir for the mimetype desktop files -# PLUGIN_INSTALL_DIR - the subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4) -# SERVICES_INSTALL_DIR - the install dir for service (desktop, protocol, ...) files -# SERVICETYPES_INSTALL_DIR - the install dir for servicestypes desktop files -# SOUND_INSTALL_DIR - the install dir for sound files -# TEMPLATES_INSTALL_DIR - the install dir for templates (Create new file...) -# WALLPAPER_INSTALL_DIR - the install dir for wallpapers -# DEMO_INSTALL_DIR - the install dir for demos -# KCONF_UPDATE_INSTALL_DIR - the kconf_update install dir -# XDG_APPS_INSTALL_DIR - the XDG apps dir -# XDG_DIRECTORY_INSTALL_DIR- the XDG directory -# XDG_MIME_INSTALL_DIR - the XDG mimetypes install dir -# DBUS_INTERFACES_INSTALL_DIR - the directory where dbus interfaces be installed (default is prefix/share/dbus-1/interfaces) -# DBUS_SERVICES_INSTALL_DIR - the directory where dbus services be installed (default is prefix/share/dbus-1/services ) -# -# A note on the possible values for CMAKE_BUILD_TYPE and how KDE handles -# the flags for those buildtypes. FindKDE4Internal supports the values -# Debug, Release, Relwithdebinfo, Profile and Debugfull -# -# Release -# optimised for speed, qDebug/kDebug turned off, no debug symbols -# Release with debug info -# optimised for speed, debugging symbols on (-g) -# Debug -# optimised but debuggable, debugging on (-g) -# (-fno-reorder-blocks -fno-schedule-insns -fno-inline) -# DebugFull -# no optimisation, full debugging on (-g3) -# Profile -# DebugFull + -ftest-coverage -fprofile-arcs -# -# It is expected that the "Debug" build type be still debuggable with gdb -# without going all over the place, but still produce better performance. -# It's also important to note that gcc cannot detect all warning conditions -# unless the optimiser is active. -# - -# Copyright (c) 2006-2008, Alexander Neundorf -# Copyright (c) 2006, Laurent Montel, -# Copyright (c) 2008, BogDan Vatra, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - - -########## the following are directories where stuff will be installed to ########### -# -# this has to be after find_xxx() block above - -if (WIN32) -# use relative install prefix to avoid hardcoded install paths in cmake_install.cmake files - - set(LIB_INSTALL_DIR "bin" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}) - - set(EXEC_INSTALL_PREFIX "${EXEC_INSTALL_PREFIX}" ) # Base directory for executables and libraries - set(SHARE_INSTALL_PREFIX "share" ) # Base directory for files which go to share/ - set(BIN_INSTALL_DIR "bin" ) # The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin) - set(SBIN_INSTALL_DIR "sbin" ) # The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin) - - set(LIBEXEC_INSTALL_DIR "${BIN_INSTALL_DIR}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${BIN_INSTALL_DIR}) - set(INCLUDE_INSTALL_DIR "include" ) # The subdirectory to the header prefix - - set(PLUGIN_INSTALL_DIR "bin/report" ) # The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/report) - set(EXARO_PLUGIN_INSTALL_DIR "bin/exaro" ) # The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/report) - set(CONFIG_INSTALL_DIR "share/config" ) # The config file install dir - set(DATA_INSTALL_DIR "share/apps" ) # The parent directory where applications can install their data - set(HTML_INSTALL_DIR "share/doc/HTML" ) # The HTML install dir for documentation - set(ICON_INSTALL_DIR "share/icons" ) # The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/) - set(KCFG_INSTALL_DIR "share/config.kcfg" ) # The install dir for kconfig files - set(TRANSLATIONS_INSTALL_DIR "bin/translations" ) # The install dir for translations - set(MIME_INSTALL_DIR "share/mimelnk" ) # The install dir for the mimetype desktop files - set(SERVICES_INSTALL_DIR "share/kde4/services" ) # The install dir for service (desktop, protocol, ...) files - set(SERVICETYPES_INSTALL_DIR "share/kde4/servicetypes" ) # The install dir for servicestypes desktop files - set(SOUND_INSTALL_DIR "share/sounds" ) # The install dir for sound files - set(TEMPLATES_INSTALL_DIR "share/templates" ) # The install dir for templates (Create new file...) - set(WALLPAPER_INSTALL_DIR "share/wallpapers" ) # The install dir for wallpapers - set(DEMO_INSTALL_DIR "share/demos" ) # The install dir for demos - set(KCONF_UPDATE_INSTALL_DIR "share/apps/kconf_update" ) # The kconf_update install dir - set(AUTOSTART_INSTALL_DIR "share/autostart" ) # The install dir for autostart files - - set(XDG_APPS_INSTALL_DIR "share/applications" ) # The XDG apps dir - set(XDG_DIRECTORY_INSTALL_DIR "share/desktop-directories" ) # The XDG directory - set(XDG_MIME_INSTALL_DIR "share/mime" ) # The install dir for the xdg mimetypes - - set(SYSCONF_INSTALL_DIR "etc" ) # The kde sysconfig install dir (default /etc) - set(MAN_INSTALL_DIR "share/man" ) # The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/) - set(INFO_INSTALL_DIR "share/info" ) # The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") - set(DBUS_INTERFACES_INSTALL_DIR "share/dbus-1/interfaces" ) # The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") - set(DBUS_SERVICES_INSTALL_DIR "share/dbus-1/services" ) # The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") - -else (WIN32) - - # This macro implements some very special logic how to deal with the cache. - # By default the various install locations inherit their value from their "parent" variable - # so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will - # calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX . - # This would work completely without using the cache. - # But if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into - # the cache, otherwise it will be forgotten on the next cmake run. - # Once a variable is in the cache, it doesn't depend on its "parent" variables - # anymore and you can only change it by editing it directly. - # this macro helps in this regard, because as long as you don't set one of the - # variables explicitely to some location, it will always calculate its value from its - # parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect. - # But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location - # this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX. - # - # additionally if installing to the same location as kdelibs, the other install - # directories are reused from the installed kdelibs - macro(_SET_FANCY _var _value _comment) - set(predefinedvalue "${_value}") - - if (NOT DEFINED ${_var}) - set(${_var} ${predefinedvalue}) - else (NOT DEFINED ${_var}) - set(${_var} "${${_var}}" CACHE PATH "${_comment}") - endif (NOT DEFINED ${_var}) - endmacro(_SET_FANCY) - - if(APPLE) - set(BUNDLE_INSTALL_DIR "/Applications" CACHE PATH "Directory where application bundles will be installed to on OSX" ) - endif(APPLE) - - _set_fancy(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries") - _set_fancy(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/") - _set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") - _set_fancy(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)") - _set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})") - _set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde4/libexec)") - _set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix") - - _set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/report" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/report)") - _set_fancy(EXARO_PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/exaro" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/report)") - _set_fancy(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir") - _set_fancy(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data") - _set_fancy(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" "The HTML install dir for documentation") - _set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)") - _set_fancy(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files") - _set_fancy(TRANSLATIONS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/eXaro/translations" "The install dir for translations") - _set_fancy(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files") - _set_fancy(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/services" "The install dir for service (desktop, protocol, ...) files") - _set_fancy(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/servicetypes" "The install dir for servicestypes desktop files") - _set_fancy(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files") - _set_fancy(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)") - _set_fancy(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers") - _set_fancy(DEMO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/demos" "The install dir for demos") - _set_fancy(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir") - _set_fancy(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files") - - _set_fancy(XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications" "The XDG apps dir") - _set_fancy(XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory") - _set_fancy(XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime" "The install dir for the xdg mimetypes") - - _set_fancy(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The kde sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)") - _set_fancy(MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/)") - _set_fancy(INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") - _set_fancy(DBUS_INTERFACES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces" "The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") - _set_fancy(DBUS_SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/services" "The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") - -endif (WIN32) - - -# The INSTALL_TARGETS_DEFAULT_ARGS variable should be used when libraries are installed. -# The arguments are also ok for regular executables, i.e. executables which don't go -# into sbin/ or libexec/, but for installing executables the basic syntax -# INSTALL(TARGETS kate DESTINATION "${BIN_INSTALL_DIR}") -# is enough, so using this variable there doesn't help a lot. -# The variable must not be used for installing plugins. -# Usage is like this: -# install(TARGETS kdecore kdeui ${INSTALL_TARGETS_DEFAULT_ARGS} ) -# -# This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go -# into bin/. -# Later on it will be possible to extend this for installing OSX frameworks -# The COMPONENT Devel argument has the effect that static libraries belong to the -# "Devel" install component. If we use this also for all install() commands -# for header files, it will be possible to install -# -everything: make install OR cmake -P cmake_install.cmake -# -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake -# -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake -# This can then also be used for packaging with cpack. - -set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel ) - -set(INSTALL_PLUGINS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}/report" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}/report" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}/report" COMPONENT Devel ) - -set(INSTALL_EXARO_TOOLBAR_PLUGINS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}/exaro/toolbars" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}/exaro/toolbars" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}/exaro/toolbars" COMPONENT Devel ) - -set(INSTALL_PLUGINS_EXPORT_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}/report/export" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}/report/export" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}/report/export" COMPONENT Devel ) - - - -# on the Mac support an extra install directory for application bundles starting with cmake 2.6 -if(APPLE) - set(INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS} - BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" ) -endif(APPLE) - - -set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} - "${INCLUDE_INSTALL_DIR}") - -set(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH} - "${BIN_INSTALL_DIR}" ) - -set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} - "${LIB_INSTALL_DIR}" ) - -# under Windows dlls may be also installed in bin/ -if(WIN32) - set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} - "${_CMAKE_INSTALL_DIR}/bin" - "${CMAKE_INSTALL_PREFIX}/bin" ) -endif(WIN32) - - -###################################################### -# and now the platform specific stuff -###################################################### - -# Set a default build type for single-configuration -# CMake generators if no build type is set. -if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RelWithDebInfo) -endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) - - - -# setup default RPATH/install_name handling, may be overridden by KDE4_HANDLE_RPATH_FOR_[LIBRARY|EXECUTABLE] -# default is to build with RPATH for the install dir, so it doesn't need to relink -if (UNIX) - if (APPLE) - set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR}) - else (APPLE) - # add our LIB_INSTALL_DIR to the RPATH and use the RPATH figured out by cmake when compiling - set(CMAKE_INSTALL_RPATH ${LIB_INSTALL_DIR} ) - set(CMAKE_SKIP_BUILD_RPATH TRUE) - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - endif (APPLE) -endif (UNIX) - diff --git a/cmake/libsuperderpy-data.cmake b/cmake/libsuperderpy-data.cmake new file mode 100644 index 0000000..f950fed --- /dev/null +++ b/cmake/libsuperderpy-data.cmake @@ -0,0 +1,27 @@ +SET(DATADIR "${CMAKE_INSTALL_PREFIX}/share/${LIBSUPERDERPY_GAMENAME}/data") + +if(APPLE) + SET(DATADIR "${CMAKE_INSTALL_PREFIX}/bin/${LIBSUPERDERPY_GAMENAME}.app/Contents/Resources/data") #OMG NASTY +endif(APPLE) + +add_subdirectory(icons) + +if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ANDROID) + if(EXISTS ${LIBSUPERDERPY_GAMENAME}.desktop) + install(FILES ${LIBSUPERDERPY_GAMENAME}.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) + endif(EXISTS ${LIBSUPERDERPY_GAMENAME}.desktop) + + if(EXISTS ${LIBSUPERDERPY_APPID}.appdata.xml) + install(FILES ${LIBSUPERDERPY_APPID}.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo) + endif(EXISTS ${LIBSUPERDERPY_APPID}.appdata.xml) +endif(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ANDROID) + +install(DIRECTORY . DESTINATION ${DATADIR} + PATTERN "stuff" EXCLUDE + PATTERN ".git" EXCLUDE + PATTERN ".gitignore" EXCLUDE + PATTERN ".directory" EXCLUDE + PATTERN "CMakeLists.txt" EXCLUDE) + +file(GLOB_RECURSE RES_FILES *) +add_custom_target(data SOURCES ${RES_FILES}) diff --git a/cmake/libsuperderpy-gamestates.cmake b/cmake/libsuperderpy-gamestates.cmake new file mode 100644 index 0000000..2362002 --- /dev/null +++ b/cmake/libsuperderpy-gamestates.cmake @@ -0,0 +1,11 @@ +FILE (GLOB gamestates "*.c") +FOREACH(gamestate ${gamestates}) + get_filename_component(gamestate_name ${gamestate} NAME_WE) + set(sources "${gamestate_name}.c") + FILE (GLOB submodules "${gamestate_name}/*.c") + FOREACH(submodule ${submodules}) + get_filename_component(submodule_name ${submodule} NAME_WE) + list(APPEND sources "${gamestate_name}/${submodule_name}.c") + ENDFOREACH(submodule) + register_gamestate(${gamestate_name} "${sources}") +ENDFOREACH(gamestate) diff --git a/cmake/libsuperderpy-icons.cmake b/cmake/libsuperderpy-icons.cmake new file mode 100644 index 0000000..64d3d74 --- /dev/null +++ b/cmake/libsuperderpy-icons.cmake @@ -0,0 +1,12 @@ +if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) + install(FILES 16/${LIBSUPERDERPY_GAMENAME}.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/16x16/apps) + install(FILES 32/${LIBSUPERDERPY_GAMENAME}.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/32x32/apps) + install(FILES 48/${LIBSUPERDERPY_GAMENAME}.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps) + install(FILES 64/${LIBSUPERDERPY_GAMENAME}.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/64x64/apps) + install(FILES 128/${LIBSUPERDERPY_GAMENAME}.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/128x128/apps) + install(FILES 256/${LIBSUPERDERPY_GAMENAME}.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps) + if(EXISTS ${LIBSUPERDERPY_GAMENAME}.svg) + install(FILES ${LIBSUPERDERPY_GAMENAME}.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps) + endif(EXISTS ${LIBSUPERDERPY_GAMENAME}.svg) +endif(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) +install(FILES ${LIBSUPERDERPY_GAMENAME}.png DESTINATION ${DATADIR}/icons) diff --git a/cmake/libsuperderpy-src.cmake b/cmake/libsuperderpy-src.cmake new file mode 100644 index 0000000..30b433f --- /dev/null +++ b/cmake/libsuperderpy-src.cmake @@ -0,0 +1,30 @@ +set(EXECUTABLE ${LIBSUPERDERPY_GAMENAME}) + +set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib/${LIBSUPERDERPY_GAMENAME}:\$ORIGIN/gamestates:\$ORIGIN:\$ORIGIN/../lib:\$ORIGIN/lib:\$ORIGIN/bin") + +if(MINGW) + # resource compilation for MinGW + if (EXISTS ${CMAKE_SOURCE_DIR}/data/icons/icon.rc) + set(EXECUTABLE_SRC_LIST ${EXECUTABLE_SRC_LIST} ${CMAKE_SOURCE_DIR}/data/icons/icon.rc) + endif (EXISTS ${CMAKE_SOURCE_DIR}/data/icons/icon.rc) +endif(MINGW) + +if (APPLE) + if (EXISTS ${CMAKE_SOURCE_DIR}/data/icons/${LIBSUPERDERPY_GAMENAME}.icns) + set(EXECUTABLE_SRC_LIST ${EXECUTABLE_SRC_LIST} ${CMAKE_SOURCE_DIR}/data/icons/${LIBSUPERDERPY_GAMENAME}.icns) + set_source_files_properties(${CMAKE_SOURCE_DIR}/data/icons/${LIBSUPERDERPY_GAMENAME}.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") + endif (EXISTS ${CMAKE_SOURCE_DIR}/data/icons/${LIBSUPERDERPY_GAMENAME}.icns) +endif(APPLE) + +add_libsuperderpy_target("${EXECUTABLE_SRC_LIST}") +target_link_libraries(${EXECUTABLE} "libsuperderpy-${LIBSUPERDERPY_GAMENAME}") +install(TARGETS ${EXECUTABLE} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + +add_library("libsuperderpy-${LIBSUPERDERPY_GAMENAME}" SHARED "common.c") +set_target_properties("libsuperderpy-${LIBSUPERDERPY_GAMENAME}" PROPERTIES PREFIX "") +target_link_libraries("libsuperderpy-${LIBSUPERDERPY_GAMENAME}" ${ALLEGRO5_LIBS} m libsuperderpy) +install(TARGETS "libsuperderpy-${LIBSUPERDERPY_GAMENAME}" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) + +add_subdirectory("gamestates") + +libsuperderpy_copy(${EXECUTABLE}) diff --git a/cmake/libsuperderpy.cmake b/cmake/libsuperderpy.cmake index a49aa73..343fc18 100644 --- a/cmake/libsuperderpy.cmake +++ b/cmake/libsuperderpy.cmake @@ -1,11 +1,16 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) + # Set a default build type for single-configuration + # CMake generators if no build type is set. + if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo) + endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + add_definitions(-D_XOPEN_SOURCE=600) add_definitions(-DLIBSUPERDERPY_ORIENTATION_${LIBSUPERDERPY_ORIENTATION}=true) set(EMSCRIPTEN_TOTAL_MEMORY "128" CACHE STRING "Amount of memory allocated by Emscripten (MB, must be multiple of 16)" ) - option(LIBSUPERDERPY_IMGUI "Compile with Dear ImGui support." OFF) if (LIBSUPERDERPY_IMGUI) enable_language(CXX) @@ -30,7 +35,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) if(WIN32) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mwindows -municode") add_definitions(-DWIN32_LEAN_AND_MEAN) - option(LIBSUPERDERPY_DLFCN "Use built-in dlfcn with Unicode support" ON) + option(LIBSUPERDERPY_DLFCN "Use built-in dlfcn with UTF-8 support" ON) endif(WIN32) if(ANDROID) @@ -46,9 +51,10 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") endif(APPLE) - option(USE_CLANG_TIDY "Analyze the code with clang-tidy" ON) + option(USE_CLANG_TIDY "Analyze the code with clang-tidy" OFF) if(USE_CLANG_TIDY AND NOT MINGW) find_program(CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable") + mark_as_advanced(CLANG_TIDY_EXE) if(NOT CLANG_TIDY_EXE) message(STATUS "clang-tidy not found, analysis disabled") else() @@ -158,7 +164,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) set(CMAKE_SHARED_MODULE_SUFFIX ".js") endif() - option(LIBSUPERDERPY_USE_WEBGL2 "Use WebGL 2 context" OFF) + option(LIBSUPERDERPY_USE_WEBGL2 "Use WebGL 2 context" ON) if(LIBSUPERDERPY_USE_WEBGL2) set(EMSCRIPTEN_FLAGS ${EMSCRIPTEN_FLAGS} -s USE_WEBGL2=1) endif(LIBSUPERDERPY_USE_WEBGL2) @@ -198,7 +204,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) set_target_properties("libsuperderpy-${LIBSUPERDERPY_GAMENAME}-${name}" PROPERTIES PREFIX "") if (NOT EMSCRIPTEN) - target_link_libraries("libsuperderpy-${LIBSUPERDERPY_GAMENAME}-${name}" ${ALLEGRO5_LIBRARIES} ${ALLEGRO5_FONT_LIBRARIES} ${ALLEGRO5_TTF_LIBRARIES} ${ALLEGRO5_PRIMITIVES_LIBRARIES} ${ALLEGRO5_AUDIO_LIBRARIES} ${ALLEGRO5_ACODEC_LIBRARIES} ${ALLEGRO5_VIDEO_LIBRARIES} ${ALLEGRO5_IMAGE_LIBRARIES} ${ALLEGRO5_COLOR_LIBRARIES} m) + target_link_libraries("libsuperderpy-${LIBSUPERDERPY_GAMENAME}-${name}" ${ALLEGRO5_LIBS} m) if (TARGET libsuperderpy-${LIBSUPERDERPY_GAMENAME}) target_link_libraries("libsuperderpy-${LIBSUPERDERPY_GAMENAME}-${name}" libsuperderpy-${LIBSUPERDERPY_GAMENAME}) @@ -209,7 +215,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) endif(TARGET libsuperderpy-${LIBSUPERDERPY_GAMENAME}) endif (NOT EMSCRIPTEN) - install(TARGETS "libsuperderpy-${LIBSUPERDERPY_GAMENAME}-${name}" DESTINATION ${LIB_INSTALL_DIR}) + install(TARGETS "libsuperderpy-${LIBSUPERDERPY_GAMENAME}-${name}" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) if (ANDROID) add_dependencies(${LIBSUPERDERPY_GAMENAME}_apk "libsuperderpy-${LIBSUPERDERPY_GAMENAME}-${name}") @@ -313,8 +319,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) add_custom_target(${LIBSUPERDERPY_GAMENAME}_js DEPENDS ${LIBSUPERDERPY_GAMENAME}_install ${LIBSUPERDERPY_GAMENAME}_flac_to_ogg WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/${LIBSUPERDERPY_GAMENAME}" - COMMAND "${CMAKE_C_COMPILER}" ${CFLAGS_LIST} ../${LIBSUPERDERPY_GAMENAME}${CMAKE_EXECUTABLE_SUFFIX} ../libsuperderpy${CMAKE_SHARED_LIBRARY_SUFFIX} ../libsuperderpy-${LIBSUPERDERPY_GAMENAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${ALLEGRO5_LIBRARIES} ${ALLEGRO5_FONT_LIBRARIES} ${ALLEGRO5_TTF_LIBRARIES} ${ALLEGRO5_PRIMITIVES_LIBRARIES} ${ALLEGRO5_AUDIO_LIBRARIES} ${ALLEGRO5_ACODEC_LIBRARIES} ${ALLEGRO5_VIDEO_LIBRARIES} ${ALLEGRO5_IMAGE_LIBRARIES} ${ALLEGRO5_COLOR_LIBRARIES} ${EMSCRIPTEN_FLAGS} -s MAIN_MODULE=1 -s TOTAL_MEMORY=${EMSCRIPTEN_TOTAL_MEMORY_BYTES} -o ${LIBSUPERDERPY_GAMENAME}.html --preload-file data --preload-file gamestates@/ - COMMAND rm -rf data gamestates + COMMAND "${CMAKE_C_COMPILER}" ${CFLAGS_LIST} ../bin/${LIBSUPERDERPY_GAMENAME}${CMAKE_EXECUTABLE_SUFFIX} ../lib/libsuperderpy${CMAKE_SHARED_LIBRARY_SUFFIX} ../lib/libsuperderpy-${LIBSUPERDERPY_GAMENAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${ALLEGRO5_LIBS} ${EMSCRIPTEN_FLAGS} -s MAIN_MODULE=1 -s TOTAL_MEMORY=${EMSCRIPTEN_TOTAL_MEMORY_BYTES} -o ${LIBSUPERDERPY_GAMENAME}.html --preload-file ../share/${LIBSUPERDERPY_GAMENAME}/data --preload-file gamestates@/ VERBATIM ) endif(EMSCRIPTEN) @@ -387,6 +392,23 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) endif(ANDROID) + # setup default RPATH/install_name handling + # default is to build with RPATH for the install dir, so it doesn't need to relink + if (UNIX) + if (APPLE) + set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) + else (APPLE) + # use the RPATH figured out by cmake when compiling + set(CMAKE_SKIP_BUILD_RPATH TRUE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif (APPLE) + endif (UNIX) + + # uninstall target + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libsuperderpy/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) + add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + set(LIBSUPERDERPY_CONFIG_INCLUDED 1) endif (NOT LIBSUPERDERPY_CONFIG_INCLUDED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66b57d4..9ab5c75 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,4 +53,4 @@ if (ANDROID) target_link_libraries("libsuperderpy" log) endif (ANDROID) -install(TARGETS "libsuperderpy" DESTINATION ${LIB_INSTALL_DIR}) +install(TARGETS "libsuperderpy" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})