cmake_minimum_required(VERSION 3.16.5)

project(VMath)

include(${PROJECT_SOURCE_DIR}/../build-utils/cmake/compiler_settings.cmake)

if(NOT TARGET TL)
    add_subdirectory("${PROJECT_SOURCE_DIR}/../TL" "./TL")
endif()

file(GLOB_RECURSE SRC "src/*.cpp")
file(GLOB_RECURSE HEADERS "include/*.h" "include/*.hpp" "include/*.inl")

foreach(_source IN ITEMS ${HEADERS})
get_filename_component(_source_path "${_source}" PATH)
file(RELATIVE_PATH _source_path_rel "${PROJECT_SOURCE_DIR}" "${_source_path}")
string(REPLACE "/" "\\" _group_path "${_source_path_rel}")
source_group("${_group_path}" FILES "${_source}")
endforeach()

foreach(_source IN ITEMS ${SRC})
get_filename_component(_source_path "${_source}" PATH)
file(RELATIVE_PATH _source_path_rel "${PROJECT_SOURCE_DIR}" "${_source_path}")
string(REPLACE "/" "\\" _group_path "${_source_path_rel}")
source_group("${_group_path}" FILES "${_source}")
endforeach()

add_library(VMath STATIC ${SRC} ${HEADERS})

target_include_directories(VMath PUBLIC "include")
target_link_libraries(VMath TL)


if (0)
#//////////////////////////////////

    set(Boost_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../boost")
    set(Boost_LIBRARY_DIR "${PROJECT_SOURCE_DIR}/../boost/stage/lib")
    set(Boost_USE_STATIC_LIBS ON) 
    set(Boost_USE_MULTITHREADED ON)  
    set(Boost_USE_STATIC_RUNTIME OFF) 
    find_package(Boost 1.69 COMPONENTS unit_test_framework)

    file(GLOB_RECURSE TEST_SRC "test/*.cpp" "test/*.h")
    add_executable(VMath_Test ${TEST_SRC})
    target_link_libraries(VMath_Test VMath)
    target_link_libraries(VMath_Test ${Boost_LIBRARIES})
    target_include_directories(VMath_Test PUBLIC ${Boost_INCLUDE_DIRS})
endif()