forked from alexmercerind/dart_vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
62 lines (51 loc) · 1.68 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# dart_vlc: A media playback library for Dart & Flutter. Based on libVLC & libVLC++.
#
# Hitesh Kumar Saini
# https://github.com/alexmercerind
# GNU Lesser General Public License v2.1
#
cmake_minimum_required(VERSION 3.15)
set (CMAKE_CXX_STANDARD 17)
set(PROJECT_NAME dart_vlc)
project(${PROJECT_NAME} LANGUAGES CXX)
set(PLUGIN_NAME dart_vlc_plugin)
set(LIBVLC_VERSION 3.0.9.2)
include_directories(${PLUGIN_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
add_library(${PLUGIN_NAME} SHARED
dart_vlc_plugin.cc
)
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/../dartvlc
)
set(LIBVLC_BINARIES ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(LIBVLCPP_URL https://github.com/videolan/libvlcpp/archive/master.zip)
set(LIBVLCPP_ARCHIVE ${LIBVLC_BINARIES}/libvlcpp.zip)
set(LIBVLCPP_SOURCE ${LIBVLC_BINARIES}/libvlcpp-master)
if (NOT EXISTS ${LIBVLCPP_ARCHIVE})
file(DOWNLOAD ${LIBVLCPP_URL} ${LIBVLCPP_ARCHIVE})
endif()
add_custom_target(LIBVLC_EXTRACT ALL)
add_custom_command(
TARGET LIBVLC_EXTRACT PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E tar xzf \"${LIBVLCPP_ARCHIVE}\"
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBVLCPP_SOURCE}/vlcpp ${CMAKE_CURRENT_SOURCE_DIR}/include/vlcpp
WORKING_DIRECTORY ${LIBVLC_BINARIES}
DEPENDS ${LIBVLC_ARCHIVE}
)
target_link_libraries(${PLUGIN_NAME} PRIVATE
flutter
PkgConfig::GTK
"/usr/lib/x86_64-linux-gnu/libvlc.so"
)
set(
dart_vlc_bundled_libraries
PARENT_SCOPE
)