inital, almost working cross-compilation setup with Visual Studio and cmake
This commit is contained in:
15
engine/CMakeLists.txt
Normal file
15
engine/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
add_library(engine STATIC
|
||||
src/Engine.cpp
|
||||
)
|
||||
|
||||
target_include_directories(engine
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# SDL_TARGET is set by cmake/SDLSetup.cmake
|
||||
target_link_libraries(engine PUBLIC ${SDL_TARGET})
|
||||
|
||||
target_compile_definitions(engine PRIVATE
|
||||
$<$<STREQUAL:${SDL_LINK_TYPE},static>:SDL_STATIC_LIB>
|
||||
)
|
||||
11
engine/include/Engine.h
Normal file
11
engine/include/Engine.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
class Engine
|
||||
{
|
||||
public:
|
||||
Engine();
|
||||
~Engine();
|
||||
|
||||
bool Init();
|
||||
void Shutdown();
|
||||
};
|
||||
20
engine/src/Engine.cpp
Normal file
20
engine/src/Engine.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "Engine.h"
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
Engine::Engine() = default;
|
||||
Engine::~Engine() = default;
|
||||
|
||||
bool Engine::Init()
|
||||
{
|
||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS))
|
||||
{
|
||||
SDL_Log("SDL_Init failed: %s", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Engine::Shutdown()
|
||||
{
|
||||
SDL_Quit();
|
||||
}
|
||||
1
engine/src/Engine.hpp
Normal file
1
engine/src/Engine.hpp
Normal file
@@ -0,0 +1 @@
|
||||
#pragma once
|
||||
Reference in New Issue
Block a user