include_guard() MACRO( aftr_find_build_dependencies ) MESSAGE( STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Inside of aftr_FindDependencies::aftr_find_build_dependencies... Let's search for module/engine dependencies..." ) include(CMakePackageConfigHelpers) include(CMakePrintHelpers) ########## #Specify CMake Policies to avoid red warnings in the configurations as cmake's behavior changes with new versions if( POLICY CMP0074 ) #SLN Added 14 Oct 2018 #In CMake 3.12 and above the ``find_package()`` command now searches prefixes specified by the ``_ROOT`` CMake variable and the ``_ROOT`` environment variable. cmake_policy( SET CMP0074 NEW ) endif() if( POLICY CMP0144 ) # SLN Added 9 Aug 2023 find_package( PacKaGeName_ROOT ) is now identical to find_package( PACKAGENAME_ROOT ) (case insensitive on the prefix name) cmake_policy( SET CMP0144 NEW ) endif() ########## # Perform initial search for dependencies to build MESSAGE( STATUS " --- Boost Libraries --- " ) MESSAGE( STATUS " For Windows installs: Ensure you have created the following BOOST Specific" ) MESSAGE( STATUS " environmental BOOST_DIR and point it to the folder containing" ) MESSAGE( STATUS " the file BoostConfig.cmake." ) MESSAGE( STATUS " Looking for Boost here:" ) MESSAGE( STATUS "ENV{BOOST_DIR} : $ENV{BOOST_DIR}" ) set( Boost_DEBUG OFF ) set( Boost_USE_STATIC_RUNTIME OFF ) set( Boost_USE_STATIC_LIBS ON ) set( Boost_USE_MULTITHREADED ON ) FIND_PACKAGE( Boost 1.70.0 COMPONENTS regex thread filesystem timer date_time system chrono atomic iostreams log OPTIONAL_COMPONENTS locale ) if( Boost_FOUND ) MESSAGE( STATUS "{Boost_INCLUDE_DIRS} : ${Boost_INCLUDE_DIRS}" ) MESSAGE( STATUS "Boost_LIBRARY_DIRS : ${Boost_LIBRARY_DIRS}" ) MESSAGE( STATUS "Boost component libs : ${Boost_LIBRARIES}" ) else() MESSAGE( "Boost 1.70.0 or greater not found." ) MESSAGE( "On *NIX, install 'apt-get install libboost1.55-all-dev' (if using APT via Debian. Otherwise use your distro's package manager to install Boost 1.72.0 or greater)." ) MESSAGE( "For Windows: To Find Boost Libraries, create environment variable call BOOST_LIBRARYDIR and point to lib folder. Or set CMAKE Variables BOOST_LIBRARY_DIRS and BOOST_LIBRARYDIR as well as Boost_INCLUDE_DIRS (case sensitive) to point at your boost install." ) endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS "" ) MESSAGE( STATUS " --- SDL2 Libraries ---- " ) FIND_PACKAGE( SDL2 REQUIRED ) #2.0.1 REQUIRED ) if( SDL2_FOUND ) MESSAGE( STATUS "***Found SDL2." ) MESSAGE( STATUS " SDL2 Include (SDL2_INCLUDE_DIR): ${SDL2_INCLUDE_DIR}") #print_target_properties( SDL2::SDL2-static ) cmake_print_properties(TARGETS SDL2::SDL2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ) cmake_print_properties(TARGETS SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB ) cmake_print_properties(TARGETS SDL2::SDL2 PROPERTIES IMPORTED_LOCATION ) cmake_print_properties(TARGETS SDL2::SDL2 PROPERTIES COMPATIBLE_INTERFACE_BOOL ) cmake_print_properties(TARGETS SDL2::SDL2 PROPERTIES INTERFACE_SDL2_SHARED ) cmake_print_properties(TARGETS SDL2::SDL2 PROPERTIES COMPATIBLE_INTERFACE_STRING ) cmake_print_properties(TARGETS SDL2::SDL2 PROPERTIES INTERFACE_SDL_VERSION ) cmake_print_properties(TARGETS SDL2::SDL2main PROPERTIES IMPORTED_LOCATION ) cmake_print_properties(TARGETS SDL2::SDL2main PROPERTIES COMPATIBLE_INTERFACE_STRING ) cmake_print_properties(TARGETS SDL2::SDL2main PROPERTIES INTERFACE_SDL_VERSION ) MESSAGE( STATUS " SDL2 Libs (SDL2_LIBRARY): ${SDL2_LIBRARY}" ) MESSAGE( STATUS " SDL2_LIBRARIES: ${SDL2_LIBRARIES}" ) else() MESSAGE( "SDL2 2.0.1 or greater not found." ) MESSAGE( "On *NIX, use your package manager to install libSDL2, or goto engine/src/SDL2, unzip archive file and configure, make, make install, yourself." ) endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS "" ) MESSAGE( STATUS " ---SDL2 Image---------- " ) FIND_PACKAGE( SDL2_image 2.0.0 REQUIRED ) #SDL2Image_FOUND if( SDL2_image_FOUND ) MESSAGE( STATUS "***Found SDL2_image." ) MESSAGE( STATUS " SDL2_image::SDL2_image Properties set in sdl2_image-config.cmake and found via ENV{SDL2_image_DIR}") cmake_print_properties(TARGETS SDL2_image::SDL2_image PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ) cmake_print_properties(TARGETS SDL2_image::SDL2_image PROPERTIES IMPORTED_IMPLIB ) cmake_print_properties(TARGETS SDL2_image::SDL2_image PROPERTIES IMPORTED_LOCATION ) cmake_print_properties(TARGETS SDL2_image::SDL2_image PROPERTIES COMPATIBLE_INTERFACE_BOOL ) cmake_print_properties(TARGETS SDL2_image::SDL2_image PROPERTIES INTERFACE_SDL2_SHARED ) else() MESSAGE( "SDL2Image 2.0.0 or greater not found." ) MESSAGE( "On *NIX, use your package manager to install libsdl2-image-2.0-0, or goto engine/src/SDL2_image-2.0.2, unzip archive file and configure, make, make install, yourself." ) endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS "" ) MESSAGE( STATUS " ---GDAL---------------- " ) IF( AFTR_CONFIG_USE_GDAL ) FIND_PACKAGE( GDAL 3.0.0 ) if( GDAL_FOUND ) MESSAGE( STATUS "***Found GDAL." ) MESSAGE( STATUS " GDAL Include (GDAL_INCLUDE_DIR): ${GDAL_INCLUDE_DIR}") MESSAGE( STATUS " GDAL Libs (GDAL_LIBRARY): ${GDAL_LIBRARY}" ) else() MESSAGE( WARNING "GDAL 3.0.0 or greater not found." ) MESSAGE( WARNING "On *NIX, use your package manager to install GDAL, or goto engine/src/gdal.3.0.4, unzip archive file and configure, make, make install, yourself (your distro packager may not have gdal-1.11.0 available)." ) MESSAGE( WARNING "On windows this is usually not a problem since this library is embedded in this repo. This section may be ignored. " ) endif() else() MESSAGE( STATUS "GDAL is disabled, not searching for it.") endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS "" ) MESSAGE( STATUS " ---ASSIMP---------------- " ) IF( AFTR_CONFIG_USE_ASSIMP ) FIND_PACKAGE( assimp HINTS /usr/local/lib/cmake/assimp-5.0 #when using linux, some installers place it here ) MESSAGE( STATUS "***Found assimp." ) MESSAGE( STATUS " ASSIMP Include (ASSIMP_INCLUDE_DIRS) : ${ASSIMP_INCLUDE_DIRS}") MESSAGE( STATUS " ASSIMP Libs (ASSIMP_LIBRARY_DIRS) : ${ASSIMP_LIBRARY_DIRS}" ) MESSAGE( STATUS " ASSIMP Libs (ASSIMP_LIBRARIES) : ${ASSIMP_LIBRARIES}" ) if( NOT assimp_FOUND ) MESSAGE( WARNING "ASSMIP 3.3.0 or greater not found." ) MESSAGE( WARNING "On *NIX, use your package manager to install ASSMIP, or build from source and use cmake to configure then make and install, yourself (your distro packager may not have assimp-3.3.1 available)." ) MESSAGE( WARNING "On windows ensure you have the AftrBurner 3rdParty repo at a location such as C:/repos/libs/ and you have run AFTR__Extract_3rdParty.sh and AFTR__Set_Path_Bins.bat" ) endif() else() MESSAGE( STATUS "ASSIMP is disabled, not searching for it." ) endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS "" ) MESSAGE( STATUS " ---Freetype2----------- " ) FIND_PACKAGE( Freetype ) if( FREETYPE_FOUND ) MESSAGE( STATUS "***Found Freetype." ) MESSAGE( STATUS " Freetype Include (FREETYPE_INCLUDE_DIRS): ${FREETYPE_INCLUDE_DIRS}") MESSAGE( STATUS " Freetype Libs (FREETYPE_LIBRARIES) : ${FREETYPE_LIBRARIES}" ) else() if( WIN32 ) IF( AFTR_CONFIG_USE_OGL_GLEW ) MESSAGE( STATUS "Windows Freetype header {AFTR_3RD_PARTY_ROOT}/freetype-2.9/include : $ENV{AFTR_3RD_PARTY_ROOT}/freetype-2.9/include") MESSAGE( STATUS "Windows Freetype lib {AFTR_3RD_PARTY_ROOT}/freetype-2.9/lib/... : $ENV{AFTR_3RD_PARTY_ROOT}/freetype-2.9/lib/freetype.lib") endif() else() MESSAGE( WARNING "FreeTye 2.5.3 or greater not found.\n" "On *NIX, use your package manager to install freetype-2.5+ (sudo apt-get install libfreetyp6-dev), or goto google freetype source, unzip archive file and finally configure, make, make install, yourself./n" ) endif() endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " ---GLEW---------------- " ) if( UNIX ) FIND_PACKAGE( GLEW ) if( GLEW_FOUND ) MESSAGE( STATUS "***Found GLEW." ) MESSAGE( STATUS " GLEW Include (GLEW_INCLUDE_DIRS): ${GLEW_INCLUDE_DIRS}") MESSAGE( STATUS " GLEW Libs (GLEW_STATIC_LIBRARIES): ${GLEW_STATIC_LIBRARIES}" ) endif() endif() if( WIN32 ) IF( AFTR_CONFIG_USE_OGL_GLEW ) MESSAGE( STATUS "Windows GLEW header {AFTR_3RD_PARTY_ROOT}/glew-2.1.0/include : $ENV{AFTR_3RD_PARTY_ROOT}/glew-2.1.0/include") MESSAGE( STATUS "Windows GLEW lib {AFTR_3RD_PARTY_ROOT}/glew-2.1.0/lib/... : $ENV{AFTR_3RD_PARTY_ROOT}/glew-2.1.0/lib/Release/x64/glew32.lib") endif() endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " ---fmtlib/fmt---------- " ) if( AFTR_CONFIG_USE_FMT_LIB ) find_package( fmt ) if( fmt_FOUND ) MESSAGE( STATUS " fmt_FOUND: ${fmt_FOUND}" ) MESSAGE( STATUS " fmt_DIR : ${fmt_DIR}" ) else() MESSAGE( " libFMT NOT FOUND. Ensure you export fmt_DIR into your environment as a hint") MESSAGE( " For Example: export fmt_DIR=C:/repos/libs/fmt/lib/cmake/fmt (linux-esque)") MESSAGE( " OR: set fmt_DIR=C:/repos/libs/fmt/lib/cmake/fmt (windows w/ no git or bash)") MESSAGE( " OR: Set this variable in the Windows Environment Variables") endif() #set( libFMT_PATH ./fmt-7.1.2 ) #MakeAbsolute( libFMT_PATH ) #MESSAGE( STATUS " libFMT Include (libFMT_PATH): ${libFMT_PATH}") #add_subdirectory( ${libFMT_PATH} EXCLUDE_FROM_ALL) endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " ---range-v3/range-v3---------- " ) if( AFTR_CONFIG_USE_RANGE_V3_LIB ) find_package( range-v3 ) if( range-v3_FOUND ) MESSAGE( STATUS " range-v3_FOUND: ${range-v3_FOUND}" ) MESSAGE( STATUS " range-v3_DIR : ${range-v3_DIR}" ) else() MESSAGE( " range-v3 NOT FOUND. Ensure you export range-v3_DIR into your environment as a hint") MESSAGE( " For Example: export range-v3_DIR=C:/repos/libs/range-v3-0.12.0/lib/cmake/range-v3 (linux-esque)") MESSAGE( " OR: set range-v3_DIR=C:/repos/libs/range-v3-0.12.0/lib/cmake/range-v3 (windows w/ no git or bash)") MESSAGE( " OR: Set this variable in the Windows Environment Variables") endif() endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " ---Eigen3::Eigen---------- " ) if( AFTR_CONFIG_USE_EIGEN_V3 ) find_package( Eigen3 3.4 REQUIRED NO_MODULE ) if( TARGET Eigen3::Eigen ) MESSAGE( STATUS " Eigen3_FOUND : ${Eigen3_FOUND}" ) MESSAGE( STATUS " Eigen3_DIR : ${Eigen3_DIR}" ) else() MESSAGE( " Eigen3 NOT FOUND. Ensure you export Eigen3_DIR into your environment as a hint") MESSAGE( " For Example: export export Eigen3_DIR = ~AFTR_3RD_PARTY_ROOT~/eigen-3.4.0/share/eigen3/cmake") endif() endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " ---Google GTest-------- " ) if( AFTR_CONFIG_USE_GTEST_LIB OR AFTR_USE_GTEST ) #IF AFTR_USE_GTEST is defined, it is a user module that needs to also add its gtest subdir... if( WIN32 ) #we assume a user cannot install to program files (admin rights), but they have 3rdParty libs repo checked out set( GTEST_ROOT "$ENV{GTest_DIR}/../../../" ) MakeAbsolute( GTEST_ROOT ) #print_target_properties( GTest::GTest ) #print_target_properties( GTest::Main ) #print_target_properties( GTest ) #print_target_properties( AftrBurnerEngine::AftrBurnerEngine ) #appears to make cmake_binary_dir point to C:/repos/aburn/engine/src/aftr/gtest endif() find_package( GTest ) if( GTest_FOUND ) MESSAGE( STATUS " GTest_FOUND : ${GTest_FOUND}" ) MESSAGE( STATUS " ENV{GTest_DIR} : $ENV{GTest_DIR}" ) MESSAGE( STATUS " GTEST_ROOT : ${GTEST_ROOT}" ) MESSAGE( STATUS " GTEST_INCLUDE_DIR : ${GTEST_INCLUDE_DIR}" ) MESSAGE( STATUS " GTEST_LIBRARIES : ${GTEST_LIBRARIES}" ) MESSAGE( STATUS " GTEST_MAIN_LIBRARIES: ${GTEST_MAIN_LIBRARIES}" ) MESSAGE( STATUS " GTEST_BOTH_LIBRARIES: ${GTEST_BOTH_LIBRARIES}" ) set( gtest_force_shared_crt ON CACHE BOOL "" FORCE ) else() #GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY MESSAGE( " GTest NOT FOUND. Ensure you export GTest_DIR into your environment as a hint") MESSAGE( " For Example: export GTest_DIR=C:/repos/libs/googletest-release-1.10.0/googletest-distribution/lib/cmake/GTest (linux-esque)") MESSAGE( " OR: set GTest_DIR=C:/repos/libs/googletest-release-1.10.0/googletest-distribution/lib/cmake/GTest (windows w/ no git or bash)") MESSAGE( " OR: Set this variable in the Windows Environment Variables") endif() endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " ---glm/glm------------- " ) #if( NOT GLM_VERSION ) #glm gives an error if one calls find_package( glm ) more than once find_package( glm ) #endif() if( glm_FOUND ) MESSAGE( STATUS " glm_FOUND: ${glm_FOUND}" ) MESSAGE( STATUS " glm_DIR : ${glm_DIR}" ) #print_target_properties( glm::glm ) #lists all the exports from within the glm::glm target else() MESSAGE( " libglm NOT FOUND. Ensure you export glm_DIR into your environment as a hint") MESSAGE( " For Example: export glm_DIR=C:/repos/libs/glm-0.9.9.8/glm/cmake/glm (linux-esque)") MESSAGE( " OR: set glm_DIR=C:/repos/libs/glm-0.9.9.8/glm/cmake/glm (windows w/ no git or bash)") MESSAGE( " OR: Set this variable in the Windows Environment Variables") endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " --ODE (Physics Engine)- " ) if( AFTR_CONFIG_USE_ODE ) find_package( ode ) if( ode_FOUND ) MESSAGE( STATUS " ode_FOUND: ${ode_FOUND}" ) MESSAGE( STATUS " ENV{ode_DIR}: $ENV{ode_DIR}" ) MESSAGE( STATUS " ode_DIR : ${ode_DIR}" ) MESSAGE( STATUS " ODE_INCLUDE_DIRS : ${ODE_INCLUDE_DIRS}" ) MESSAGE( STATUS " ODE_LIBRARIES : ${ODE_LIBRARIES}" ) else() MESSAGE( " Could not find ODE... On windows check the 3rd Party lib folder. On Linux apt install libode." ) endif() endif() MESSAGE( STATUS " ----------------------- " ) MESSAGE( STATUS " --Vimba X (GigE Camera Acquisition Software)- " ) if( AFTR_CONFIG_USE_VIMBA_X ) message( STATUS "Looking for Vimba X API. Only enable this if you connect to GenICam Cameras." ) find_package(Vmb REQUIRED COMPONENTS CPP HINTS $ENV{VIMBA_X_HOME}/api/lib/cmake/vmb ) if( Vmb_FOUND ) message( STATUS "Vmb_FOUND is ${Vmb_FOUND}" ) #target_link_libraries( "${PROJECT_NAME}" PRIVATE Vmb::CPP ) #set_target_properties( "${PROJECT_NAME}" PROPERTIES # VS_DEBUGGER_ENVIRONMENT "PATH=${VMB_BINARY_DIRS};$ENV{PATH}" ) else() message( WARNING "***Could not find Vimba X API" ) message( WARNING "Ensure you *INSTALL* Vimba X API by double clicking:" ) message( WARNING "/repos/libs/VimbaX_Setup-2022-1-Win64.exe (default install no path changes" ) message( WARNING "After installing, delete this cwin64, rerun cmake, and it should work" ) endif() endif() MESSAGE( STATUS " ----------------------- " ) #### #If cmake doesn't find boost, let the user point to the directory #### SET( Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} CACHE PATH "Path to BOOST 1.70.0 or greater header files." ) #### SET( BOOST_LIBRARYDIR ${BOOST_LIBRARYDIR} CACHE PATH "Path to BOOST 1.70.0 or greater libraries (.libs/.dlls)." ) #### #### #If cmake cannot find assimp, let the user point to the directory #### SET( ASSIMP_INCLUDE_DIR ${ASSIMP_INCLUDE_DIR} CACHE PATH "Path to Assimp 3.0.0 or greater header files.") #### SET( ASSIMP_LIBRARY_DIR ${ASSIMP_LIBRARY_DIR} CACHE PATH "Path to Assimp 3.0.0 or greater libraries (.libs/.dlls)." ) #### #### #Here we set some default paths for SDL. This will not work on all platforms. This is here to hopefully help #### #windows set the correct include paths and lib paths. Linux and Apple should be able to successfully use #### #FIND_PACKAGE(...). #### SET( SDL2_INCLUDE_DIR ${SDL2_INCLUDE_DIR} CACHE PATH "Path to SDL2-2.0.12 include files" ) #---------------------- MESSAGE( STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "LEAVING aftr_FindDependencies.cmake..." ) endmacro()