Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Flatpak/CMake fixes #675

Open
wants to merge 9 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build-flatpak.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
flatpak-builder --install --force-clean build org.secretchronicles.TSC.json
flatpak-builder --install --force-clean build org.secretchronicles.TSC.json "$@"
7 changes: 1 addition & 6 deletions install-flatpak-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
95 changes: 25 additions & 70 deletions org.secretchronicles.TSC.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
]
},
Expand All @@ -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"
}
]
},
Expand All @@ -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"
}
]
},
Expand All @@ -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"
}
]
Expand All @@ -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": [
{
Expand Down
68 changes: 31 additions & 37 deletions tsc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)

########################################
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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}
Expand Down Expand Up @@ -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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I didn't notice the problem -- thanks!


if(NOT WIN32)
install(FILES "${TSC_SOURCE_DIR}/docs/man/tsc.6"
Expand Down Expand Up @@ -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}")
Expand Down
Loading