From 087490f70db4555cfd6797e21e3014099d24e976 Mon Sep 17 00:00:00 2001
From: Lava Block <the@lava-block.com>
Date: Mon, 18 Jan 2021 22:00:24 +0100
Subject: [PATCH] add template

---
 CMakeLists.txt | 25 +++++++++++++++++++++++++
 DOCS.md        | 10 ++++++++--
 README.md      |  2 +-
 src/main.cpp   | 16 ++++++++++++++++
 4 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 src/main.cpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99cac118..e08d2bb6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -376,6 +376,8 @@ add_library(lava::app ALIAS lava.app)
 
 option(LIBLAVA_TESTS "Enable Tests" TRUE)
 if(LIBLAVA_TESTS)
+message("========================================================================")
+
         message("> tests")
 
         message(">> lava")
@@ -492,4 +494,27 @@ install(
         DESTINATION ${CONFIG_PATH}
         )
 
+option(LIBLAVA_TEMPLATE "Enable Template" TRUE)
+if(LIBLAVA_TEMPLATE)
+message("========================================================================")
+
+        set(NAME template)
+
+        message("> ${NAME}")
+
+        set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
+
+        add_executable(${NAME}
+                ${SRC_DIR}/main.cpp
+                )
+
+        target_include_directories(${NAME} PUBLIC
+                ${SRC_DIR}
+                )
+
+        target_link_libraries(${NAME} lava::app)
+
+        set_property(TARGET ${NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_BINARY_DIR}")
+endif()
+
 message("========================================================================")
diff --git a/DOCS.md b/DOCS.md
index 1d9417e7..bcdba436 100644
--- a/DOCS.md
+++ b/DOCS.md
@@ -2,7 +2,7 @@
 
 # liblava docs &nbsp; [![Version](https://img.shields.io/badge/Version-0.6.0-blue)](https://git.io/liblava)
 
-[Features](#features) &nbsp; **[Tutorial](#tutorial)** &nbsp; [Requirements](#requirements) &nbsp; **[Modules](#modules)** &nbsp; [Third-Party](#third-party) &nbsp; **[Guide](#guide)** &nbsp; [Tests](#tests) &nbsp; **[Build](#build)** &nbsp; [Install](#install)
+[Features](#features) &nbsp; **[Tutorial](#tutorial)** &nbsp; [Requirements](#requirements) &nbsp; **[Modules](#modules)** &nbsp; [Third-Party](#third-party) &nbsp; **[Guide](#guide)** &nbsp; [Tests](#tests) &nbsp; [Template](#template) &nbsp; **[Build](#build)** &nbsp; [Install](#install)
 
 <br />
 
@@ -369,7 +369,7 @@ int main(int argc, char* argv[]) {
 
 <br />
 
-##### What's next? āžœ Check some <a href="https://git.io/liblava-demo">demos</a> and clone a <a href="https://git.io/liblava-template">starter template</a> to try it out!
+##### What's next? āžœ Check some <a href="https://git.io/liblava-demo">demos</a> and use the [template](#template) to try it out!
 
 <a href="https://github.com/liblava/liblava-demo/#readme"><img src="res/demo.png"></a>
 
@@ -528,6 +528,12 @@ In addition run **lava-unit** that will check parts of **liblava** using [Catch2
 
 <br />
 
+## Template
+
+You can start coding with the **template** project. If you like you can rename it in [CMakeLists](CMakeLists.txt)
+
+Just put your code in the [src](src) folder. Everything you need is in [main.cpp](src/main.cpp)
+
 ## Build
 
 ```bash
diff --git a/README.md b/README.md
index eea0a554..92120b8b 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
 
 <br />
 
-**C++20** + **Modular** &nbsp; **<a href="https://git.io/liblava-demo">demo</a>**  + <a href="https://git.io/liblava-template">template</a> &nbsp; **Windows** + **Linux**
+**C++20** + **Modular** &nbsp; **<a href="https://git.io/liblava-demo">demo</a>**  + [template](DOCS.md/#template) &nbsp; **Windows** + **Linux**
 
 [![Version](https://img.shields.io/badge/Version-0.6.0-blue)](https://git.io/liblava) [![License](https://img.shields.io/github/license/liblava/liblava)](LICENSE) [![CodeFactor](https://www.codefactor.io/repository/github/liblava/liblava/badge)](https://www.codefactor.io/repository/github/liblava/liblava) [![Discord](https://img.shields.io/discord/439508141722435595)](https://discord.lava-block.com) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/liblava) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow)](https://twitter.com/liblava)
 
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 00000000..8cf2dd83
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,16 @@
+// file      : src/main.cpp
+// copyright : Copyright (c) 2018-present, Lava Block OÜ and contributors
+// license   : MIT; see accompanying LICENSE file
+
+#include <imgui.h>
+#include <liblava/lava.hpp>
+
+using namespace lava;
+
+int main(int argc, char* argv[]) {
+    app app("template", { argc, argv });
+    if (!app.setup())
+        return error::not_ready;
+
+    return app.run();
+}
-- 
GitLab