Adds scripts for building and cleaning from the windows command line
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
|
||||
@ -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_
|
||||
Loading…
Reference in New Issue