cmake_minimum_required(VERSION 3.26)
project(TriAevumLinuxTitle LANGUAGES CXX)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" OR NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
    message(FATAL_ERROR "This publisher target currently supports Linux x86_64 only")
endif()
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    message(FATAL_ERROR "Use Clang for the strict floating-point title build")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
get_filename_component(root "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
set(TRIAEVUM_TRANSLATED_TITLE_DIR "" CACHE PATH "Extracted published translated title source")
include("${root}/tools/triaevum_release/cmake/TranslatedTitleSources.cmake")
triaevum_translated_title_sources("${TRIAEVUM_TRANSLATED_TITLE_DIR}" sources)
find_package(nlohmann_json REQUIRED)
include("${root}/tools/triaevum_release/cmake/TitleSupport.cmake")
triaevum_add_title_support("${root}" "${root}/tools/oot3d/native_a32_runtime/upstream")
target_compile_options(triaevum_title_whole_aot_support PRIVATE -O2 -ffp-model=strict)
add_library(triaevum_linux_title SHARED
    ${sources}
    "${root}/tools/oot3d/native_game_runtime/triaevum_title_whole_aot_plugin.cpp")
target_include_directories(triaevum_linux_title PRIVATE "${TRIAEVUM_TRANSLATED_TITLE_DIR}")
target_compile_definitions(triaevum_linux_title PRIVATE OOT3D_NATIVE_GENERATED_WHOLE_AOT=1)
target_compile_options(triaevum_linux_title PRIVATE -O2 -ffp-model=strict)
target_link_libraries(triaevum_linux_title PRIVATE triaevum_title_whole_aot_support)
target_link_options(triaevum_linux_title PRIVATE -Wl,--no-undefined)
set_target_properties(triaevum_linux_title PROPERTIES PREFIX "" OUTPUT_NAME "triaevum_title_aot")
