2023-07-05 23:22:15 +02:00
|
|
|
# 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)
|
2023-07-07 18:22:39 +02:00
|
|
|
include(GenerateG3A)
|
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
include(Fxconv)
|
|
|
|
find_package(Gint 2.9 REQUIRED)
|
|
|
|
find_package(LibProf 2.4 REQUIRED)
|
|
|
|
|
2023-07-10 20:22:54 +02:00
|
|
|
#set the color mode either to 1b or 2b
|
2023-07-09 12:39:08 +02:00
|
|
|
set(COLORMODE_fx 2b)
|
2023-07-10 20:22:54 +02:00
|
|
|
#set the color mode either to 2b or EGA64
|
2023-07-09 12:39:08 +02:00
|
|
|
set(COLORMODE_cg EGA64)
|
2023-07-06 21:16:07 +02:00
|
|
|
|
2023-07-07 18:22:39 +02:00
|
|
|
fxconv_declare_converters(assets/converters.py)
|
2023-07-05 23:22:15 +02:00
|
|
|
|
|
|
|
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'
|
2023-07-07 18:22:39 +02:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets/
|
2023-07-05 23:22:15 +02:00
|
|
|
|
2023-07-07 18:22:39 +02:00
|
|
|
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets/level0.json"
|
2023-07-05 23:22:15 +02:00
|
|
|
# if several levels/maps are created, just copy the previous line and change the .json name with the new level/map
|
2023-07-07 18:22:39 +02:00
|
|
|
DEPENDS assets/converters.py
|
|
|
|
assets/tileset.png
|
|
|
|
assets/tilesetnpp.tsx
|
|
|
|
assets/level0.tmx
|
2023-07-05 23:22:15 +02:00
|
|
|
# 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
|
2023-07-06 22:02:37 +02:00
|
|
|
src/player.c
|
2023-07-08 15:55:06 +02:00
|
|
|
src/memory.c
|
|
|
|
src/game.c
|
2023-07-09 22:02:59 +02:00
|
|
|
src/dialogs.c
|
2023-07-05 23:22:15 +02:00
|
|
|
# ...
|
|
|
|
)
|
|
|
|
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
|
|
|
|
set(ASSETS
|
2023-07-07 18:22:39 +02:00
|
|
|
assets/level0.json
|
2023-07-05 23:22:15 +02:00
|
|
|
# ...
|
|
|
|
)
|
2023-07-07 18:22:39 +02:00
|
|
|
|
|
|
|
set(ASSETS_cg
|
2023-07-08 20:07:34 +02:00
|
|
|
assets-cg/demo_player.png
|
2023-07-09 22:02:59 +02:00
|
|
|
assets-cg/player_face.png
|
2023-07-10 20:55:27 +02:00
|
|
|
assets-cg/font.png
|
2023-07-07 18:22:39 +02:00
|
|
|
)
|
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
set(ASSETS_cg_2b
|
|
|
|
assets-cg/levels/tileset2b_CG.png
|
|
|
|
)
|
|
|
|
|
|
|
|
set(ASSETS_cg_EGA64
|
|
|
|
assets-cg/levels/tilesetEGA64_CG.png
|
|
|
|
)
|
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
set(ASSETS_fx
|
2023-07-08 20:07:34 +02:00
|
|
|
assets-fx/demo_player.png
|
2023-07-09 22:02:59 +02:00
|
|
|
assets-fx/player_face.png
|
2023-07-10 20:55:27 +02:00
|
|
|
assets-fx/font.png
|
2023-07-05 23:22:15 +02:00
|
|
|
# ...
|
|
|
|
)
|
|
|
|
|
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
|
|
|
|
# ...
|
|
|
|
)
|
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} ${ASSETS_fx_1b} ${ASSETS_fx_2b} ${ASSETS_cg_2b} ${ASSETS_cg_EGA64} WITH_METADATA)
|
2023-07-06 21:16:07 +02:00
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
|
|
|
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}} ${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_fx}} )
|
|
|
|
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
|
|
|
add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}} ${ASSETS_${FXSDK_PLATFORM}_${COLORMODE_cg}} )
|
|
|
|
endif()
|
2023-07-07 18:22:39 +02:00
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
# fx colormode
|
|
|
|
if("${COLORMODE_fx}" STREQUAL 1b)
|
2023-07-06 21:16:07 +02:00
|
|
|
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR1BIT)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
if("${COLORMODE_fx}" STREQUAL 2b)
|
2023-07-06 21:16:07 +02:00
|
|
|
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR2BIT)
|
|
|
|
endif()
|
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
# cg colormode
|
|
|
|
if("${COLORMODE_cg}" STREQUAL 2b)
|
|
|
|
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOR2BIT)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
if("${COLORMODE_cg}" STREQUAL EGA64)
|
|
|
|
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -DCOLOREGA)
|
|
|
|
endif()
|
2023-07-05 23:22:15 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
2023-07-05 23:22:15 +02:00
|
|
|
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
2023-07-07 18:22:39 +02:00
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
if("${COLORMODE_fx}" STREQUAL 1b)
|
|
|
|
generate_g1a(TARGET myaddin OUTPUT "PrjPC1b.g1a"
|
|
|
|
NAME "Col RPG NB" ICON assets-fx/icon1.png)
|
2023-07-06 21:16:07 +02:00
|
|
|
endif()
|
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
if("${COLORMODE_fx}" STREQUAL 2b)
|
|
|
|
generate_g1a(TARGET myaddin OUTPUT "PrjPC2b.g1a"
|
|
|
|
NAME "Col RPG Grey" ICON assets-fx/icon2.png)
|
2023-07-06 21:16:07 +02:00
|
|
|
endif()
|
2023-07-07 18:22:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
|
|
|
|
2023-07-09 12:39:08 +02:00
|
|
|
if("${COLORMODE_cg}" STREQUAL 2b)
|
|
|
|
generate_g3a(TARGET myaddin OUTPUT "PrjPC2b.g3a"
|
|
|
|
NAME "Col RPG Grey" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if("${COLORMODE_cg}" STREQUAL EGA64)
|
|
|
|
generate_g3a(TARGET myaddin OUTPUT "PrjPCega.g3a"
|
|
|
|
NAME "Col RPG EGA" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
|
|
|
endif()
|
2023-07-07 18:22:39 +02:00
|
|
|
|
|
|
|
endif()
|