# Configure with [fxsdk build-cg], which provide the
# toolchain file and module path of the fxSDK

cmake_minimum_required(VERSION 3.15)
project(MyAddin)

include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.9.0 REQUIRED)
find_package(LibProf 2.4 REQUIRED)

set(SOURCES
  src/main.cc
  # src/clock.cc
  src/src/segment.cc
  src/src/camera.cc
  src/src/circuit.cc
  src/src/drawstuff.cc
  src/src/clouds.cc
  src/src/cars.cc
  src/src/menus.cc
  src/src/saves.cc
  src/src/utils.cc
)

set(ASSETS_cg
  assets-cg/traffic/car1.png
  assets-cg/traffic/car2.png
  assets-cg/traffic/car3.png
  assets-cg/traffic/car4.png
  assets-cg/traffic/car5.png
  assets-cg/traffic/car6.png
  assets-cg/traffic/car7.png
  assets-cg/traffic/car8.png

  assets-cg/decos/plains/pl_tree1.png
  assets-cg/decos/plains/pl_tree2.png
  assets-cg/decos/plains/pl_tree3.png
  assets-cg/decos/plains/pl_tree4.png

  assets-cg/decos/desert/dt_tree1.png
  assets-cg/decos/desert/dt_tree2.png
  assets-cg/decos/desert/dt_tree3.png
  assets-cg/decos/desert/dt_tree4.png
  assets-cg/decos/desert/dt_smallleaf.png

  assets-cg/decos/usa/us_tree1.png
  assets-cg/decos/usa/us_tree2.png
  assets-cg/decos/usa/us_tree4.png
  assets-cg/decos/usa/us_bigleaf.png
  assets-cg/decos/usa/us_smallleaf.png

  assets-cg/decos/finland/fi_tree1.png
  assets-cg/decos/finland/fi_tree2.png
  assets-cg/decos/finland/fi_tree4.png
  assets-cg/decos/finland/fi_rocks.png

  assets-cg/decos/africa/af_tree1.png
  assets-cg/decos/africa/af_tree2.png
  assets-cg/decos/africa/af_tree3.png
  assets-cg/decos/africa/af_bigleaf.png

  assets-cg/decos/common/cc_bigleaf.png
  assets-cg/decos/common/cc_smallleaf.png
  assets-cg/decos/common/cc_rocks.png
  assets-cg/decos/common/cc_void.png

  assets-cg/player/player.png
  assets-cg/player/smoke1.png
  assets-cg/player/smoke2.png
  assets-cg/player/smoke3.png

  assets-cg/clouds/sky1.png
  assets-cg/clouds/sky2.png
  assets-cg/clouds/sky3.png

  assets-cg/backgrnd/mountain.png
  assets-cg/backgrnd/treeline.png
  assets-cg/backgrnd/canyon.png
  assets-cg/backgrnd/rockline.png
  assets-cg/backgrnd/dunes.png
  assets-cg/backgrnd/snowmount.png
  assets-cg/backgrnd/treelinesnow.png
  assets-cg/backgrnd/kilimandjaro.png

  assets-cg/billboard/leftturn.png
  assets-cg/billboard/rightturn.png
  assets-cg/billboard/uphill.png
  assets-cg/billboard/downhill.png
  assets-cg/billboard/checkpoint.png
  assets-cg/billboard/startlights.png
  assets-cg/billboard/stoplights.png
  assets-cg/billboard/waitlights.png

  assets-cg/fonts/speedfont.png
  assets-cg/fonts/auto15.png
  assets-cg/fonts/auto20.png
  assets-cg/fonts/startseq.png
  assets-cg/fonts/plate5.png

  assets-cg/menus/flag.png
  assets-cg/menus/bigflag.png

  assets-cg/hud/speedhud.png

  assets-cg/screens/mainscreen.png
  assets-cg/screens/mainscrbright.png

  assets-cg/miniscreen/africa1.png
  assets-cg/miniscreen/desert1.png
  assets-cg/miniscreen/finland1.png
  assets-cg/miniscreen/plains1.png
  assets-cg/miniscreen/usa1.png
  assets-cg/miniscreen/linear.png
  assets-cg/miniscreen/circular.png
)

fxconv_declare_assets(${ASSETS_cg} WITH_METADATA)

add_executable(myaddin ${SOURCES} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -std=c++20 -fpermissive)
target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage)
target_link_libraries(myaddin LibProf::LibProf Gint::Gint -lstdc++)

if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
  generate_g3a(TARGET myaddin OUTPUT "OutRun.g3a" VERSION 01.090.0000
    NAME "OutRun" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()
