cmake_minimum_required(VERSION 3.20)

project(vexe LANGUAGES CXX)

find_package(Boost REQUIRED COMPONENTS thread)
if(NOT Boost_FOUND)
    message(FATAL_ERROR "Boost Not found")
endif()

find_package( fmt )
if( NOT fmt_FOUND )
    message( FATAL_ERROR "libfmt not found" )
endif()

message( "Vimba info: $ENV{VIMBA_X_HOME}" )
#/repos/VimbaX_2023-1/api/lib/cmake/vmb
#export VIMBA_X_HOME=/repos/VimbaX_2023-1
find_package( Vmb REQUIRED COMPONENTS CPP HINTS /repos/VimbaX_2023-1/api/lib/cmake/vmb )
if( NOT Vmb_FOUND )
    message( FATAL_ERROR "vmb not found" )
endif()

find_package( SDL2 )
if( NOT SDL2_FOUND )
    message( FATAL_ERROR "SDL2 not found" )
endif()

find_package( SDL2_image )
if( NOT SDL2_image_FOUND )
    message( FATAL_ERROR "SDL2_image not found" )
endif()

find_package( assimp )
if( NOT assimp_FOUND )
    message( FATAL_ERROR "assimp not found" )
endif()

find_package( glm )
if( NOT glm_FOUND )
    message( FATAL_ERROR "glm not found" )
endif()

find_package( Eigen3 )
if( NOT Eigen3_FOUND )
    message( FATAL_ERROR "Eigen3 not found" )
endif()

find_package( GLEW )
if( NOT GLEW_FOUND )
    message( FATAL_ERROR "GLEW not found" )
endif()

include ("/repos/aburn/usr/include/cmake/AftrBurnerEngine.cmake")

#For debugging, I have linked -fsanitize=address into AftrBurner and this exe to help detect invalid memory access
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common" )

add_executable(vexe main.cpp bar.cpp  GLViewNewModule.cpp )
set_property(TARGET vexe PROPERTY CXX_STANDARD 23)

add_link_options( "--version" )

target_include_directories( vexe PUBLIC /repos/aburn/usr/include/aftr )
target_include_directories( vexe PUBLIC /repos/aburn/usr/include/external )


target_link_libraries( vexe PUBLIC AftrBurnerEngine::AftrBurnerEngine )

target_link_libraries(vexe PUBLIC Boost::thread fmt::fmt Vmb::CPP SDL2::SDL2 SDL2_image::SDL2_image assimp::assimp Eigen3::Eigen glm::glm GLEW::GLEW "GL" "dl" Vmb::CPP )



