Files
factorygame/CMakeLists.txt
2025-06-02 22:49:53 +02:00

54 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 4.0)
project(factorygame C)
set(CMAKE_C_STANDARD 23)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
add_executable(factorygame
tiles/tile.c
tiles/tile.h
util/font.c
util/font.h
util/audio.c
util/audio.h
util/util.c
util/util.h
items/item.c
items/item.h
tiles/belt.c
tiles/belt.h
tiles/furnace.c
tiles/furnace.h
player/player.c
player/player.h # Ensure the target is defined before linking
tiles/tilecallbacks.c
tiles/tilecallbacks.h
main.c
util/perlin.c
util/perlin.h
util/atlas.c
util/atlas.h
tiles/miner.c
tiles/miner.h
)
# Define the path to the assets folder
set(ASSETS_SOURCE_DIR "${CMAKE_SOURCE_DIR}/assets")
set(ASSETS_BINARY_DIR "${CMAKE_BINARY_DIR}/assets")
# Copy assets directory always
add_custom_target(copy_assets ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${ASSETS_SOURCE_DIR}" "${ASSETS_BINARY_DIR}"
COMMENT "Copying assets directory to build output..."
)
# Make sure factorygame depends on the assets being copied
add_dependencies(factorygame copy_assets)
target_link_libraries(factorygame SDL2 SDL2_ttf SDL2_image m)