CMake: Restructure main file, move example to its own directory
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# ------------------------------------------
|
||||
# User config between these lines
|
||||
|
||||
# Set project name
|
||||
set(GAME "game")
|
||||
|
||||
# ------------------------------------------
|
||||
|
||||
project(${GAME} CXX)
|
||||
|
||||
# Define game source files
|
||||
file(GLOB_RECURSE GAME_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
||||
|
||||
add_executable(${GAME} ${GAME_SOURCES})
|
||||
target_include_directories(${GAME} PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/${ENGINE}/src")
|
||||
target_link_libraries(${GAME} ${ENGINE})
|
||||
|
||||
target_precompile_headers(${GAME} REUSE_FROM ${ENGINE})
|
||||
|
||||
# ------------------------------------------
|
||||
|
||||
# Add 'make run' target
|
||||
add_custom_target(run
|
||||
COMMAND ${GAME}
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "inferno.h"
|
||||
#include "inferno/entrypoint.h"
|
||||
|
||||
class Game : public Inferno::Application
|
||||
{
|
||||
public:
|
||||
Game() : Application({}) {}
|
||||
~Game() {}
|
||||
};
|
||||
|
||||
Inferno::Application& Inferno::createApplication()
|
||||
{
|
||||
Game::initialize();
|
||||
return Game::the();
|
||||
}
|
||||
Reference in New Issue
Block a user