Skip to content

Commit 9842664

Browse files
YLouWashUfacebook-github-bot
authored andcommitted
Fix CMake build files.
Summary: This diff fixes the CMake files to support XPRS decoding feature, which can be enabled by `-DBUILD_WITH_XPRS=ON` flag in CMake. Reviewed By: georges-berenger Differential Revision: D73452902 fbshipit-source-id: 10bdf6e8d4268573fec1af147ca082484cac9188
1 parent c3fb992 commit 9842664

File tree

6 files changed

+48
-0
lines changed

6 files changed

+48
-0
lines changed

CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ add_subdirectory(vrs)
7070

7171
OPTION(BUILD_TOOLS "Build all of the tools" ON)
7272
OPTION(BUILD_SAMPLES "Build sample code and sample apps" ON)
73+
OPTION(BUILD_WITH_XPRS "Build with XPRS decoding library" OFF)
74+
75+
# Check the operating system for BUILD_WITH_XPRS
76+
if (BUILD_WITH_XPRS)
77+
if (NOT TARGET_LINUX)
78+
message(FATAL_ERROR "BUILD_WITH_XPRS is only supported on Linux.")
79+
endif()
80+
endif()
81+
82+
# Add xprs folder if BUILD_WITH_XPRS is set
83+
if (BUILD_WITH_XPRS)
84+
add_subdirectory(${VRS_SOURCE_DIR}/xprs)
85+
endif()
7386

7487
if (BUILD_TOOLS)
7588
# Add the vrs command line utility

tools/vrs/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ target_link_libraries(vrs
2929
vrs_logging
3030
)
3131

32+
# Conditionally link to vrs_utils_xprs if INCLUDE_XPRS is set
33+
if (BUILD_WITH_XPRS)
34+
target_link_libraries(vrs PRIVATE vrs_utils_xprs)
35+
endif()
36+
37+
3238
install(TARGETS vrs EXPORT VRSLibTargets
3339
RUNTIME DESTINATION bin
3440
)

tools/vrs/vrs.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,22 @@
1616

1717
#include "VrsCommand.h"
1818

19+
#ifdef INCLUDE_XPRS
20+
#include <vrs/utils/DecoderFactory.h>
21+
#include <vrs/utils/xprs/XprsDecoder.h>
22+
#endif
23+
1924
#include <vrs/os/Utils.h>
2025

2126
using namespace std;
2227
using namespace vrscli;
2328

2429
int main(int argc, char** argv) {
30+
// Initialize with XPRS if included
31+
#ifdef INCLUDE_XPRS
32+
vrs::utils::DecoderFactory::get().registerDecoderMaker(vrs::vxprs::xprsDecoderMaker);
33+
#endif
34+
2535
const string& appName = vrs::os::getFilename(argv[0]);
2636
if (argc == 1) {
2737
printHelp(appName);

tools/vrsplayer/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ if (QT_FOUND)
4242
Threads::Threads
4343
)
4444

45+
# Conditionally link to vrs_utils_xprs if INCLUDE_XPRS is set
46+
if (BUILD_WITH_XPRS)
47+
target_link_libraries(vrsplayer PRIVATE vrs_utils_xprs)
48+
endif()
49+
4550
install(TARGETS vrsplayer EXPORT VRSLibTargets
4651
RUNTIME DESTINATION bin
4752
)

tools/vrsplayer/main.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
3535

3636
#include "PlayerWindow.h"
3737

38+
#ifdef INCLUDE_XPRS
39+
#include <vrs/utils/DecoderFactory.h>
40+
#include <vrs/utils/xprs/XprsDecoder.h>
41+
#endif
42+
3843
using namespace std;
3944

4045
namespace {
@@ -90,5 +95,9 @@ int main(int argc, char* argv[]) {
9095

9196
vrsp::PlayerWindow playerWindow(app);
9297

98+
#ifdef INCLUDE_XPRS
99+
vrs::utils::DecoderFactory::get().registerDecoderMaker(vrs::vxprs::xprsDecoderMaker);
100+
#endif
101+
93102
return app.run(playerWindow.getPlayerUI(), parser);
94103
}

vrs/utils/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ if (BUILD_WITH_OPUS)
4343
target_compile_definitions(vrs_utils PRIVATE OPUS_IS_AVAILABLE)
4444
endif()
4545

46+
if (BUILD_WITH_XPRS)
47+
add_subdirectory(xprs)
48+
target_compile_definitions(vrs_utils PUBLIC INCLUDE_XPRS)
49+
endif()
50+
4651
target_include_directories(vrs_utils
4752
INTERFACE
4853
$<BUILD_INTERFACE:${VRS_SOURCE_DIR}>

0 commit comments

Comments
 (0)