mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 07:31:21 +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
|
# Release with debug info compiler flags
|
||||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -no-pie -fno-pie")
|
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -no-pie -fno-pie")
|
||||||
|
|
||||||
# IF(NOT MINGW)
|
# IF(NOT MINGW)
|
||||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
|
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
|
||||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
||||||
# ENDIF()
|
# ENDIF()
|
||||||
ENDIF()
|
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")
|
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -pthread")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# Snapcraft build definition.
|
||||||
|
IF(DEFINED ENV{SNAPCRAFT_STAGE})
|
||||||
|
MESSAGE(STATUS "Using snapcraft path...")
|
||||||
|
ADD_DEFINITIONS("-DSNAPCRAFT")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT INSTALL_DIR_BIN)
|
IF(NOT INSTALL_DIR_BIN)
|
||||||
SET(INSTALL_DIR_BIN "${CMAKE_INSTALL_PREFIX}/games/" CACHE PATH "The installation path for binaries")
|
SET(INSTALL_DIR_BIN "${CMAKE_INSTALL_PREFIX}/games/" CACHE PATH "The installation path for binaries")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@@ -11,6 +11,9 @@ IF(BUILD_GLEST)
|
|||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11")
|
||||||
add_definitions("-DDATADIR=${INSTALL_DIR_DATA}")
|
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)
|
FIND_PACKAGE(${SDL_VERSION_NAME} REQUIRED)
|
||||||
INCLUDE_DIRECTORIES(${${SDL_VERSION_NAME}_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${${SDL_VERSION_NAME}_INCLUDE_DIR})
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
|
@@ -233,10 +233,12 @@ namespace Game {
|
|||||||
foundPath = tryCustomPath(cfgType, fileName, custom_path);
|
foundPath = tryCustomPath(cfgType, fileName, custom_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SNAPCRAFT
|
||||||
if (foundPath == false) {
|
if (foundPath == false) {
|
||||||
currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
|
currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
|
||||||
foundPath = tryCustomPath(cfgType, fileName, currentpath);
|
foundPath = tryCustomPath(cfgType, fileName, currentpath);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (foundPath == false) {
|
if (foundPath == false) {
|
||||||
@@ -263,6 +265,13 @@ namespace Game {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SNAPCRAFT
|
||||||
|
if (foundPath == false) {
|
||||||
|
foundPath = tryCustomPath(cfgType, fileName, std::getenv("SNAP") +
|
||||||
|
endPathWithSlash(formatPath(TOSTRING(DATADIR))));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DATADIR
|
#ifdef DATADIR
|
||||||
if (foundPath == false) {
|
if (foundPath == false) {
|
||||||
foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(formatPath(TOSTRING(DATADIR))));
|
foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(formatPath(TOSTRING(DATADIR))));
|
||||||
|
@@ -53,8 +53,13 @@ namespace Shared {
|
|||||||
namespace Util {
|
namespace Util {
|
||||||
|
|
||||||
string Properties::applicationPath = "";
|
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 = "";
|
string Properties::applicationDataPath = "";
|
||||||
|
#endif
|
||||||
string Properties::techtreePath = "";
|
string Properties::techtreePath = "";
|
||||||
string Properties::scenarioPath = "";
|
string Properties::scenarioPath = "";
|
||||||
string Properties::tutorialPath = "";
|
string Properties::tutorialPath = "";
|
||||||
|
Reference in New Issue
Block a user