forked from OpenGamers/abaddon
add cmake config file for resource dir
This commit is contained in:
parent
0fcd14c089
commit
90076cf689
@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(abaddon)
|
||||
|
||||
set(ABADDON_RESOURCE_DIR "/usr/share/abaddon" CACHE PATH "Fallback directory for resources on Linux")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
@ -35,6 +37,8 @@ if(WIN32)
|
||||
link_libraries(${Fontconfig_LIBRARIES})
|
||||
endif()
|
||||
|
||||
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
||||
|
||||
file(GLOB ABADDON_SOURCES
|
||||
"*.h"
|
||||
"*.hpp"
|
||||
@ -54,6 +58,7 @@ file(GLOB ABADDON_SOURCES
|
||||
)
|
||||
|
||||
add_executable(abaddon ${ABADDON_SOURCES})
|
||||
target_include_directories(abaddon PUBLIC ${PROJECT_BINARY_DIR})
|
||||
target_include_directories(abaddon PUBLIC ${GTKMM_INCLUDE_DIRS})
|
||||
target_include_directories(abaddon PUBLIC ${ZLIB_INCLUDE_DIRS})
|
||||
target_include_directories(abaddon PUBLIC ${SQLite3_INCLUDE_DIRS})
|
||||
|
1
config.h.in
Normal file
1
config.h.in
Normal file
@ -0,0 +1 @@
|
||||
#define ABADDON_DEFAULT_RESOURCE_DIR "@ABADDON_RESOURCE_DIR@"
|
@ -2,6 +2,7 @@
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <config.h>
|
||||
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
@ -97,7 +98,7 @@ std::string Platform::FindResourceFolder() {
|
||||
|
||||
const static std::string home_path = std::getenv("HOME") + "/.config/abaddon"s;
|
||||
|
||||
for (const auto &path : { "."s, home_path, "/usr/share/abaddon"s }) {
|
||||
for (const auto &path : { "."s, home_path, std::string(ABADDON_DEFAULT_RESOURCE_DIR) }) {
|
||||
if (IsFolder(path + "/res") && IsFolder(path + "/css")) {
|
||||
found_path = path;
|
||||
found = true;
|
||||
|
Loading…
Reference in New Issue
Block a user