diff --git a/INSTALL.md b/INSTALL.md index 99c0bdf0e..3b9b927a3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -162,22 +162,6 @@ ENABLE_NLS [ON] : Enables or disables use of translations. If disabled, TSC will use English only. -USE_SYSTEM_MRUBY [OFF] -: TSC embeds mruby for level scripting. If this option is turned - off (default), then the mruby included in TSC's source tree is - used for that. Turning this option on advises the build system - to link against a system-provided mruby instead. This is useful - for packaging and on odd systems on which TSC's included mruby does - not build. However, keep in mind that TSC is developed only against - the included mruby library. There's one major caveat you should - make users aware of if enabling this option: if your mruby's - version does not match the one included in TSC's sources, level - scripts can fail due to version incompatibilities, especially - if the version of mruby you provide is older than the one included - in TSC's source tree. Check the version in the TSC source tree - by executing $ git status in the mruby/mruby directory after - updating the Git submodules. - USE_SYSTEM_TINYCLIPBOARD [OFF] : For clipboard access, TSC uses the `tinyclipboard` library written by Marvin Gülker (Quintus). The library is not part of many Linux diff --git a/build-flatpak.sh b/build-flatpak.sh index 47ac1066a..ee28b7d72 100755 --- a/build-flatpak.sh +++ b/build-flatpak.sh @@ -1 +1 @@ -flatpak-builder --install --force-clean build org.secretchronicles.TSC.json +flatpak-builder --install --force-clean build org.secretchronicles.TSC.json "$@" diff --git a/flatpak/shared-modules b/flatpak/shared-modules index 27e7d67b6..769d287b1 160000 --- a/flatpak/shared-modules +++ b/flatpak/shared-modules @@ -1 +1 @@ -Subproject commit 27e7d67b60a30ffd2b807a4f3eb3f65b0e9df953 +Subproject commit 769d287b1a65f8b128570be11ec4626dcc608210 diff --git a/install-flatpak-dependencies.sh b/install-flatpak-dependencies.sh index ee6cdb893..5442300b6 100755 --- a/install-flatpak-dependencies.sh +++ b/install-flatpak-dependencies.sh @@ -13,9 +13,4 @@ sudo apt-get update sudo apt-get install -t stretch-backports flatpak flatpak-builder -y flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - -flatpak install flathub org.gnome.Builder -y - -flatpak install flathub org.freedesktop.Sdk//18.08 -y - -flatpak install flathub org.freedesktop.Platform/x86_64/18.08 -y +flatpak install flathub org.freedesktop.{Platform,Sdk}//19.08 -y diff --git a/org.secretchronicles.TSC.json b/org.secretchronicles.TSC.json index e439b575c..22a25ab8a 100644 --- a/org.secretchronicles.TSC.json +++ b/org.secretchronicles.TSC.json @@ -1,7 +1,7 @@ { "app-id": "org.secretchronicles.TSC", "runtime": "org.freedesktop.Platform", - "runtime-version": "18.08", + "runtime-version": "19.08", "sdk": "org.freedesktop.Sdk", "command": "tsc", "rename-icon": "tsc", @@ -44,25 +44,28 @@ "sources": [ { "type": "archive", - "url": "https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2", - "sha256": "7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7" + "url": "https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2", + "sha256": "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722" } ] }, { "name": "glm", - "buildsystem": "cmake-ninja", + "buildsystem": "simple", + "build-commands": [ + "cp -r glm /app/include", + "rm /app/include/glm/CMakeLists.txt" + ], "sources": [ { "type": "archive", - "url": "https://github.com/g-truc/glm/archive/0.9.9.0.tar.gz", - "sha256": "514dea9ac0099dc389cf293cf1ab3d97aff080abad55bf79d4ab7ff6895ee69c" + "url": "https://github.com/g-truc/glm/releases/download/0.9.9.6/glm-0.9.9.6.zip", + "sha256": "9db7339c3b8766184419cfe7942d668fecabe9013ccfec8136b39e11718817d0" } ] }, "flatpak/shared-modules/glew/glew.json", - "flatpak/shared-modules/glu/glu-9.0.0.json", - "flatpak/shared-modules/udev/udev-175.json", + "flatpak/shared-modules/glu/glu-9.json", { "name": "devil", "buildsystem": "cmake-ninja", @@ -92,22 +95,19 @@ "sources": [ { "type": "archive", - "url": "https://github.com/SFML/SFML/archive/2.5.0.tar.gz", - "sha256": "4bc5ed0b6658f73a31bfb8b36878d71fe1678e6e95e4f20834ab589a1bdc7ef4" + "url": "https://github.com/SFML/SFML/archive/2.5.1.tar.gz", + "sha256": "438c91a917cc8aa19e82c6f59f8714da353c488584a007d401efac8368e1c785" } ] }, { "name": "mm-common", - "buildsystem": "autotools", - "config-opts": [ - "--disable-documentation" - ], + "buildsystem": "meson", "sources": [ { "type": "archive", - "url": "http://ftp.gnome.org/pub/GNOME/sources/mm-common/0.9/mm-common-0.9.12.tar.xz", - "sha256": "ceffdcce1e5b52742884c233ec604bf6fded12eea9da077ce7a62c02c87e7c0b" + "url": "https://ftp.gnome.org/pub/GNOME/sources/mm-common/1.0/mm-common-1.0.0.tar.xz", + "sha256": "b97d9b041e5952486cab620b44ab09f6013a478f43b6699ae899b8a4da189cd4" } ] }, @@ -120,8 +120,8 @@ "sources": [ { "type": "archive", - "url": "http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.10/libsigc++-2.10.0.tar.xz", - "sha256": "f843d6346260bfcb4426259e314512b99e296e8ca241d771d21ac64f28298d81" + "url": "https://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.10/libsigc++-2.10.2.tar.xz", + "sha256": "b1ca0253379596f9c19f070c83d362b12dfd39c0a3ea1dd813e8e21c1a097a98" } ] }, @@ -134,8 +134,8 @@ "sources": [ { "type": "archive", - "url": "http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.56/glibmm-2.56.0.tar.xz", - "sha256": "6e74fcba0d245451c58fc8a196e9d103789bc510e1eee1a9b1e816c5209e79a9" + "url": "https://ftp.gnome.org/pub/GNOME/sources/glibmm/2.58/glibmm-2.58.1.tar.xz", + "sha256": "6e5fe03bdf1e220eeffd543e017fd2fb15bcec9235f0ffd50674aff9362a85f0" } ] }, @@ -148,7 +148,7 @@ "sources": [ { "type": "archive", - "url": "http://ftp.gnome.org/pub/GNOME/sources/libxml++/2.40/libxml++-2.40.1.tar.xz", + "url": "https://ftp.gnome.org/pub/GNOME/sources/libxml++/2.40/libxml++-2.40.1.tar.xz", "sha256": "4ad4abdd3258874f61c2e2a41d08e9930677976d303653cd1670d3e9f35463e9" } ] @@ -167,60 +167,15 @@ } ] }, - { - "name": "mruby", - "buildsystem": "simple", - "build-commands": [ - "sed -i s+#{THIS_DIR}/../mruby/mgems/++g build_config.rb", - "./minirake", - "cp -rv include/* /app/include", - "cp -rv build/host/lib/* /app/lib" - ], - "sources": [ - { - "type": "archive", - "url": "https://github.com/mruby/mruby/archive/1.4.1.tar.gz", - "sha256": "2469b1f3e3c97a34f8c3dca1bca9795f66d6b17c7be60ddfc1f3b502cdcbb400" - }, - { - "type": "git", - "url": "https://github.com/mattn/mruby-json", - "commit": "0a32553d255e62e63ffaa70b12e53767c7da7240", - "dest": "mruby-json" - }, - { - "type": "git", - "url": "https://github.com/mattn/mruby-md5", - "commit": "8383c078248c4a562e99ee96e3979d7034b47fc6", - "dest": "mruby-md5" - }, - { - "type": "git", - "url": "https://github.com/mattn/mruby-pcre-regexp", - "commit": "69344b357a94e258c94addc2a74402d6de5c509d", - "dest": "mruby-pcre-regexp" - }, - { - "type": "git", - "url": "https://github.com/matsumotory/mruby-sleep", - "commit": "7a2a6a35cae42894e2ac1ef93548af83fec9b275", - "dest": "mruby-sleep" - }, - { - "type": "file", - "path": "tsc/mruby_tsc_build_config.rb", - "dest-filename": "build_config.rb" - } - ] - }, { "name": "tsc", - "buildsystem": "cmake", + "buildsystem": "cmake-ninja", + "builddir": true, "subdir": "tsc", "config-opts": [ - "-DUSE_SYSTEM_MRUBY=ON", "-DUSE_SYSTEM_TINYCLIPBOARD=ON", - "-DCMAKE_BUILD_TYPE=Debug" + "-DCMAKE_BUILD_TYPE=RelWithDebInfo", + "-DENABLE_SCRIPT_DOCS=OFF" ], "sources": [ { diff --git a/tsc/CMakeLists.txt b/tsc/CMakeLists.txt index 16a7a9ee9..77e225140 100644 --- a/tsc/CMakeLists.txt +++ b/tsc/CMakeLists.txt @@ -15,7 +15,7 @@ ######################################## # Configuring CMake -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.13) project(TSC C CXX) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") @@ -51,7 +51,6 @@ option(ENABLE_NLS "Enable translations and localisations" ON) option(ENABLE_SCRIPT_DOCS "Build the scripting documentation" ON) option(USE_SYSTEM_TINYCLIPBOARD "Use the system's tinyclipboard library" OFF) option(USE_SYSTEM_PODPARSER "Use the system's pod-cpp library" OFF) -option(USE_SYSTEM_MRUBY "Use the system's mruby library" OFF) option(USE_LIBXMLPP3 "Use libxml++3.0 instead of libxml++2.6 (experimental)" OFF) ######################################## @@ -104,11 +103,19 @@ else() # SFML requires us to link in -lX11 ourselves for whatever reason (otherwise # linking error). find_package(X11 REQUIRED) + + if(NOT TARGET X11::X11) + add_library(X11::X11 INTERFACE) + set_target_properties(X11::X11 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${X11_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${X11_LIBRARIES}") + endif() endif() find_package(SFML COMPONENTS audio graphics window system REQUIRED) +set(SFML_COMPONENTS SFML::audio SFML::graphics SFML::window SFML::system) + find_package(CEGUI COMPONENTS OpenGL REQUIRED) -find_package(OpenGL REQUIRED) find_package(PNG REQUIRED) find_package(PCRE REQUIRED) @@ -118,6 +125,8 @@ else() find_package(LibXmlPP 2.6 REQUIRED) endif() +find_package(OpenGL REQUIRED) + find_package(Boost 1.50.0 COMPONENTS filesystem chrono thread REQUIRED) set(Boost_COMPONENTS Boost::filesystem Boost::chrono Boost::thread) @@ -141,22 +150,6 @@ string(STRIP "${TSC_CREDITS_STR}" TSC_CREDITS_STR) string(REPLACE "\n" "\\n" TSC_CREDITS_STR "${TSC_CREDITS_STR}") configure_file(${TSC_SOURCE_DIR}/src/core/credits.cpp.in ${TSC_BINARY_DIR}/credits.cpp) -######################################## -# Compiler flags by dependencies - -include_directories( - ${SFML_INCLUDE_DIR} - ${Boost_INCLUDE_DIRS} - ${LibXmlPP_INCLUDE_DIRS} - ${Tinyclipboard_INCLUDE_DIRS} - ${PodParser_INCLUDE_DIRS} - ${CEGUI_INCLUDE_DIR} - ${OPENGL_INCLUDE_DIR} - ${PCRE_INCLUDE_DIRS} - ${MRuby_INCLUDE_DIR} - ${X11_INCLUDE_DIR} - ${PNG_INCLUDE_DIRS}) - ######################################## # Source files @@ -198,16 +191,16 @@ endif() add_executable(tsc ${tsc_sources} ${TSC_BINARY_DIR}/credits.cpp) target_link_libraries(tsc - ${CEGUI_LIBRARIES} - ${SFML_LIBRARIES} - ${SFML_DEPENDENCIES} + CEGUI::CEGUI + ${SFML_COMPONENTS} ${Boost_COMPONENTS} - ${OPENGL_LIBRARIES} - ${PNG_LIBRARIES} - ${MRuby_LIBRARIES} - ${Tinyclipboard_LIBRARIES} - ${LibXmlPP_LIBRARIES} - ${PCRE_LIBRARIES}) + OpenGL::GLU + OpenGL::OpenGL + PNG::PNG + MRuby::MRuby + Tinyclipboard::Tinyclipboard + LibXmlPP::LibXmlPP + PCRE::PCRE) # Passing --as-needed to ld ensures that we get the Win32 ld's behaviour # even on Linux and discover linking problems before building for Win32. @@ -217,20 +210,19 @@ if (WIN32) target_link_libraries(tsc iconv intl ws2_32) else() target_link_libraries(tsc - ${X11_LIBRARIES} + OpenGL::GLX + X11::X11 ${CMAKE_DL_LIBS}) if (CMAKE_SYSTEM_NAME MATCHES "BSD") target_link_libraries(tsc iconv intl) endif() endif() -if (NOT USE_SYSTEM_MRUBY) - add_dependencies(tsc mruby) -endif() +add_dependencies(tsc mruby) if (ENABLE_SCRIPT_DOCS) add_executable(scrdg ${scrdg_sources}) - target_link_libraries(scrdg ${Boost_COMPONENTS} ${PodParser_LIBRARIES}) + target_link_libraries(scrdg ${Boost_COMPONENTS} PodParser::PodParser) add_custom_command(OUTPUT "${TSC_BINARY_DIR}/scriptdocs" COMMAND scrdg "${TSC_BINARY_DIR}/scriptdocs" "${TSC_SOURCE_DIR}" ${TSC_VERSION} ${TSC_VERSION_GIT} @@ -297,9 +289,12 @@ install(DIRECTORY "${TSC_SOURCE_DIR}/data/sounds/" install(DIRECTORY "${TSC_SOURCE_DIR}/data/worlds/" DESTINATION ${CMAKE_INSTALL_DATADIR}/tsc/worlds COMPONENT worlds) -install(DIRECTORY "${TSC_BINARY_DIR}/scriptdocs" - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/tsc - COMPONENT base) + +if(ENABLE_SCRIPT_DOCS) + install(DIRECTORY "${TSC_BINARY_DIR}/scriptdocs" + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/tsc + COMPONENT base) +endif() if(NOT WIN32) install(FILES "${TSC_SOURCE_DIR}/docs/man/tsc.6" @@ -420,7 +415,6 @@ message(STATUS "Enable native language support: ${ENABLE_NLS}") message(STATUS "Enable the scripting API docs: ${ENABLE_SCRIPT_DOCS}") message(STATUS "Use system-provided tinyclipboard: ${USE_SYSTEM_TINYCLIPBOARD}") message(STATUS "Use system-provided pod-cpp: ${USE_SYSTEM_PODPARSER}") -message(STATUS "Use system-provided mruby: ${USE_SYSTEM_MRUBY}") message(STATUS "--------------- Path configuration -----------------") message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") diff --git a/tsc/cmake/modules/FindCEGUI.cmake b/tsc/cmake/modules/FindCEGUI.cmake index d077b3db6..e4de0f606 100644 --- a/tsc/cmake/modules/FindCEGUI.cmake +++ b/tsc/cmake/modules/FindCEGUI.cmake @@ -33,6 +33,15 @@ find_package(PkgConfig) # themselves to CEGUI-0, really!) pkg_search_module(PKG_CEGUI QUIET CEGUI CEGUI-0) +######################################## +# Flags + +# This sets -DCEGUI_STATIC! If you forget including +# that into your compilation commands, you will get +# wealths of "undefined references to _imp__*" errors +# on crosscompilation! +set(CEGUI_DEFINITIONS ${PKG_CEGUI_CFLAGS}) + ######################################## # Include dir @@ -64,6 +73,12 @@ macro(find_cegui_library LIBNAME) # Error message if not found if(CEGUI_${LIBNAME}_LIBRARY) message("-- found: ${CEGUI_${LIBNAME}_LIBRARY}") + + add_library(CEGUI::${LIBNAME} UNKNOWN IMPORTED) + set_target_properties(CEGUI::${LIBNAME} PROPERTIES + INTERFACE_COMPILE_OPTIONS "${CEGUI_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${CEGUI_INCLUDE_DIR}" + IMPORTED_LOCATION "${CEGUI_${LIBNAME}_LIBRARY}") else() message(SEND_ERROR "CEGUI${LIBNAME} library not found!") endif() @@ -110,15 +125,6 @@ else() list(APPEND CEGUI_LIBRARIES ${CEGUI_LibXMLParser_LIBRARY}) endif() -######################################## -# Flags - -# This sets -DCEGUI_STATIC! If you forget including -# that into your compilation commands, you will get -# wealths of "undefined references to _imp__*" errors -# on crosscompilation! -set(CEGUI_DEFINITIONS ${PKG_CEGUI_CFLAGS}) - ######################################## # Package boilerplate @@ -139,3 +145,20 @@ mark_as_advanced(CEGUI_INCLUDE_DIR CEGUI_EXPAT_PARSER_LIBRARY CEGUI_RENDERER_LIBRARIES CEGUI_LIBRARIES) + +if(CEGUI_FOUND) + add_library(CEGUI::CEGUI INTERFACE IMPORTED) + target_link_libraries(CEGUI::CEGUI INTERFACE + CEGUI::Base CEGUI::CoreWindowRendererSet + CEGUI::DevILImageCodec) + + foreach(COMPONENT ${CEGUI_FIND_COMPONENTS}) + target_link_libraries(CEGUI::CEGUI INTERFACE CEGUI::${COMPONENT}Renderer) + endforeach() + + if(CEGUI_USE_EXPAT) + target_link_libraries(CEGUI::CEGUI INTERFACE CEGUI::ExpatParser) + else() + target_link_libraries(CEGUI::CEGUI INTERFACE CEGUI::LibXMLParser) + endif() +endif() diff --git a/tsc/cmake/modules/FindFLAC.cmake b/tsc/cmake/modules/FindFLAC.cmake index 10d7706b4..e504311ad 100644 --- a/tsc/cmake/modules/FindFLAC.cmake +++ b/tsc/cmake/modules/FindFLAC.cmake @@ -31,3 +31,12 @@ if (PKG_FLAC_CFLAGS) endif() mark_as_advanced(FLAC_LIBRARIES FLAC_INCLUDE_DIRS FLAC_DEFINITIONS) + +if(FLAC_FOUND AND NOT TARGET FLAC::FLAC) + add_library(FLAC::FLAC UNKNOWN IMPORTED) + set_target_properties(FLAC::FLAC PROPERTIES + INTERFACE_COMPILE_OPTIONS "${FLAC_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIRS}" + IMPORTED_LOCATION "${FLAC_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") +endif() diff --git a/tsc/cmake/modules/FindFreeImage.cmake b/tsc/cmake/modules/FindFreeImage.cmake index 1be7ba997..5a65e0213 100644 --- a/tsc/cmake/modules/FindFreeImage.cmake +++ b/tsc/cmake/modules/FindFreeImage.cmake @@ -19,3 +19,11 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(FreeImage DEFAULT_MSG FreeImage_INCLUDE_DIR FreeImage_LIBRARY) set(FreeImage_LIBRARIES ${FreeImage_LIBRARY}) set(FreeImage_INCLUDE_DIRS ${FreeImage_INCLUDE_DIR}) + +if(FreeImage_FOUND AND NOT FreeImage::FreeImage) + add_library(FreeImage::FreeImage UNKNOWN IMPORTED) + set_target_properties(FreeImage::FreeImage PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${FreeImage_INCLUDE_DIRS}" + IMPORTED_LOCATION "${FreeImage_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") +endif() diff --git a/tsc/cmake/modules/FindFreetype.cmake b/tsc/cmake/modules/FindFreetype.cmake index cc5225274..6250f23cd 100644 --- a/tsc/cmake/modules/FindFreetype.cmake +++ b/tsc/cmake/modules/FindFreetype.cmake @@ -142,3 +142,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype VERSION_VAR FREETYPE_VERSION_STRING) mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build) + +if(Freetype_FOUND) + if(NOT TARGET Freetype::Freetype) + add_library(Freetype::Freetype UNKNOWN IMPORTED) + set_target_properties(Freetype::Freetype PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}" + IMPORTED_LOCATION "${FREETYPE_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + endif() +endif() diff --git a/tsc/cmake/modules/FindLibIntl.cmake b/tsc/cmake/modules/FindLibIntl.cmake deleted file mode 100644 index c39c58ff9..000000000 --- a/tsc/cmake/modules/FindLibIntl.cmake +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################# -# FindLibIntl.cmake - CMake module for finding LibIntl -# -# Copyright © 2012-2017 The TSC Contributors -############################################################################# -# -# 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 3 of the License, or -# (at your option) any later version. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -find_path(LIBINTL_INCLUDE_DIR libintl.h) -find_library(LIBINTL_LIBRARY NAMES intl libintl) -set(LIBINTL_LIBRARIES ${LIBINTL_LIBRARY}) -set(LIBINTL_INCLUDE_DIRS ${LIBINTL_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LibIntl - DEFAULT_MSG - LIBINTL_LIBRARY - LIBINTL_INCLUDE_DIR) - -mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) diff --git a/tsc/cmake/modules/FindLibXmlPP.cmake b/tsc/cmake/modules/FindLibXmlPP.cmake index 661a246f2..aecf758e2 100644 --- a/tsc/cmake/modules/FindLibXmlPP.cmake +++ b/tsc/cmake/modules/FindLibXmlPP.cmake @@ -79,3 +79,35 @@ find_package_handle_standard_args(LibXmlPP VERSION_VAR PKG_LibXmlPP_VERSION) mark_as_advanced(LibXmlPP_LIBRARIES LibXmlPP_INCLUDE_DIRS LibXmlPP_DEFINITIONS) + +if(LibXmlPP_FOUND) + if(NOT TARGET LibXmlPP::Glib) + add_library(LibXmlPP::Glib UNKNOWN IMPORTED) + set_target_properties(LibXmlPP::Glib PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${LibXmlPP_Glib_INCLUDE_DIR};${LibXmlPP_Glib_Config_INCLUDE_DIR}" + IMPORTED_LOCATION "${LibXmlPP_Glib_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + endif() + + if(NOT TARGET LibXmlPP::GlibMM) + add_library(LibXmlPP::GlibMM UNKNOWN IMPORTED) + set_target_properties(LibXmlPP::GlibMM PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${LibXmlPP_GlibMM_INCLUDE_DIR};${LibXmlPP_GlibMM_Config_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES LibXmlPP::Glib + IMPORTED_LOCATION "${LibXmlPP_GlibMM_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C++") + endif() + + if(NOT TARGET LibXmlPP::LibXmlPP) + add_library(LibXmlPP::LibXmlPP UNKNOWN IMPORTED) + set_target_properties(LibXmlPP::LibXmlPP PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${LibXmlPP_INCLUDE_DIR};${LibXmlPP_Config_INCLUDE_DIR}" + INTERFACE_COMPILE_OPTIONS "${LibXmlPP_DEFINITIONS}" + INTERFACE_LINK_LIBRARIES LibXmlPP::GlibMM + IMPORTED_LOCATION "${LibXmlPP_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C++") + endif() +endif() diff --git a/tsc/cmake/modules/FindOGG.cmake b/tsc/cmake/modules/FindOGG.cmake index da7703a27..f2c3a0562 100644 --- a/tsc/cmake/modules/FindOGG.cmake +++ b/tsc/cmake/modules/FindOGG.cmake @@ -32,3 +32,12 @@ if (PKG_OGG_CFLAGS) endif() mark_as_advanced(OGG_LIBRARIES OGG_INCLUDE_DIRS OGG_DEFINITIONS) + +if(OGG_FOUND AND NOT TARGET OGG::OGG) + add_library(OGG::OGG UNKNOWN IMPORTED) + set_target_properties(OGG::OGG PROPERTIES + INTERFACE_COMPILE_OPTIONS "${OGG_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}" + IMPORTED_LOCATION "${OGG_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") +endif() diff --git a/tsc/cmake/modules/FindPCRE.cmake b/tsc/cmake/modules/FindPCRE.cmake index 4f9a81c08..d10ab3929 100644 --- a/tsc/cmake/modules/FindPCRE.cmake +++ b/tsc/cmake/modules/FindPCRE.cmake @@ -30,3 +30,12 @@ if (PKG_PCRE_CFLAGS) endif() mark_as_advanced(PCRE_LIBRARIES PCRE_INCLUDE_DIRS PCRE_DEFINITIONS) + +if(PCRE_FOUND AND NOT TARGET PCRE::PCRE) + add_library(PCRE::PCRE UNKNOWN IMPORTED) + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_COMPILE_OPTIONS "${PCRE_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIRS}" + IMPORTED_LOCATION "${PCRE_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") +endif() diff --git a/tsc/cmake/modules/FindRuby.cmake b/tsc/cmake/modules/FindRuby.cmake index f357c88d7..557852208 100644 --- a/tsc/cmake/modules/FindRuby.cmake +++ b/tsc/cmake/modules/FindRuby.cmake @@ -1,5 +1,5 @@ ############################################################################# -# FindLibIntl.cmake - CMake module for finding Ruby +# FindRuby.cmake - CMake module for finding Ruby # # Copyright © 2012-2017 The TSC Contributors ############################################################################# diff --git a/tsc/cmake/modules/FindSFML.cmake b/tsc/cmake/modules/FindSFML.cmake index 7a7560ae9..0b5e2202b 100644 --- a/tsc/cmake/modules/FindSFML.cmake +++ b/tsc/cmake/modules/FindSFML.cmake @@ -65,3 +65,12 @@ mark_as_advanced(SFML_LIBRARIES SFML_INCLUDE_DIRS) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SFML DEFAULT_MSG SFML_INCLUDE_DIRS SFML_LIBRARIES) +if(SFML_FOUND) + foreach(component ${SFML_FIND_COMPONENTS}) + add_library(SFML::${component} UNKNOWN IMPORTED) + set_target_properties(SFML::${component} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SFML_INCLUDE_DIRS}" + IMPORTED_LOCATION "${SFML_${component}_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C++") + endforeach() +endif() diff --git a/tsc/cmake/modules/FindVorbis.cmake b/tsc/cmake/modules/FindVorbis.cmake index f16073102..e6dc1c1ad 100644 --- a/tsc/cmake/modules/FindVorbis.cmake +++ b/tsc/cmake/modules/FindVorbis.cmake @@ -30,3 +30,12 @@ if (PKG_Vorbis_CFLAGS) endif() mark_as_advanced(Vorbis_LIBRARIES Vorbis_INCLUDE_DIRS Vorbis_DEFINITIONS) + +if(Vorbis_FOUND AND NOT TARGET Vorbis::Vorbis) + add_library(Vorbis::Vorbis UNKNOWN IMPORTED) + set_target_properties(Vorbis::Vorbis PROPERTIES + INTERFACE_COMPILE_OPTIONS "${Vorbis_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_INCLUDE_DIRS}" + IMPORTED_LOCATION "${Vorbis_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") +endif() diff --git a/tsc/cmake/modules/ProvideMRuby.cmake b/tsc/cmake/modules/ProvideMRuby.cmake index 3ac58909b..9d69315af 100644 --- a/tsc/cmake/modules/ProvideMRuby.cmake +++ b/tsc/cmake/modules/ProvideMRuby.cmake @@ -1,27 +1,27 @@ -if (USE_SYSTEM_MRUBY) - find_path(MRuby_INCLUDE_DIR mruby.h) - find_library(MRuby_LIBRARIES mruby mruby_core) +message("-- Scripting engine enabled: building mruby statically") - message("-- Scripting engine enabled; found mruby at ${MRuby_LIBRARIES}") -else() - message("-- Scripting engine enabled: building mruby statically") +# mruby requires Bison and ruby to compile. +find_package(BISON REQUIRED) +find_package(Ruby REQUIRED) - # mruby requires Bison and ruby to compile. - find_package(BISON REQUIRED) - find_package(Ruby REQUIRED) +set(MRuby_LIBRARIES "${TSC_BINARY_DIR}/mruby/build/host/lib/libmruby.a" "${TSC_BINARY_DIR}/mruby/build/host/lib/libmruby_core.a") +ExternalProject_Add( + mruby + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory "${TSC_SOURCE_DIR}/../mruby/mruby" "${TSC_BINARY_DIR}/mruby" + SOURCE_DIR "${TSC_BINARY_DIR}/mruby" + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND + ./minirake + CC=${CMAKE_C_COMPILER} LD=${CMAKE_C_COMPILER} + MRUBY_CONFIG=${TSC_SOURCE_DIR}/mruby_tsc_build_config.rb + BUILD_BYPRODUCTS ${MRuby_LIBRARIES} + INSTALL_COMMAND "") - set(MRuby_LIBRARIES "${TSC_BINARY_DIR}/mruby/build/host/lib/libmruby.a" "${TSC_BINARY_DIR}/mruby/build/host/lib/libmruby_core.a") +set(MRuby_INCLUDE_DIR ${TSC_SOURCE_DIR}/../mruby/mruby/include) - ExternalProject_Add( - mruby - DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory "${TSC_SOURCE_DIR}/../mruby/mruby" "${TSC_BINARY_DIR}/mruby" - SOURCE_DIR "${TSC_BINARY_DIR}/mruby" - CONFIGURE_COMMAND "" - BUILD_IN_SOURCE 1 - BUILD_COMMAND ./minirake MRUBY_CONFIG=${TSC_SOURCE_DIR}/mruby_tsc_build_config.rb - BUILD_BYPRODUCTS ${MRuby_LIBRARIES} - INSTALL_COMMAND "") - - set(MRuby_INCLUDE_DIR ${TSC_SOURCE_DIR}/../mruby/mruby/include) -endif() +add_library(MRuby::MRuby INTERFACE IMPORTED) +set_target_properties(MRuby::MRuby PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MRuby_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${MRuby_LIBRARIES}") diff --git a/tsc/cmake/modules/ProvidePodParser.cmake b/tsc/cmake/modules/ProvidePodParser.cmake index 200856384..1a04ab8c1 100644 --- a/tsc/cmake/modules/ProvidePodParser.cmake +++ b/tsc/cmake/modules/ProvidePodParser.cmake @@ -2,6 +2,12 @@ if (USE_SYSTEM_PODPARSER) find_path(PodParser_INCLUDE_DIRS pod.hpp) find_library(PodParser_LIBRARIES pod-cpp) message("-- Found pod-cpp at ${PodParser_LIBRARIES}") + + add_library(PodParser::PodParser UNKNOWN IMPORTED) + set_target_properties(PodParser::PodParser PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PodParser_INCLUDE_DIRS}" + IMPORTED_LOCATION "${PodParser_LIBRARIES}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C++") else() message("-- Building pod-cpp statically") add_library(podparser STATIC @@ -10,4 +16,8 @@ else() set(PodParser_LIBRARIES podparser) set(PodParser_INCLUDE_DIRS "${TSC_SOURCE_DIR}/../pod-parser") + set_target_properties(podparser PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PodParser_INCLUDE_DIRS}") + + add_library(PodParser::PodParser ALIAS podparser) endif() diff --git a/tsc/cmake/modules/ProvideTinyclipboard.cmake b/tsc/cmake/modules/ProvideTinyclipboard.cmake index 2150836a0..9a6f644a9 100644 --- a/tsc/cmake/modules/ProvideTinyclipboard.cmake +++ b/tsc/cmake/modules/ProvideTinyclipboard.cmake @@ -1,7 +1,18 @@ if (USE_SYSTEM_TINYCLIPBOARD) find_path(Tinyclipboard_INCLUDE_DIRS tinyclipboard.h) find_library(Tinyclipboard_LIBRARIES tinyclipboard) + + if(NOT Tinyclipboard_LIBRARIES) + message(FATAL_ERROR "-- Failed to find system tinyclipboard") + endif() + message("-- Found tinyclipboard at ${Tinyclipboard_LIBRARIES}") + + add_library(Tinyclipboard::Tinyclipboard UNKNOWN IMPORTED) + set_target_properties(Tinyclipboard::Tinyclipboard PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Tinyclipboard_INCLUDE_DIRS}" + IMPORTED_LOCATION "${Tinyclipboard_LIBRARIES}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") else() message("-- Building tinyclipboard statically") add_library(tinyclipboard STATIC @@ -10,4 +21,8 @@ else() set(Tinyclipboard_LIBRARIES tinyclipboard) set(Tinyclipboard_INCLUDE_DIRS "${TSC_SOURCE_DIR}/../tinyclipboard/include") + set_target_properties(tinyclipboard PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Tinyclipboard_INCLUDE_DIRS}") + + add_library(Tinyclipboard::Tinyclipboard ALIAS tinyclipboard) endif()