Collab_RPG/CMakeLists.txt

107 lines
2.6 KiB
Text
Raw Normal View History

# 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.15)
project(MyAddin)
include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.9 REQUIRED)
find_package(LibProf 2.4 REQUIRED)
2023-07-06 21:16:07 +02:00
#set the color mode either to 1bit or 2bits
2023-07-08 22:48:46 +02:00
set(COLORMODE 2b)
2023-07-06 21:16:07 +02:00
fxconv_declare_converters(assets/converters.py)
add_custom_command(
COMMENT "Convert Tiled TMX map to usable JSON file"
COMMAND tiled --export-tileset json tilesetnpp.tsx tilesetnpp.json
COMMAND find | grep .*.tmx | sed 's/.tmx//g' | xargs -l bash -c 'tiled --export-map json $$0.tmx $$0.json'
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets/
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets/level0.json"
# if several levels/maps are created, just copy the previous line and change the .json name with the new level/map
DEPENDS assets/converters.py
assets/tileset.png
assets/tilesetnpp.tsx
assets/level0.tmx
# if several levels/maps are created, just copy the previous line and change the .json name with the new level/map
)
set(SOURCES
src/main.c
src/map.c
src/player.c
src/memory.c
src/game.c
# ...
)
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
set(ASSETS
assets/level0.json
# ...
)
set(ASSETS_cg
2023-07-09 10:30:27 +02:00
assets-cg/tilesetEGA64_CG.png
assets-cg/demo_player.png
)
set(ASSETS_fx
assets-fx/demo_player.png
# ...
)
2023-07-06 21:16:07 +02:00
set(ASSETS_fx_1b
2023-07-08 18:02:05 +02:00
assets-fx/levels/tileset1b.png
2023-07-06 21:16:07 +02:00
# ...
)
set(ASSETS_fx_2b
assets-fx/levels/tileset2b.png
# ...
)
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} ${ASSETS_fx_1b} ${ASSETS_fx_2b} WITH_METADATA)
2023-07-06 21:16:07 +02:00
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}} ${ASSETS_${FXSDK_PLATFORM}_${COLORMODE}} )
2023-07-06 21:16:07 +02:00
if("${COLORMODE}" STREQUAL 1b)
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR1BIT)
endif()
if("${COLORMODE}" STREQUAL 2b)
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR2BIT)
endif()
target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage)
target_link_libraries(myaddin LibProf::LibProf Gint::Gint)
2023-07-06 21:16:07 +02:00
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
2023-07-06 21:16:07 +02:00
if("${COLORMODE}" STREQUAL 1b)
generate_g1a(TARGET myaddin OUTPUT "PrjPC1b.g1a"
NAME "Col RPG NB" ICON assets-fx/icon1.png)
endif()
if("${COLORMODE}" STREQUAL 2b)
generate_g1a(TARGET myaddin OUTPUT "PrjPC2b.g1a"
NAME "Col RPG Grey" ICON assets-fx/icon2.png)
endif()
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(TARGET myaddin OUTPUT "PRJPC_CG.g3a"
NAME "Col_RPG_CG" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()