Skip to content

Commit

Permalink
Bridge build disabled by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
hipersayanX committed Feb 21, 2025
1 parent 7c3b7fe commit 0497881
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 37 deletions.
68 changes: 46 additions & 22 deletions cmio/VCamIPC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
cmake_minimum_required(VERSION 3.14)

project(VCamIPC_cmio LANGUAGES CXX)
project(VCamIPC_cmio_shared LANGUAGES CXX)

include(../../commons.cmake)

if (BUILD_BRIDGE)
project(VCamIPC_cmio_shared LANGUAGES CXX)
endif ()

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -32,38 +35,57 @@ set(SOURCES

if (APPLE OR FAKE_APPLE)
add_library(VCamIPC_cmio STATIC ${SOURCES})
add_library(VCamIPC_cmio_shared SHARED ${SOURCES})
set_target_properties(VCamIPC_cmio_shared PROPERTIES
OUTPUT_NAME ${AKVCAM_BRIDGE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${LIBDIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${BINDIR}
PREFIX "")

if (BUILD_BRIDGE)
add_library(VCamIPC_cmio_shared SHARED ${SOURCES})
set_target_properties(VCamIPC_cmio_shared PROPERTIES
OUTPUT_NAME ${AKVCAM_BRIDGE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${LIBDIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${BINDIR}
PREFIX "")
endif ()
else ()
add_library(VCamIPC_cmio STATIC EXCLUDE_FROM_ALL ${SOURCES})
add_library(VCamIPC_cmio_shared SHARED EXCLUDE_FROM_ALL ${SOURCES})

if (BUILD_BRIDGE)
add_library(VCamIPC_cmio_shared SHARED EXCLUDE_FROM_ALL ${SOURCES})
endif ()
endif ()

add_dependencies(VCamIPC_cmio VCamUtils)
add_dependencies(VCamIPC_cmio_shared VCamUtils)

if (BUILD_BRIDGE)
add_dependencies(VCamIPC_cmio_shared VCamUtils)
endif ()

target_compile_definitions(VCamIPC_cmio PRIVATE VCAMIPC_LIBRARY)
target_compile_definitions(VCamIPC_cmio_shared PRIVATE VCAMIPC_LIBRARY_SHARED)

if (BUILD_BRIDGE)
target_compile_definitions(VCamIPC_cmio_shared PRIVATE VCAMIPC_LIBRARY_SHARED)
endif ()

target_include_directories(VCamIPC_cmio
PRIVATE
..
../..)
target_include_directories(VCamIPC_cmio_shared
PRIVATE
..
../..)

if (BUILD_BRIDGE)
target_include_directories(VCamIPC_cmio_shared
PRIVATE
..
../..)
endif ()

if (FAKE_APPLE)
target_include_directories(VCamIPC_cmio
PRIVATE
../FakeAPI)
target_include_directories(VCamIPC_cmio_shared
PRIVATE
../FakeAPI)

if (BUILD_BRIDGE)
target_include_directories(VCamIPC_cmio_shared
PRIVATE
../FakeAPI)
endif ()
endif ()

if (APPLE OR FAKE_APPLE)
Expand All @@ -76,15 +98,17 @@ endif ()
target_link_libraries(VCamIPC_cmio
VCamUtils
${EXTRA_LIBS})
target_link_libraries(VCamIPC_cmio_shared
VCamUtils
${EXTRA_LIBS})

if (BUILD_BRIDGE)
target_link_libraries(VCamIPC_cmio_shared
VCamUtils
${EXTRA_LIBS})
endif ()

if (FAKE_APPLE)
add_definitions(-DFAKE_APPLE)
endif ()
add_definitions(-DFAKE_APPLE)

if (APPLE OR FAKE_APPLE)
if (BUILD_BRIDGE AND (APPLE OR FAKE_APPLE))
install(TARGETS VCamIPC_cmio_shared DESTINATION ${LIBDIR})
endif ()
4 changes: 4 additions & 0 deletions cmio/VirtualCamera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ target_link_libraries(VirtualCamera_cmio
VCamUtils
${EXTRA_LIBS})

if (FAKE_APPLE)
add_definitions(-DFAKE_APPLE)
endif ()

if (APPLE OR FAKE_APPLE)
install(TARGETS VirtualCamera_cmio DESTINATION ${BINDIR})
install(FILES ${CMAKE_BINARY_DIR}/${BUILDDIR}/${EXECPREFIX}/Info.plist DESTINATION ${EXECPREFIX})
Expand Down
4 changes: 4 additions & 0 deletions cmio/VirtualCamera/src/objectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ bool AkVCam::ObjectProperties::getProperty(UInt32 property,
CFRelease(CMFormatDescriptionRef(value));
};
array = CFArrayCreate(kCFAllocatorDefault,
#ifdef FAKE_APPLE
const_cast<const void **>(reinterpret_cast<void **>(formats.data())),
#else
const_cast<const void **>(formats.data()),
#endif
UInt32(formats.size()),
&callbacks);
}
Expand Down
2 changes: 2 additions & 0 deletions commons.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,5 @@ elseif (WIN32)
set(PACKET_HIDE_ARCH true)
set(OUTPUT_FORMATS "Nsis")
endif ()

set(BUILD_BRIDGE OFF CACHE BOOL "Build the bridge shared library (very experimental and unestable API)")
53 changes: 38 additions & 15 deletions dshow/VCamIPC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
cmake_minimum_required(VERSION 3.14)

project(VCamIPC_dshow LANGUAGES CXX)
project(VCamIPC_dshow_shared LANGUAGES CXX)

include(../../commons.cmake)

if (BUILD_BRIDGE)
project(VCamIPC_dshow_shared LANGUAGES CXX)
endif ()

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -32,27 +35,44 @@ set(SOURCES

if (WIN32)
add_library(VCamIPC_dshow STATIC ${SOURCES})
add_library(VCamIPC_dshow_shared SHARED ${SOURCES})
set_target_properties(VCamIPC_dshow_shared PROPERTIES
OUTPUT_NAME ${AKVCAM_BRIDGE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${LIBDIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${BINDIR}
PREFIX "")

if (BUILD_BRIDGE)
add_library(VCamIPC_dshow_shared SHARED ${SOURCES})
set_target_properties(VCamIPC_dshow_shared PROPERTIES
OUTPUT_NAME ${AKVCAM_BRIDGE_NAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${LIBDIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BUILDDIR}/${BINDIR}
PREFIX "")
endif ()
else ()
add_library(VCamIPC_dshow STATIC EXCLUDE_FROM_ALL ${SOURCES})
add_library(VCamIPC_dshow_shared SHARED EXCLUDE_FROM_ALL ${SOURCES})

if (BUILD_BRIDGE)
add_library(VCamIPC_dshow_shared SHARED EXCLUDE_FROM_ALL ${SOURCES})
endif ()
endif ()

add_dependencies(VCamIPC_dshow PlatformUtils_dshow VCamUtils)
add_dependencies(VCamIPC_dshow_shared PlatformUtils_dshow VCamUtils)

if (BUILD_BRIDGE)
add_dependencies(VCamIPC_dshow_shared PlatformUtils_dshow VCamUtils)
endif ()

target_compile_definitions(VCamIPC_dshow PRIVATE VCAMIPC_LIBRARY)
target_compile_definitions(VCamIPC_dshow_shared PRIVATE VCAMIPC_LIBRARY_SHARED)

if (BUILD_BRIDGE)
target_compile_definitions(VCamIPC_dshow_shared PRIVATE VCAMIPC_LIBRARY_SHARED)
endif ()

target_include_directories(VCamIPC_dshow
PRIVATE ..
PRIVATE ../..)
target_include_directories(VCamIPC_dshow_shared
PRIVATE ..
PRIVATE ../..)

if (BUILD_BRIDGE)
target_include_directories(VCamIPC_dshow_shared
PRIVATE ..
PRIVATE ../..)
endif ()

if (WIN32)
set(EXTRA_LIBS
Expand All @@ -62,8 +82,11 @@ if (WIN32)
endif ()

target_link_libraries(VCamIPC_dshow PlatformUtils_dshow ${EXTRA_LIBS})
target_link_libraries(VCamIPC_dshow_shared PlatformUtils_dshow ${EXTRA_LIBS})

if (WIN32)
if (BUILD_BRIDGE)
target_link_libraries(VCamIPC_dshow_shared PlatformUtils_dshow ${EXTRA_LIBS})
endif ()

if (BUILD_BRIDGE AND WIN32)
install(TARGETS VCamIPC_dshow_shared DESTINATION ${BINDIR})
endif ()

0 comments on commit 0497881

Please sign in to comment.