diff --git a/Engine/source/CMakeLists.txt b/Engine/source/CMakeLists.txt index 3aec54791..029ef89ec 100644 --- a/Engine/source/CMakeLists.txt +++ b/Engine/source/CMakeLists.txt @@ -5,6 +5,24 @@ if (APPLE) enable_language(OBJC) endif (APPLE) +# ------------------------------------------------------------------ +# Find all dependencies (using vcpkg's toolchain integration) +# ------------------------------------------------------------------ +find_package(Ogg CONFIG REQUIRED) +find_package(Vorbis CONFIG REQUIRED) +find_package(FLAC CONFIG REQUIRED) +find_package(Opus CONFIG REQUIRED) +find_package(unofficial-theora CONFIG REQUIRED) +find_package(SndFile CONFIG REQUIRED) +set(TORQUE_LINK_THIRDPARTY ${TORQUE_LINK_THIRDPARTY} + Ogg::ogg + Vorbis::vorbis + Vorbis::vorbisfile + FLAC::FLAC + Opus::opus + unofficial::theora::theora unofficial::theora::theoradec unofficial::theora::theoraenc + SndFile::sndfile +) ################# Helper Function Calls ################### forwardDef(TORQUE_OPENGL) forwardDef(TORQUE_D3D11) @@ -414,7 +432,7 @@ if (TORQUE_DYNAMIC_LIBRARY AND NOT TORQUE_TESTING) # Build the main engine library add_library(TorqueEngine SHARED ${TORQUE_SOURCE_FILES}) target_compile_definitions(TorqueEngine PUBLIC ${TORQUE_COMPILE_DEFINITIONS}) - target_link_libraries(TorqueEngine ${TORQUE_LINK_LIBRARIES}) + target_link_libraries(TorqueEngine ${TORQUE_LINK_LIBRARIES} ${TORQUE_LINK_THIRDPARTY}) target_include_directories(TorqueEngine PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_BINARY_DIR}/temp" ${TORQUE_INCLUDE_DIRECTORIES}) set(TORQUE_SOURCE_FILES "main/main.cpp") @@ -509,7 +527,7 @@ foreach (TORQUE_LIBRARY ${TORQUE_LINK_LIBRARIES}) endforeach() target_compile_definitions(${TORQUE_APP_NAME} PUBLIC ${TORQUE_COMPILE_DEFINITIONS}) -target_link_libraries(${TORQUE_APP_NAME} ${TORQUE_LINK_LIBRARIES}) +target_link_libraries(${TORQUE_APP_NAME} ${TORQUE_LINK_LIBRARIES} ${TORQUE_LINK_THIRDPARTY}) if(APPLE) target_link_libraries(${TORQUE_APP_NAME} ${TORQUE_LINK_FRAMEWORKS}) diff --git a/Tools/CMake/finders/FindFLAC.cmake b/Tools/CMake/finders/FindFLAC.cmake deleted file mode 100644 index a77e4901b..000000000 --- a/Tools/CMake/finders/FindFLAC.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if(TARGET FLAC) - set(FLAC_FOUND TRUE) - set(FLAC_INCLUDE_DIRS $) - set(FLAC_LIBRARIES FLAC) - - # Provide an alias for consistency with modern CMake - if(NOT TARGET FLAC::FLAC) - add_library(FLAC::FLAC ALIAS FLAC) - endif() -else() - set(FLAC_FOUND FALSE) - message(FATAL_ERROR "Flac was not added with add_subdirectory before calling find_package(FLAC).") -endif() \ No newline at end of file diff --git a/Tools/CMake/finders/FindOGG.cmake b/Tools/CMake/finders/FindOGG.cmake deleted file mode 100644 index 3cdb22111..000000000 --- a/Tools/CMake/finders/FindOGG.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if(TARGET ogg) - set(OGG_FOUND TRUE) - set(OGG_INCLUDE_DIRS $) - set(OGG_LIBRARIES ogg) - - # Provide an alias for consistency with modern CMake - if(NOT TARGET OGG::OGG) - add_library(OGG::OGG ALIAS ogg) - endif() -else() - set(OGG_FOUND FALSE) - message(FATAL_ERROR "Ogg was not added with add_subdirectory before calling find_package(Ogg).") -endif() \ No newline at end of file diff --git a/Tools/CMake/finders/FindOPUS.cmake b/Tools/CMake/finders/FindOPUS.cmake deleted file mode 100644 index 0ed268a3d..000000000 --- a/Tools/CMake/finders/FindOPUS.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if(TARGET opus) - set(OPUS_FOUND TRUE) - set(OPUS_INCLUDE_DIRS $) - set(OPUS_LIBRARIES opus) - - # Provide an alias for consistency with modern CMake - if(NOT TARGET OPUS::OPUS) - add_library(OPUS::OPUS ALIAS opus) - endif() -else() - set(OPUS_FOUND FALSE) - message(FATAL_ERROR "Opus was not added with add_subdirectory before calling find_package(Opus).") -endif() \ No newline at end of file diff --git a/Tools/CMake/finders/FindVorbis.cmake b/Tools/CMake/finders/FindVorbis.cmake deleted file mode 100644 index 0e0faaa65..000000000 --- a/Tools/CMake/finders/FindVorbis.cmake +++ /dev/null @@ -1,16 +0,0 @@ -if(TARGET vorbis) - set(VORBIS_FOUND TRUE) - set(VORBIS_INCLUDE_DIRS $) - set(VORBIS_LIBRARIES vorbis) - - # Provide an alias for consistency with modern CMake - if(NOT TARGET VORBIS::VORBIS) - add_library(VORBIS::VORBIS ALIAS vorbis) - endif() - if(NOT TARGET Vorbis::vorbisenc) - add_library(Vorbis::vorbisenc ALIAS vorbisenc) - endif() -else() - set(VORBIS_FOUND FALSE) - message(FATAL_ERROR "Vorbis was not added with add_subdirectory before calling find_package(Vorbis).") -endif() \ No newline at end of file