From 10b41cc429b5c14023fa3bee0b09040fef1b2929 Mon Sep 17 00:00:00 2001 From: cflip Date: Wed, 23 Mar 2022 18:09:08 -0600 Subject: Automatically copy resources to build directory --- src/CMakeLists.txt | 6 ++++++ src/main.cpp | 2 +- src/train.h | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d290495..b30b333 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,3 +23,9 @@ target_link_libraries( PRIVATE SDL2::SDL2 ) + +add_custom_command( + TARGET Nonortho POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/res $/res + COMMENT "Copying resources" VERBATIM +) diff --git a/src/main.cpp b/src/main.cpp index 152021e..1d68272 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,7 +11,7 @@ int main(int argc, char** argv) constexpr int Scale = 3; Window window("Nonortho", Width, Height, Scale); - Bitmap tiles("../res/tiles.png"); + Bitmap tiles("res/tiles.png"); Level level(32, 32, tiles); Bitmap bitmap(Width, Height); diff --git a/src/train.h b/src/train.h index 51c2729..3cd23e4 100644 --- a/src/train.h +++ b/src/train.h @@ -8,7 +8,7 @@ class Level; class Train { public: explicit Train(Level& level) - : m_sprite("../res/car.png"), m_level(level) { } + : m_sprite("res/car.png"), m_level(level) { } void update(); void draw(Bitmap&, int, int); -- cgit v1.2.3