mirror of https://git.sr.ht/~kikoodx/momento
61 lines
1.6 KiB
CMake
61 lines
1.6 KiB
CMake
# Configure with [fxsdk build-fx] or [fxsdk build-cg], which provide the
|
|
# toolchain file and module path of the fxSDK
|
|
|
|
cmake_minimum_required(VERSION 3.18)
|
|
project(MTEM)
|
|
|
|
include(GenerateG3A)
|
|
include(Fxconv)
|
|
|
|
find_package(Gint 2.3 REQUIRED)
|
|
find_package(LibImg 2.2 REQUIRED)
|
|
|
|
add_custom_target(filepaths
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
DEPENDS generated/filepaths.h
|
|
COMMENT "generated/filepaths.h target")
|
|
|
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_LIST_DIR}/generated/filepaths.h"
|
|
COMMENT "Generate genereated/filepaths.h."
|
|
COMMAND mkdir -p generated &&
|
|
./make_filepaths.sh > generated/filepaths.h
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
|
DEPENDS make_filepaths.sh)
|
|
|
|
include_directories(include generated)
|
|
|
|
set(SOURCES
|
|
src/main.c
|
|
src/level/load.c
|
|
src/level/draw.c
|
|
src/player/init.c
|
|
src/player/draw.c
|
|
src/player/update.c
|
|
src/player/collide.c
|
|
)
|
|
|
|
set(ASSETS
|
|
assets/graphics/tileset.png
|
|
assets/graphics/player.png
|
|
assets/graphics/burst.png
|
|
)
|
|
|
|
set(FLAGS
|
|
-Wall -Wextra -Wshadow -Wswitch-default -Wswitch-enum
|
|
-Wunreachable-code -Wstrict-prototypes -Wmissing-prototypes
|
|
-Wold-style-definition -Werror-implicit-function-declaration
|
|
-std=c11 -pedantic -Os)
|
|
|
|
fxconv_declare_assets(${ASSETS} WITH_METADATA)
|
|
|
|
add_executable(${PROJECT_NAME} ${SOURCES} ${ASSETS})
|
|
add_dependencies(${PROJECT_NAME} filepaths)
|
|
target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS})
|
|
target_link_libraries(${PROJECT_NAME} Gint::Gint)
|
|
target_link_libraries(${PROJECT_NAME} LibImg::LibImg)
|
|
|
|
generate_g3a(TARGET ${PROJECT_NAME}
|
|
OUTPUT "${PROJECT_NAME}.g3a"
|
|
NAME "${PROJECT_NAME}"
|
|
ICONS assets/graphics/icon-uns.png assets/graphics/icon-sel.png)
|