Smallcase folders part 1
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
message(STATUS "·Configuring Model")
|
||||
|
||||
configure_file(
|
||||
Version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Version.h
|
||||
)
|
||||
|
||||
add_library(Helpers Paths.cpp)
|
||||
|
||||
add_library(Helpers::All ALIAS Helpers)
|
||||
|
||||
target_include_directories(Helpers
|
||||
PUBLIC
|
||||
${INCLUDE_BASE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
namespace helpers
|
||||
{
|
||||
std::filesystem::path getExecutablePath()
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
|
||||
if (len == -1)
|
||||
throw std::runtime_error("readlink(/proc/self/exe) failed");
|
||||
|
||||
buf[len] = '\0';
|
||||
return std::filesystem::path(buf);
|
||||
}
|
||||
|
||||
struct Paths
|
||||
{
|
||||
std::filesystem::path exe;
|
||||
std::filesystem::path exeDir;
|
||||
std::filesystem::path configDir;
|
||||
std::filesystem::path assetsDir;
|
||||
};
|
||||
|
||||
Paths initPaths()
|
||||
{
|
||||
Paths p;
|
||||
p.exe = getExecutablePath();
|
||||
p.exeDir = p.exe.parent_path();
|
||||
p.configDir = p.exeDir / "config";
|
||||
p.assetsDir = p.exeDir / "assets";
|
||||
return p;
|
||||
}
|
||||
} // namespace helpers
|
||||
@@ -0,0 +1,6 @@
|
||||
#define PROJECT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define PROJECT_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define PROJECT_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define VERSION_BRANCH @PROJECT_VERSION_BRANCH@
|
||||
#define VERSION_COMMIT @PROJECT_VERSION_COMMIT@
|
||||
#define VERSION_FULL "@PROJECT_VERSION_FULL@"
|
||||
Reference in New Issue
Block a user