create entrypoint, add IWYU pragmas

This commit is contained in:
lauchmelder 2025-01-03 11:26:53 +01:00
parent cd9f7a8bf6
commit 31c2b61d20
8 changed files with 59 additions and 17 deletions

View file

@ -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)

View file

@ -1,8 +0,0 @@
#include "Test.hpp"
#include <cstdio>
namespace quark {
void Print() {
printf("Hello, quark!\n");
}
}

View file

@ -1,5 +0,0 @@
#pragma once
namespace quark {
void Print();
}

7
quark/src/quark.hpp Normal file
View file

@ -0,0 +1,7 @@
#pragma once
// IWYU pragma: begin_exports
#include "quark/Application.hpp"
#include "quark/Entrypoint.hpp"
// IWYU pragma: end_exports

View file

@ -0,0 +1,11 @@
#include "Application.hpp"
namespace qk {
void Application::Run() const {
for(;;) {
}
}
}

View 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();
}

View 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;
}

View file

@ -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>();
}