mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 20:02:40 +01:00
Add FreeBSD support
For now, there's only single OS-dependent bit of code, it it should be handled on FreeBSD just like on Linux. While here, change macro testing from #if XXX to #if defined(XXX), this is clener and not prone to "undefined macro" errors
This commit is contained in:
parent
b7ac33caec
commit
c302f10b19
@ -27,9 +27,11 @@ option(ENABLE_PROFILING "Enable detailed profiling metrics")
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
add_definitions(-DRW_LINUX=1)
|
add_definitions(-DRW_LINUX)
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
add_definitions(-DRW_OSX=1)
|
add_definitions(-DRW_OSX)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
add_definitions(-DRW_FREEBSD)
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "Unknown platform \"${CMAKE_SYSTEM_NAME}\". please update CMakeLists.txt.")
|
message(FATAL_ERROR "Unknown platform \"${CMAKE_SYSTEM_NAME}\". please update CMakeLists.txt.")
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -43,7 +43,7 @@ bool GameConfig::isValid()
|
|||||||
|
|
||||||
std::string GameConfig::getDefaultConfigPath()
|
std::string GameConfig::getDefaultConfigPath()
|
||||||
{
|
{
|
||||||
#if RW_LINUX
|
#if defined(RW_LINUX) || defined(RW_FREEBSD)
|
||||||
char* config_home = getenv("XDG_CONFIG_HOME");
|
char* config_home = getenv("XDG_CONFIG_HOME");
|
||||||
if (config_home != nullptr) {
|
if (config_home != nullptr) {
|
||||||
return std::string(config_home) + "/" + kConfigDirectoryName;
|
return std::string(config_home) + "/" + kConfigDirectoryName;
|
||||||
@ -53,7 +53,7 @@ std::string GameConfig::getDefaultConfigPath()
|
|||||||
return std::string(home) + "/.config/" + kConfigDirectoryName;
|
return std::string(home) + "/.config/" + kConfigDirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif RW_OSX
|
#elif defined(RW_OSX)
|
||||||
char* home = getenv("HOME");
|
char* home = getenv("HOME");
|
||||||
if (home)
|
if (home)
|
||||||
return std::string(home) + "/Library/Preferences/" + kConfigDirectoryName;
|
return std::string(home) + "/Library/Preferences/" + kConfigDirectoryName;
|
||||||
|
Loading…
Reference in New Issue
Block a user