cmake_minimum_required(VERSION 3.16)

project(openai-api LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
    add_compile_options(/utf-8)
endif()

if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows")
    MESSAGE(STATUS "Add MinGW Param.")
endif()

add_definitions(-D_WIN32_WINNT=0x0601)

set(CMAKE_DEBUG_POSTFIX "d")
message(STATUS "System: ${CMAKE_SYSTEM_NAME}")
message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}")

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/) 

include_directories(3rd)
find_package(CURL REQUIRED)

add_executable(openai-api main.cxx zapi.h zapi.cxx jsondata.h jsondata.cxx handle.h handle.cxx server.h server.cxx)
target_link_libraries(openai-api PRIVATE CURL::libcurl)

add_executable(openai-api-test client_test.cxx)