cmake_minimum_required(VERSION 3.28)
project(Prog3B)
set(EXECUTABLE_NAME Prog3B)
set(OS_NAME mac_arm)

# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)

# Set the default build type if not specified
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()

set(SRC_FILES
        ${CMAKE_CURRENT_LIST_DIR}/main.cpp
        ${CMAKE_CURRENT_LIST_DIR}/gamecube.cpp
)

set(INCLUDE_DIRS
        ${CMAKE_CURRENT_LIST_DIR}/mac_arm
)

add_executable(${EXECUTABLE_NAME} ${SRC_FILES})
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${INCLUDE_DIRS})
target_link_libraries(${EXECUTABLE_NAME} PRIVATE
        ${CMAKE_CURRENT_LIST_DIR}/${OS_NAME}/libgamematrix.a
        ${CMAKE_CURRENT_LIST_DIR}/mac_arm/libraylib.a
)
if (WIN32)
    target_link_libraries(Prog3B PRIVATE winmm)
endif()

# Checks if OSX and links appropriate frameworks (Only required on MacOS)
if (APPLE)
    target_link_libraries(Prog3B PRIVATE "-framework IOKit")
    target_link_libraries(Prog3B PRIVATE "-framework Cocoa")
    target_link_libraries(Prog3B PRIVATE "-framework OpenGL")
endif()
