mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Merge pull request #16 from ibbles/master
Out-of-source builds without environment variables.
This commit is contained in:
@@ -111,6 +111,8 @@ set(5.advanced_lighting
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
configure_file(configuration/root_directory.h.in configuration/root_directory.h)
|
||||||
|
include_directories(${CMAKE_BINARY_DIR}/configuration)
|
||||||
|
|
||||||
foreach(CHAPTER ${CHAPTERS})
|
foreach(CHAPTER ${CHAPTERS})
|
||||||
foreach(DEMO ${${CHAPTER}})
|
foreach(DEMO ${${CHAPTER}})
|
||||||
|
|||||||
1
configuration/root_directory.h.in
Normal file
1
configuration/root_directory.h.in
Normal file
@@ -0,0 +1 @@
|
|||||||
|
const char * logl_root = "${CMAKE_SOURCE_DIR}";
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
#define FILESYSTEM_H
|
#define FILESYSTEM_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "root_directory.h" // This is a configuration file generated by CMake.
|
||||||
|
|
||||||
class FileSystem
|
class FileSystem
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
static std::string const & getRoot()
|
static std::string const & getRoot()
|
||||||
{
|
{
|
||||||
static char const * givenRoot {getenv("LOGL_ROOT_PATH")};
|
static char const * envRoot = getenv("LOGL_ROOT_PATH");
|
||||||
|
static char const * givenRoot {envRoot != nullptr ? envRoot : logl_root};
|
||||||
static std::string root {givenRoot != nullptr ? givenRoot : ""};
|
static std::string root {givenRoot != nullptr ? givenRoot : ""};
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user