application scaffolding
This commit is contained in:
@@ -4,12 +4,20 @@ cmake_minimum_required(VERSION 3.2)
|
|||||||
project(ouros)
|
project(ouros)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -O3")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -O3")
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
|
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
#add_subdirectory(src)
|
#add_subdirectory(src)
|
||||||
|
|
||||||
|
# TODO: cascade cmakelists.txt
|
||||||
add_executable(ouros
|
add_executable(ouros
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
|
src/app/App.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(ouros PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||||
)
|
)
|
||||||
|
|||||||
26
src/app/App.cpp
Normal file
26
src/app/App.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
#include "App.hpp"
|
||||||
|
|
||||||
|
#include "utils/utils.hpp"
|
||||||
|
|
||||||
|
App::App() {
|
||||||
|
|
||||||
|
utils::debugPrint(__FUNCTION__, __LINE__, "App constructor.");
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::init() {
|
||||||
|
|
||||||
|
utils::debugPrint(__FUNCTION__, __LINE__, "Init app.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int App::run() {
|
||||||
|
|
||||||
|
utils::debugPrint(__FUNCTION__, __LINE__, "Run app.");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
19
src/app/App.hpp
Normal file
19
src/app/App.hpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class App {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
App();
|
||||||
|
~App() = default;
|
||||||
|
|
||||||
|
// excecute, called from main()
|
||||||
|
int run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// things like creating a window, creating the rendering engine, etc.
|
||||||
|
void init();
|
||||||
|
|
||||||
|
};
|
||||||
0
src/app/Window.cpp
Normal file
0
src/app/Window.cpp
Normal file
15
src/app/Window.hpp
Normal file
15
src/app/Window.hpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Window {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Window();
|
||||||
|
~Window() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
13
src/main.cpp
13
src/main.cpp
@@ -1,8 +1,19 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "app/App.hpp"
|
||||||
|
#include "utils/utils.hpp"
|
||||||
|
|
||||||
int main(int arg, char *argv[]) {
|
int main(int arg, char *argv[]) {
|
||||||
|
|
||||||
std::cout << "Hi mom" << std::endl;
|
std::cout << "[" << __FUNCTION__ << ": "<< __LINE__ << "] " << "main()" << std::endl;
|
||||||
|
|
||||||
|
std::string message = "main()";
|
||||||
|
utils::debugPrint(__FUNCTION__, __LINE__, message);
|
||||||
|
|
||||||
|
// maybe do some exceptions here
|
||||||
|
App app = App();
|
||||||
|
|
||||||
|
return app.run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
0
src/shaders/.gitkeep
Normal file
0
src/shaders/.gitkeep
Normal file
22
src/utils/utils.hpp
Normal file
22
src/utils/utils.hpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace utils {
|
||||||
|
|
||||||
|
// TODO: implement
|
||||||
|
enum class DebugLevel {
|
||||||
|
Info = 0,
|
||||||
|
Notice,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
|
||||||
|
static void debugPrint(const char* function, int line, std::string message) {
|
||||||
|
|
||||||
|
std::cout << "[ " << std::left << std::setw(16) << function << ": " << std::right << std::setw(4) << line << " ] " << message << std::endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user