cmake_minimum_required(VERSION 3.28)
project(Prog3B)

set(EXECUTABLE_NAME Prog3B)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Default build type
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()

# Quell- und Header-Dateien
set(SRC_FILES
        ${CMAKE_CURRENT_LIST_DIR}/src/main.cpp
        ${CMAKE_CURRENT_LIST_DIR}/src/gamecube.cpp
        ${CMAKE_CURRENT_LIST_DIR}/src/gamematrix.cpp
        includes/gamestate.h
        src/seriell.cpp
)
#automatisch hinzufügen
file(GLOB SRC_FILES "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp")

set(INCLUDE_DIRS
        ${CMAKE_CURRENT_LIST_DIR}/includes
        ${CMAKE_CURRENT_LIST_DIR}/raylib
)

# Executable erstellen
add_executable(${EXECUTABLE_NAME} ${SRC_FILES})

# Include-Verzeichnisse hinzufügen
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${INCLUDE_DIRS})


# Nur noch raylib und systemabhängige Libraries linken
if(WIN32)
    target_link_libraries(${EXECUTABLE_NAME} PRIVATE
            ${CMAKE_CURRENT_LIST_DIR}/windows/libraylib.a
            winmm
    )
endif()

# macOS
if(APPLE)
    target_link_libraries(${EXECUTABLE_NAME} PRIVATE
            ${CMAKE_CURRENT_LIST_DIR}/mac_arm/libraylib.a
            "-framework Cocoa"
            "-framework IOKit"
            "-framework OpenGL"
    )
endif()
