create entrypoint, add IWYU pragmas
This commit is contained in:
parent
cd9f7a8bf6
commit
31c2b61d20
|
@ -1,7 +1,7 @@
|
|||
project(quark CXX)
|
||||
|
||||
add_library(quark SHARED
|
||||
src/Test.cpp
|
||||
src/quark/Application.cpp
|
||||
)
|
||||
|
||||
target_include_directories(quark INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#include "Test.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
namespace quark {
|
||||
void Print() {
|
||||
printf("Hello, quark!\n");
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
namespace quark {
|
||||
void Print();
|
||||
}
|
7
quark/src/quark.hpp
Normal file
7
quark/src/quark.hpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include "quark/Application.hpp"
|
||||
|
||||
#include "quark/Entrypoint.hpp"
|
||||
// IWYU pragma: end_exports
|
11
quark/src/quark/Application.cpp
Normal file
11
quark/src/quark/Application.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "Application.hpp"
|
||||
|
||||
namespace qk {
|
||||
|
||||
void Application::Run() const {
|
||||
for(;;) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
16
quark/src/quark/Application.hpp
Normal file
16
quark/src/quark/Application.hpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
// IWYU pragma: private, include <quark.hpp>
|
||||
|
||||
#include <memory>
|
||||
namespace qk {
|
||||
|
||||
class Application {
|
||||
public:
|
||||
virtual ~Application() {}
|
||||
|
||||
void Run() const;
|
||||
};
|
||||
|
||||
std::unique_ptr<qk::Application> CreateApplication();
|
||||
|
||||
}
|
13
quark/src/quark/Entrypoint.hpp
Normal file
13
quark/src/quark/Entrypoint.hpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
// IWYU pragma: private, include <quark.hpp>
|
||||
|
||||
#include "Application.hpp"
|
||||
|
||||
extern std::unique_ptr<qk::Application> qk::CreateApplication();
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
auto application = qk::CreateApplication();
|
||||
application->Run();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,5 +1,13 @@
|
|||
#include "Test.hpp"
|
||||
#include <memory>
|
||||
#include <quark.hpp>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
quark::Print();
|
||||
class Sandbox :
|
||||
public qk::Application
|
||||
{
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
std::unique_ptr<qk::Application> qk::CreateApplication() {
|
||||
return std::make_unique<Sandbox>();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue