windmill-gint/CMakeLists.txt

74 lines
1.9 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(Windmill)
include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.1 REQUIRED)
include(Fxconv)
fxconv_declare_converters(assets-fx/converters.py)
set(SOURCES
src/Geometry.cpp
src/main.cpp
src/windmill_load.cpp
src/windmill_draw.cpp
src/windmill_clip.cpp
src/windmill_transform.cpp
src/windmill_utility.cpp
src/map.cpp
src/scene_map.cpp
src/camera.cpp
src/game.cpp
src/player.cpp
# ...
)
# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
set(ASSETS
# ...
)
set(ASSETS_fx
assets-fx/example.png
assets-fx/img/windmill.png
assets-fx/cube.stl
assets-fx/humanoid_tri.stl
# ...
)
set(ASSETS_cg
assets-cg/example.png
# ...
)
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
set_source_files_properties(src/map.cpp PROPERTIES
COMPILE_OPTIONS "-Wp,-w;-Wno-missing-field-initializers")
add_executable(addin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_definitions(addin PRIVATE -D__BSD_VISIBLE=1)
target_compile_options(addin PRIVATE -Wall -Wextra -Os -fno-use-cxa-atexit)
target_link_options(addin PRIVATE -Wl,-Map=map -Wl,--print-memory-usage)
target_link_libraries(addin PRIVATE Gint::Gint -lstdc++)
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
generate_g1a(
TARGET addin
OUTPUT "${PROJECT_NAME}.g1a"
NAME "${PROJECT_NAME}"
ICON assets-fx/icon.png)
add_custom_command(
TARGET addin POST_BUILD
COMMAND echo -n "Size of g1a : "
COMMAND stat -c %s "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.g1a")
elseif("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(
TARGET addin
OUTPUT "${PROJECT_NAME}.g3a"
NAME "${PROJECT_NAME}"
ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()