diff --git a/CMakeLists.txt b/CMakeLists.txt index 8268e83..8262d80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,13 +34,36 @@ if(ENABLE_QT) AUTORCC ON) endif() -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/.deps/obs-deps-2023-11-03-x64/include") -target_link_libraries( - ${CMAKE_PROJECT_NAME} - PRIVATE "${CMAKE_SOURCE_DIR}/.deps/obs-deps-2023-11-03-x64/lib/avcodec.lib" - "${CMAKE_SOURCE_DIR}/.deps/obs-deps-2023-11-03-x64/lib/avformat.lib" - "${CMAKE_SOURCE_DIR}/.deps/obs-deps-2023-11-03-x64/lib/avutil.lib" - "${CMAKE_SOURCE_DIR}/.deps/obs-deps-2023-11-03-x64/lib/swresample.lib") +function(find_libav) + if(NOT buildspec) + file(READ "${CMAKE_CURRENT_SOURCE_DIR}/buildspec.json" buildspec) + endif() + string( + JSON + version + GET + ${buildspec} + dependencies + prebuilt + version) + + if(MSVC) + set(arch ${CMAKE_GENERATOR_PLATFORM}) + elseif(APPLE) + set(arch universal) + endif() + set(deps_root "${CMAKE_CURRENT_SOURCE_DIR}/.deps/obs-deps-${version}-${arch}") + + target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE "${deps_root}/include") + target_link_libraries( + ${CMAKE_PROJECT_NAME} + PRIVATE "${deps_root}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}avcodec${CMAKE_STATIC_LIBRARY_SUFFIX}" + "${deps_root}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}avformat${CMAKE_STATIC_LIBRARY_SUFFIX}" + "${deps_root}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}avutil${CMAKE_STATIC_LIBRARY_SUFFIX}" + "${deps_root}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}swresample${CMAKE_STATIC_LIBRARY_SUFFIX}") +endfunction(find_libav) + +find_libav() set(USE_SYSTEM_CURL OFF diff --git a/buildspec.json b/buildspec.json index 733e030..0c6c902 100644 --- a/buildspec.json +++ b/buildspec.json @@ -45,7 +45,7 @@ } }, "name": "obs-cleanstream", - "version": "0.0.5", + "version": "0.0.6", "author": "Roy Shilkrot", "website": "https://github.com/occ-ai/obs-cleanstream/", "email": "roy.shil@gmail.com",