mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
109 lines
4.5 KiB
CMake
109 lines
4.5 KiB
CMake
##########################################################################################
|
|
# #
|
|
# OpenSpace #
|
|
# #
|
|
# Copyright (c) 2014-2023 #
|
|
# #
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
|
|
# software and associated documentation files (the "Software"), to deal in the Software #
|
|
# without restriction, including without limitation the rights to use, copy, modify, #
|
|
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
|
|
# permit persons to whom the Software is furnished to do so, subject to the following #
|
|
# conditions: #
|
|
# #
|
|
# The above copyright notice and this permission notice shall be included in all copies #
|
|
# or substantial portions of the Software. #
|
|
# #
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
|
|
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
|
|
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
|
|
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
|
|
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
|
|
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
|
|
##########################################################################################
|
|
|
|
|
|
include(${PROJECT_SOURCE_DIR}/support/cmake/module_definition.cmake)
|
|
|
|
set(HEADER_FILES
|
|
videomodule.h
|
|
include/videotileprovider.h
|
|
include/videoplayer.h
|
|
include/screenspacevideo.h
|
|
include/renderablevideosphere.h
|
|
include/renderablevideoplane.h
|
|
)
|
|
source_group("Header Files" FILES ${HEADER_FILES})
|
|
|
|
set(SOURCE_FILES
|
|
videomodule.cpp
|
|
videomodule_lua.inl
|
|
src/videotileprovider.cpp
|
|
src/videoplayer.cpp
|
|
src/screenspacevideo.cpp
|
|
src/renderablevideosphere.cpp
|
|
src/renderablevideoplane.cpp
|
|
)
|
|
source_group("Source Files" FILES ${SOURCE_FILES})
|
|
|
|
# Libmpv
|
|
if (WIN32)
|
|
set(LIBMPV_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ext/libmpv" CACHE INTERNAL "LIBMPV_ROOT")
|
|
if (NOT IS_DIRECTORY "${LIBMPV_ROOT}")
|
|
message(STATUS "Downloading LibMPV...")
|
|
|
|
# First download the SHA1 hash of the file
|
|
file(
|
|
DOWNLOAD
|
|
"http://data.openspaceproject.com/ext/libmpv/2.0/libmpv.zip.sha1"
|
|
"${LIBMPV_ROOT}/libmpv.zip.sha1"
|
|
)
|
|
file(READ "${LIBMPV_ROOT}/libmpv.zip.sha1" LIBMPV_SHA1)
|
|
|
|
# For some reason the SHA1 file contains extra linebreaks
|
|
string(STRIP ${LIBMPV_SHA1} LIBMPV_SHA1)
|
|
|
|
# Then download the file itself
|
|
file(
|
|
DOWNLOAD
|
|
"http://data.openspaceproject.com/ext/libmpv/2.0/libmpv.zip"
|
|
"${LIBMPV_ROOT}/libmpv.zip"
|
|
EXPECTED_HASH SHA1=${LIBMPV_SHA1}
|
|
SHOW_PROGRESS
|
|
)
|
|
|
|
execute_process(
|
|
COMMAND ${CMAKE_COMMAND} -E tar xzf "${LIBMPV_ROOT}/libmpv.zip"
|
|
WORKING_DIRECTORY ${LIBMPV_ROOT}
|
|
)
|
|
endif ()
|
|
|
|
add_library(libmpv SHARED IMPORTED)
|
|
target_include_directories(libmpv SYSTEM INTERFACE ${LIBMPV_ROOT}/libmpv/include)
|
|
set_target_properties(libmpv PROPERTIES
|
|
IMPORTED_LOCATION "${LIBMPV_ROOT}/libmpv/bin/mpv-2.dll"
|
|
IMPORTED_IMPLIB "${LIBMPV_ROOT}/libmpv/lib/mpv.lib"
|
|
)
|
|
|
|
add_library(libopenh264 SHARED IMPORTED)
|
|
set_target_properties(libopenh264 PROPERTIES
|
|
IMPORTED_LOCATION "${LIBMPV_ROOT}/libmpv/bin/libopenh264.dll"
|
|
IMPORTED_IMPLIB "${LIBMPV_ROOT}/libmpv/lib/mpv.lib"
|
|
)
|
|
|
|
target_link_libraries(openspace-module-globebrowsing PUBLIC libmpv libopenh264)
|
|
else (WIN32)
|
|
find_package(LIBMPV REQUIRED)
|
|
|
|
target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${LIBMPV_INCLUDE_DIR})
|
|
target_link_libraries(openspace-module-globebrowsing PRIVATE ${LIBMPV_LIBRARY})
|
|
mark_as_advanced(LIBMPV_CONFIG LIBMPV_INCLUDE_DIR LIBMPV_LIBRARY)
|
|
endif () # WIN32
|
|
|
|
create_new_module(
|
|
"Video"
|
|
video_module
|
|
STATIC
|
|
${HEADER_FILES} ${SOURCE_FILES}
|
|
)
|