# 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(Copy3DEngine LANGUAGES C ASM)

include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.9 REQUIRED)
find_package(LibProf 2.1 REQUIRED)

# le nom de votre jeu
set(NAMEOFGAME "Illusion3D")
# Nom de l'auteur -> votre nom/pseudo
set(AUTHOR "Fcalva")

set(SOURCES
  #sources du jeu
  src/main.c
  src/gfx.c
  src/map.c
  src/game.c
  #sources du moteur
  eng/moteur.c
  eng/map.c
  eng/utils.c
  eng/sprites.c
  eng/game.c
)

set(ASSETS
  assets-fx/title.png
  assets-fx/blood.png

  assets-fx/hands0.png
  assets-fx/hands1.png
  assets-fx/hands2.png  
  assets-fx/anvil0.png
  assets-fx/anvil1.png
  assets-fx/anvil2.png
  assets-fx/anvil3.png

  assets-fx/sprites/friendlyguy.png
  assets-fx/sprites/friendlyguy1.png  
  assets-fx/sprites/anvil_pickup.png

  assets-fx/textures/briques0.png
  assets-fx/textures/buisson1.png
  assets-fx/textures/bwain.png
  assets-fx/textures/bwain1.png
  assets-fx/textures/meat.png
  assets-fx/textures/meat1.png
)

fxconv_declare_assets(${ASSETS} WITH_METADATA)

add_executable(Copy3DEngine ${SOURCES} ${ASSETS})
target_compile_options(Copy3DEngine PRIVATE -Wall -Wextra -O2)
target_include_directories(Copy3DEngine PRIVATE "include/")
target_compile_definitions(Copy3DEngine PRIVATE NAMEOFGAME="${NAMEOFGAME}" AUTHOR="${AUTHOR}")
target_link_libraries(Copy3DEngine Gint::Gint)
target_link_libraries(Copy3DEngine LibProf::LibProf)
target_link_options(Copy3DEngine PRIVATE -Wl,--print-memory-usage)

if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
  generate_g1a(TARGET Copy3DEngine OUTPUT ${NAMEOFGAME}".g1a"
    NAME "Illu3D" ICON assets-fx/icon.png)
else()
  generate_g3a(TARGET Copy3DEngine OUTPUT ${NAMEOFGAME}".g3a"
    NAME "Illu3D" ICONS assets-fx/icon.png assets-fx/icon.png)
endif()
