better project structure
This commit is contained in:
16
framework/CMakeLists.txt
Normal file
16
framework/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
project(framework)
|
||||
|
||||
add_library(framework
|
||||
src/hello.cpp)
|
||||
|
||||
target_link_libraries(framework
|
||||
glfw)
|
||||
|
||||
target_include_directories(framework
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
src)
|
||||
|
||||
export(TARGETS framework glfw FILE FrameworkConfig.cmake)
|
||||
10
framework/include/hello.h
Normal file
10
framework/include/hello.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef GL_TEMPLATE_HELLO_H
|
||||
#define GL_TEMPLATE_HELLO_H
|
||||
|
||||
#include <string>
|
||||
|
||||
void hello();
|
||||
|
||||
int showWindow(const std::string &title);
|
||||
|
||||
#endif //GL_TEMPLATE_HELLO_H
|
||||
24
framework/src/hello.cpp
Normal file
24
framework/src/hello.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "hello.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
void hello() {
|
||||
printf("Hello, World!\n");
|
||||
}
|
||||
|
||||
int showWindow(const std::string &title) {
|
||||
if (!glfwInit()) return EXIT_FAILURE;
|
||||
|
||||
GLFWwindow *window = glfwCreateWindow(1280, 720, title.c_str(), nullptr, nullptr);
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user