cmake_minimum_required(VERSION 3.16)
project(GANPI VERSION 1.0.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Windows-specific setup
if(WIN32)
    # Use Windows built-in libraries
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32_LEAN_AND_MEAN")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX")
    
    # Link Windows libraries
    set(WINDOWS_LIBS wininet ws2_32)
endif()

# Include directories
include_directories(include)

# Source files
file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.c")

# Create executable
add_executable(ganpi ${SOURCES})

# Link libraries
if(WIN32)
    target_link_libraries(ganpi ${WINDOWS_LIBS})
else()
    target_link_libraries(ganpi curl nlohmann_json::nlohmann_json)
endif()

# Compiler flags
if(MSVC)
    target_compile_options(ganpi PRIVATE /W4)
else()
    target_compile_options(ganpi PRIVATE -Wall -Wextra -Wpedantic)
endif()

# Install target
install(TARGETS ganpi DESTINATION bin)
