Adds scripts for building and cleaning from the windows command line

Gui_Panel_Refactor
Joeyrp 4 years ago
parent 209ad6b3c0
commit 81ee7e848c

@ -0,0 +1,19 @@
@echo off
REM This script expects to be run from the parent directory
REM ex. scripts/build.bat
IF not exist build/ (
echo This script needs to be run from the directory above build/
goto END
)
IF "%~1" == "r" (
cmake --build build/ --target ALL_BUILD --config Release
xcopy /y test_data build\Release\test_data\
) ELSE (
cmake --build build/ --target ALL_BUILD --config Debug
xcopy /y test_data build\Debug\test_data\
)
:END

@ -0,0 +1,13 @@
@echo off
IF not exist build/ (
echo This script needs to be run from the directory above build/
goto END
)
echo Removing the build directory
del /s /q build
rd /s /q build
:END

@ -3,4 +3,4 @@ REM This script expects to be run from the parent directory
REM ex. scripts/cmconfig.bat
@echo on
cmake -DGLFW_BUILD_DOCS=OFF -B build/ -S .
cmake -DGLFW_BUILD_DOCS=OFF -B build/ -S . -G "Visual Studio 16 2019" -A x64

@ -0,0 +1,79 @@
/******************************************************************************
* File - Version.cpp
* Author - Joey Pollack
* Date - 2020/03/06 (y/m/d)
* Mod Date - 2021/08/31 (y/m/d)
* Description - Defines the current version of the engine and provides
* methods to work with the Version struct. Using Semantic
* Versioning https://semver.org/
*
******************************************************************************/
#include "Version.h"
#include <sstream>
#include <LunariumConfig.h>
namespace lunarium
{
Version Version::GetVersion()
{
return { Lunarium_VERSION_MAJOR, Lunarium_VERSION_MINOR, Lunarium_VERSION_PATCH };
}
OpRes Version::StringToVersion(const char * str, Version & v)
{
std::string part = "";
const char* pos = str;
// Major version
while (*pos != '.')
{
if (*pos == 0)
{
return OpRes::Fail("StringToVersion -- str was malformed");
}
part += *pos;
pos++;
}
v.Major = atoi(part.c_str());
// Minor version
part = "";
pos++;
while (*pos != '.')
{
if (*pos == 0)
{
return OpRes::Fail("StringToVersion -- str was malformed");
}
part += *pos;
pos++;
}
v.Minor = atoi(part.c_str());
// Patch version
part = "";
pos++;
while (*pos != 0)
{
part += *pos;
pos++;
}
v.Patch = atoi(part.c_str());
return OpRes::OK();
}
std::string Version::ToString()
{
std::ostringstream oss;
oss << Major << "." << Minor << "." << Patch;
return oss.str();
}
}

@ -0,0 +1,34 @@
/******************************************************************************
* File - Version.h
* Author - Joey Pollack
* Date - 2020/03/06 (y/m/d)
* Mod Date - 2021/08/31 (y/m/d)
* Description - Defines the current version of the engine and provides
* methods to work with the Version struct. Using Semantic
* Versioning https://semver.org/
*
******************************************************************************/
#ifndef _VERSION_H_
#define _VERSION_H_
#include <string>
#include <Utils/OpRes.h>
namespace lunarium
{
struct Version
{
int Major;
int Minor;
int Patch;
static Version GetVersion();
static OpRes StringToVersion(const char* str, Version& v);
std::string ToString();
};
}
#endif // _VERSION_H_

@ -38,8 +38,23 @@ namespace lunarium
mpInstance = nullptr;
}
void core::Initialize(const char* args, std::vector<LogListener*>& listeners)
{
mpLog = Logger::GetInstance();
for (unsigned i = 0; i < listeners.size(); i++)
{
mpLog->AddListener(listeners[i]);
}
}
bool core::IsInit() const
{
return mbIsInit;
}
const State& core::GetState() const
{
return mState;
}
}

@ -10,6 +10,7 @@
#define CORE_H_
#include "state.h"
#include <utils/Logger.h>
namespace lunarium
{
@ -19,14 +20,16 @@ namespace lunarium
static core& GetInstance();
static void Shutdown();
void Initialize(const char* args);
void Initialize(const char* args, std::vector<LogListener*>& listeners);
bool IsInit() const;
const State& GetState() const;
private: // DATA
static core* mpInstance;
bool mbIsInit;
State mState;
Logger* mpLog;
private: // HIDDEN METHODS

@ -17,6 +17,7 @@ extern "C"
#include <lualib.h>
}
//#include <windows.h>
// the following can also be <LunariumConfig.h> but it results in
// an intellisense error
@ -24,6 +25,11 @@ extern "C"
int main(int argc, char** argv)
{
// char pBuf[256];
// size_t len = sizeof(pBuf);
// int bytes = GetModuleFileNameA(NULL, pBuf, len);
// std::cout <<pBuf << std::endl;
// VERSION TEST
std::cout << "Hello yall\n";
std::cout << "This is " << argv[0] << " Version " << Lunarium_VERSION_MAJOR
@ -59,7 +65,7 @@ int main(int argc, char** argv)
// PUGIXML TEST
std::cout << "\nAttempting to open test.xml...";
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file("../test_data/test.xml");
pugi::xml_parse_result result = doc.load_file("test_data/test.xml");
if (!result)
{
std::cout << "\nCould not open the file!\n";
@ -75,7 +81,7 @@ int main(int argc, char** argv)
std::cout <<"\nTesting loading a state from file...";
lunarium::State testState;
if (lunarium::IsOK(lunarium::State::CreateFromFile("../test_data/test_state.xml", testState)))
if (lunarium::IsOK(lunarium::State::CreateFromFile("test_data/test_state.xml", testState)))
{
std::cout << "\nIt worked! Full Screen Resolution Width: " << testState.Display.FullScreenResolution.Width;
std::cout << "\nSaveing out to test_save.xml";

@ -15,7 +15,7 @@ using std::chrono::duration;
using std::chrono::duration_cast;
using std::chrono::microseconds;
namespace Lunarium
namespace lunarium
{
// Starts or re-starts the timer.

@ -17,7 +17,7 @@
#include <chrono>
namespace Lunarium
namespace lunarium
{
class HighResTimer

@ -16,7 +16,7 @@
#include <cstring>
#include <stdexcept>
namespace Lunarium
namespace lunarium
{
//namespace LogLevel
//{

@ -24,7 +24,7 @@
// Conflict with a region flag in wingdi.h
#undef ERROR
namespace Lunarium
namespace lunarium
{
namespace LogLevel
{

Loading…
Cancel
Save