diff --git a/doomsday/apps/client/CMakeLists.txt b/doomsday/apps/client/CMakeLists.txt index c5d291d105..7e3bb25cbf 100644 --- a/doomsday/apps/client/CMakeLists.txt +++ b/doomsday/apps/client/CMakeLists.txt @@ -169,9 +169,8 @@ endif () if (APPLE) deng_install_bundle_deps (client - Deng::libcore Deng::libshell - Deng::libgui Deng::libappfw - Deng::liblegacy Deng::libdoomsday + Deng::libcore Deng::libshell Deng::libgui Deng::libappfw + Deng::liblegacy Deng::libdoomsday Deng::libgamefw SDL2 SDL2_mixer ) diff --git a/doomsday/apps/plugins/CMakeLists.txt b/doomsday/apps/plugins/CMakeLists.txt index 1560c70521..61d999a659 100644 --- a/doomsday/apps/plugins/CMakeLists.txt +++ b/doomsday/apps/plugins/CMakeLists.txt @@ -5,9 +5,7 @@ cmake_minimum_required (VERSION 3.1) project (Plugins) include (../../cmake/Config.cmake) -if (DENG_DEVELOPER) - add_subdirectory (example) -endif () +add_subdirectory (libgamefw) add_subdirectory (importdeh) add_subdirectory (importidtech1) @@ -30,3 +28,7 @@ if (WIN32) add_subdirectory (directsound) add_subdirectory (winmm) endif () + +if (DENG_DEVELOPER) + add_subdirectory (example) +endif () diff --git a/doomsday/apps/plugins/PluginConfig.cmake b/doomsday/apps/plugins/PluginConfig.cmake index 7816d220c6..88be2ca554 100644 --- a/doomsday/apps/plugins/PluginConfig.cmake +++ b/doomsday/apps/plugins/PluginConfig.cmake @@ -1,11 +1,12 @@ # The Doomsday Engine Project -- Common build config for plugins -# Copyright (c) 2015 Jaakko Keränen +# Copyright (c) 2015-2016 Jaakko Keränen cmake_minimum_required (VERSION 3.0) project (DENG_PLUGINS) include (${CMAKE_CURRENT_LIST_DIR}/../../cmake/Config.cmake) find_package (DengDoomsday) +find_package (DengGamefw) # Game framework is available in all plugins. macro (deng_add_plugin target) sublist (_src 1 -1 ${ARGV}) @@ -23,20 +24,20 @@ macro (deng_add_plugin target) list (APPEND _src ${_winres}) endif () add_library (${target} MODULE ${_src} ${DENG_RESOURCES}) - target_include_directories (${target} - PUBLIC "${DENG_API_DIR}" + target_include_directories (${target} + PUBLIC "${DENG_API_DIR}" PRIVATE "${DENG_SOURCE_DIR}/sdk/libgui/include" ) - target_link_libraries (${target} PUBLIC Deng::libdoomsday) + target_link_libraries (${target} PUBLIC Deng::libdoomsday Deng::libgamefw) enable_cxx11 (${target}) set_target_properties (${target} PROPERTIES FOLDER Plugins) if (APPLE) # The plugins have some messy code. - set_property (TARGET ${target} + set_property (TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-braces ) - set_target_properties (${target} PROPERTIES + set_target_properties (${target} PROPERTIES BUNDLE ON MACOSX_BUNDLE_INFO_PLIST ${DENG_SOURCE_DIR}/cmake/MacOSXPluginBundleInfo.plist.in BUILD_WITH_INSTALL_RPATH ON # staging prevents CMake's own rpath fixing @@ -49,14 +50,14 @@ macro (deng_add_plugin target) # plugins are not installed yet -- the staging directory symlinks to the # individual build directories. set (stage "${DENG_BUILD_STAGING_DIR}/DengPlugins") - add_custom_command (TARGET ${target} POST_BUILD + add_custom_command (TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${stage}" - COMMAND ${CMAKE_COMMAND} -E create_symlink - "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${target}.bundle" + COMMAND ${CMAKE_COMMAND} -E create_symlink + "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${target}.bundle" "${stage}/${target}.bundle" ) # Fix the Qt framework install names manually. - deng_bundle_install_names (${target} + deng_bundle_install_names (${target} SCRIPT_NAME "qtlibs" LD_PATH "@executable_path/../Frameworks" QtCore.framework/Versions/5/QtCore diff --git a/doomsday/apps/plugins/libgamefw/CMakeLists.txt b/doomsday/apps/plugins/libgamefw/CMakeLists.txt new file mode 100644 index 0000000000..69ef4e92fa --- /dev/null +++ b/doomsday/apps/plugins/libgamefw/CMakeLists.txt @@ -0,0 +1,35 @@ +# Doomsday Engine -- libgamefw: Game base framework and common routines + +cmake_minimum_required (VERSION 3.1) +project (DENG_LIBGAMEFW) +include (../../../cmake/Config.cmake) + +# Dependencies. +find_package (DengCore) +find_package (DengLegacy) + +# Definitions. + add_definitions ( + -D__LIBGAMEFW__=1 +) + +# Set up the API. +include_directories (${DENG_API_DIR}) + +# Source and header files. +file (GLOB_RECURSE HEADERS include/gamefw/*) + +deng_merge_sources (libgamefw src/*.cpp) + +deng_add_library (libgamefw ${SOURCES} ${HEADERS}) +target_link_libraries (libgamefw + PUBLIC Deng::libcore Deng::liblegacy +) + +if (DENG_ENABLE_SDK) + install (DIRECTORY include/gamefw + DESTINATION include + COMPONENT sdk + ) +endif () +deng_deploy_library (libgamefw DengGamefw) diff --git a/doomsday/apps/plugins/libgamefw/include/gamefw/libgamefw.h b/doomsday/apps/plugins/libgamefw/include/gamefw/libgamefw.h new file mode 100644 index 0000000000..316faa1a4e --- /dev/null +++ b/doomsday/apps/plugins/libgamefw/include/gamefw/libgamefw.h @@ -0,0 +1,50 @@ +/** @file libgamefw.h Common framework for games. + * + * @authors Copyright (c) 2016 Jaakko Keränen + * + * @par License + * GPL: http://www.gnu.org/licenses/gpl.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. You should have received a copy of the GNU + * General Public License along with this program; if not, see: + * http://www.gnu.org/licenses + */ + +#ifndef LIBGAMEFW_H +#define LIBGAMEFW_H + +/* + * The LIBGAMEFW_PUBLIC macro is used for declaring exported symbols. It must be + * applied in all exported classes and functions. DEF files are not used for + * exporting symbols on Windows. + */ +#if defined(_WIN32) && defined(_MSC_VER) +# ifdef __LIBGAMEFW__ +// This is defined when compiling the library. +# define LIBGAMEFW_PUBLIC __declspec(dllexport) +# else +# define LIBGAMEFW_PUBLIC __declspec(dllimport) +# endif +#else +// No need to use any special declarators. +# define LIBGAMEFW_PUBLIC +#endif + +#ifdef __cplusplus + +/// libgamefw uses the @c gfw namespace for all its C++ symbols. +namespace gfw { + + + +} // namespace gfw + +#endif // __cplusplus + +#endif // LIBGAMEFW_H diff --git a/doomsday/cmake/config/DengGamefwConfig.cmake b/doomsday/cmake/config/DengGamefwConfig.cmake new file mode 100644 index 0000000000..3604642051 --- /dev/null +++ b/doomsday/cmake/config/DengGamefwConfig.cmake @@ -0,0 +1,8 @@ +find_package (DengCore REQUIRED) +find_package (DengLegacy REQUIRED) + +# Deng::libgamefw may exist in the current build, in which case using +# a previously installed version is inappropriate. +if (NOT TARGET Deng::libgamefw) + include ("${CMAKE_CURRENT_LIST_DIR}/DengGamefw.cmake") +endif ()