mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 15:11:20 +02:00
Make snapcraft build work.
This commit is contained in:
@@ -98,10 +98,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
# Release with debug info compiler flags
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -no-pie -fno-pie")
|
||||
|
||||
# IF(NOT MINGW)
|
||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
||||
# ENDIF()
|
||||
# IF(NOT MINGW)
|
||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
||||
# ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
@@ -188,6 +188,12 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -pthread")
|
||||
ENDIF()
|
||||
|
||||
# Snapcraft build definition.
|
||||
IF(DEFINED ENV{SNAPCRAFT_STAGE})
|
||||
MESSAGE(STATUS "Using snapcraft path...")
|
||||
ADD_DEFINITIONS("-DSNAPCRAFT")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT INSTALL_DIR_BIN)
|
||||
SET(INSTALL_DIR_BIN "${CMAKE_INSTALL_PREFIX}/games/" CACHE PATH "The installation path for binaries")
|
||||
ENDIF()
|
||||
|
@@ -11,6 +11,9 @@ IF(BUILD_GLEST)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11")
|
||||
add_definitions("-DDATADIR=${INSTALL_DIR_DATA}")
|
||||
|
||||
# This is an environment var that pops up when building with snapcraft.
|
||||
# Use this to activate snapcraft path...
|
||||
|
||||
FIND_PACKAGE(${SDL_VERSION_NAME} REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${${SDL_VERSION_NAME}_INCLUDE_DIR})
|
||||
IF(UNIX)
|
||||
|
@@ -233,10 +233,12 @@ namespace Game {
|
||||
foundPath = tryCustomPath(cfgType, fileName, custom_path);
|
||||
}
|
||||
|
||||
#ifndef SNAPCRAFT
|
||||
if (foundPath == false) {
|
||||
currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
|
||||
foundPath = tryCustomPath(cfgType, fileName, currentpath);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (foundPath == false) {
|
||||
@@ -263,6 +265,13 @@ namespace Game {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SNAPCRAFT
|
||||
if (foundPath == false) {
|
||||
foundPath = tryCustomPath(cfgType, fileName, std::getenv("SNAP") +
|
||||
endPathWithSlash(formatPath(TOSTRING(DATADIR))));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DATADIR
|
||||
if (foundPath == false) {
|
||||
foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(formatPath(TOSTRING(DATADIR))));
|
||||
|
@@ -53,8 +53,13 @@ namespace Shared {
|
||||
namespace Util {
|
||||
|
||||
string Properties::applicationPath = "";
|
||||
#ifdef SNAPCRAFT
|
||||
string Properties::applicationDataPath = std::getenv("SNAP") + formatPath(TOSTRING(DATADIR));
|
||||
#elif FLATPAK
|
||||
string Properties::applicationDataPath = formatPath(TOSTRING(DATADIR));
|
||||
#else
|
||||
string Properties::applicationDataPath = "";
|
||||
|
||||
#endif
|
||||
string Properties::techtreePath = "";
|
||||
string Properties::scenarioPath = "";
|
||||
string Properties::tutorialPath = "";
|
||||
|
Reference in New Issue
Block a user