# pgs_probe: checks that paraLLEl-GS (https://github.com/Arntzen-Software/parallel-gs, LGPL-3.0+) builds with
# MSVC and runs on this GPU. See README.md for how to fetch it.
cmake_minimum_required(VERSION 3.24)
project(pgs_probe LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(PS2X_PGS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../build/third_party/parallel-gs" CACHE PATH
    "paraLLEl-GS checkout, with its Granite submodule")
if (NOT EXISTS "${PS2X_PGS_DIR}/gs/gs_interface.hpp")
    message(FATAL_ERROR "paraLLEl-GS not found at ${PS2X_PGS_DIR} (see tools/pgs_probe/README.md)")
endif()

# paraLLEl-GS picks the static C runtime unless told otherwise; the game uses the DLL runtime.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set(PARALLEL_GS_STANDALONE ON CACHE BOOL "" FORCE)
add_subdirectory("${PS2X_PGS_DIR}" parallel-gs EXCLUDE_FROM_ALL)

add_executable(pgs_probe probe.cpp)
target_link_libraries(pgs_probe PRIVATE parallel-gs)
