cmake_minimum_required(VERSION 3.20)

##################################################
# General Setup
##################################################
project(cl_sdk_samples)

set(CMAKE_CXX_STANDARD 17)

include(InitializeCLLibraries.cmake)

# C,  static client api
add_executable(simple_c_static simple_c/main.c)
target_link_libraries(simple_c_static PRIVATE client_api_static)

# C++,  static client api
add_executable(simple_cpp_static simple_cpp/main.cpp)
target_link_libraries(simple_cpp_static PRIVATE client_api_static)
set_property(TARGET simple_cpp_static PROPERTY CXX_STANDARD 17)

# C,  shared client api
add_executable(simple_c_shared simple_c/main.c)
target_link_libraries(simple_c_shared PRIVATE client_api_shared)

# C++,  shared client api
add_executable(simple_cpp_shared simple_cpp/main.cpp)
target_link_libraries(simple_cpp_shared PRIVATE client_api_shared)
set_property(TARGET simple_cpp_shared PROPERTY CXX_STANDARD 17)

# On Windows we need to copy the dependencies over to the output directory
if (WIN32)
    add_custom_command(TARGET simple_c_shared POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:simple_c_shared> $<TARGET_RUNTIME_DLLS:simple_c_shared>
        COMMAND_EXPAND_LISTS
    )
    add_custom_command(TARGET simple_cpp_shared POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:simple_cpp_shared> $<TARGET_RUNTIME_DLLS:simple_cpp_shared>
        COMMAND_EXPAND_LISTS
    )
endif()
