Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OpenGL ES 2.0 #160

Merged
merged 6 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
DIST_ARM_DMG: ${{ steps.info.outputs.DIST_ARM_DMG }}
DIST_UNIVERSAL_DMG: ${{ steps.info.outputs.DIST_UNIVERSAL_DMG }}
DIST_FLATPAK_X86_64: ${{ steps.info.outputs.DIST_FLATPAK_X86_64 }}
DIST_FLATPAK_AARCH64: ${{ steps.info.outputs.DIST_FLATPAK_AARCH64 }}
DIST_FLATPAK_AARCH64_GL: ${{ steps.info.outputs.DIST_FLATPAK_AARCH64_GL }}
DIST_FLATPAK_AARCH64_GLES2: ${{ steps.info.outputs.DIST_FLATPAK_AARCH64_GLES2 }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -75,7 +76,8 @@ jobs:
echo "DIST_ARM_DMG=wiliwili-macOS-AppleSilicon-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_UNIVERSAL_DMG=wiliwili-macOS-Universal-${VERSION}" >> $GITHUB_OUTPUT
echo "DIST_FLATPAK_X86_64=wiliwili-Linux-${VERSION}-x86_64" >> $GITHUB_OUTPUT
echo "DIST_FLATPAK_AARCH64=wiliwili-Linux-${VERSION}-aarch64" >> $GITHUB_OUTPUT
echo "DIST_FLATPAK_AARCH64_GL=wiliwili-Linux-${VERSION}-gl-aarch64" >> $GITHUB_OUTPUT
echo "DIST_FLATPAK_AARCH64_GLES2=wiliwili-Linux-${VERSION}-gles2-aarch64" >> $GITHUB_OUTPUT
echo $VERSION
echo "${{ github.event.inputs.version }}"

Expand Down Expand Up @@ -127,7 +129,7 @@ jobs:
- name: Install dependency
uses: msys2/setup-msys2@v2
with:
update: true
# update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
Expand Down Expand Up @@ -302,8 +304,14 @@ jobs:
strategy:
matrix:
arch: [ x86_64, aarch64 ]
driver: [ gl, gles2 ]
exclude:
- arch: x86_64
driver: gles2
# Don't fail the whole workflow if one architecture fails
fail-fast: false
env:
FLATPAK_NAME: wiliwili-Linux-${{ needs.version.outputs.version }}.flatpak
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -313,12 +321,25 @@ jobs:
submodules: 'recursive'
fetch-depth: 0

- name: Add OpenGL ES 2.0 build option
if: matrix.driver == 'gles2' && ( matrix.arch == 'x86_64' || ( matrix.arch == 'aarch64' && github.event.inputs.arm_flatpak == 'true' ) )
run: |
sed -i "29i \ - '-DUSE_GLES2=ON'" .flatpak-manifest.yml

- name: Rename package
if: matrix.arch == 'aarch64'
run: |
echo "FLATPAK_NAME=wiliwili-Linux-${{ needs.version.outputs.version }}-${{ matrix.driver }}.flatpak" >> $GITHUB_ENV

- name: Install deps
id: dep
if: matrix.arch == 'x86_64' || ( matrix.arch == 'aarch64' && github.event.inputs.arm_flatpak == 'true')
run: |
dnf -y install docker cmake
BRLS_GLFW="library/borealis/library/lib/extern/glfw/"
cmake -P ${BRLS_GLFW}/CMake/GenerateMappings.cmake ${BRLS_GLFW}/src/mappings.h.in ${BRLS_GLFW}/src/mappings.h
echo "FLATPAK_NAME=${FLATPAK_NAME}" >> $GITHUB_OUTPUT
echo ${FLATPAK_NAME}

- name: Set up QEMU
id: qemu
Expand All @@ -330,7 +351,7 @@ jobs:
- uses: flatpak/flatpak-github-actions/flatpak-builder@v5
if: matrix.arch == 'x86_64' || ( matrix.arch == 'aarch64' && github.event.inputs.arm_flatpak == 'true')
with:
bundle: wiliwili-Linux-${{ needs.version.outputs.version }}.flatpak
bundle: ${{ steps.dep.outputs.FLATPAK_NAME }}
manifest-path: .flatpak-manifest.yml
cache-key: flatpak-builder-${{ github.sha }}
cache-key: flatpak-builder-${{ matrix.arch }}
arch: ${{ matrix.arch }}
50 changes: 38 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ set(USE_SYSTEM_CURL
OFF
CACHE BOOL "Whether to use the curl in your system libs"
)
set(USE_BOOST_FILESYSTEM
OFF
CACHE BOOL "Whether to use the boost::filesystem instead of std::filesystem"
)
set(USE_SHARED_LIB
OFF
CACHE BOOL "Whether to use shared libs provided by system"
Expand All @@ -30,6 +34,12 @@ set(DEBUG_SANITIZER
CACHE BOOL "Turn on sanitizers (only available in debug build)"
)

# Do not use it until you know what you are doing.
set(CUSTOM_RESOURCES_DIR
""
CACHE STRING "Custom resources dir"
)

# analytics
set(ANALYTICS
OFF
Expand Down Expand Up @@ -64,14 +74,24 @@ set(MAC_DOWNLOAD_DYLIB
)

# mpv related

# If your system does not support Opengl(es), you can use software rendering before modifying MPV related content,
# but it will affect performance.
set(MPV_SW_RENDER
OFF
CACHE BOOL "Using CPU to draw videos"
)
# On systems that do not support framebuffer, let MPV to draw to full screen and
# then cover unnecessary areas with UI (only for OpenGL).
set(MPV_NO_FB
OFF
CACHE BOOL "Not using extra framebuffer"
)

option(USE_GLFW "using glfw for input and create window" ON)
option(USE_SDL2 "using sdl2 for input and create window" OFF)
option(USE_GL2 "using OpenGL 2.1" OFF)
option(USE_GLES2 "using OpenGL ES 2.0 (current only works with USE_GLFW)" OFF)

option(INSTALL "Install to system. only use this option with Linux." OFF)

Expand All @@ -88,11 +108,10 @@ endif ()
if (USE_GL2)
set(USE_GL2 ON)
add_definitions(-DUSE_GL2)
add_definitions(-DMPV_NO_FB)
endif ()

if (MPV_SW_RENDER)
add_definitions(-DMPV_SW_RENDER)
set(MPV_NO_FB ON)
elseif (USE_GLES2)
set(USE_GLES2 ON)
add_definitions(-DUSE_GLES2)
endif ()

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/extra.cmake)
Expand Down Expand Up @@ -163,7 +182,8 @@ set(PROJECT_ICON_SVG
set(RESOURCES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/wiliwili) # Only used in
# Linux
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
add_definitions(
set(PLATFORM_INCLUDES)
set(PLATFORM_OPTION
-DBUILD_PACKAGE_NAME=${PACKAGE_NAME} -DBUILD_VERSION_MAJOR=${VERSION_MAJOR}
-DBUILD_VERSION_MINOR=${VERSION_MINOR}
-DBUILD_VERSION_REVISION=${VERSION_REVISION}
Expand All @@ -173,14 +193,22 @@ if (USE_SDL2)
else ()
add_definitions(-D__GLFW__)
endif ()
if (MPV_SW_RENDER)
list(APPEND PLATFORM_OPTION -DMPV_SW_RENDER)
endif ()
if (MPV_NO_FB)
list(APPEND PLATFORM_OPTION -DMPV_NO_FB)
endif()

# disable in-source build
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "In-source builds are not allowed")
endif ()

# set resources dir
if (INSTALL)
if (CUSTOM_RESOURCES_DIR)
set(BRLS_RESOURCES_DIR ${CUSTOM_RESOURCES_DIR})
elseif (INSTALL)
set(BRLS_RESOURCES_DIR ${RESOURCES_INSTALL_DIR})
else ()
set(BRLS_RESOURCES_DIR ".")
Expand All @@ -195,8 +223,6 @@ endif ()
# setting src and include
file(GLOB_RECURSE MAIN_SRC wiliwili/source/*.cpp)

set(PLATFORM_OPTION)
set(PLATFORM_INCLUDES)
if (PLATFORM_DESKTOP)
find_package(MPV REQUIRED)
if (MPV_FOUND)
Expand All @@ -207,7 +233,7 @@ if (PLATFORM_DESKTOP)
endif ()
set(PLATFORM_LIBS ${MPV_LIBRARY})
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(PLATFORM_OPTION -pthread -I${MPV_INCLUDE_DIR})
list(APPEND PLATFORM_OPTION -pthread -I${MPV_INCLUDE_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
else ()
if (USE_SDL2)
Expand Down Expand Up @@ -249,7 +275,7 @@ else ()
)
if (BUILTIN_NSP)
list(APPEND PLATFORM_LIBS nsp)
set(PLATFORM_OPTION -DBUILTIN_NSP)
list(APPEND PLATFORM_OPTION -DBUILTIN_NSP)
endif ()
list(APPEND PLATFORM_OPTION -DMG_ARCH=10086)
list(
Expand Down Expand Up @@ -300,7 +326,7 @@ if (ANALYTICS)
endif ()

if (VERIFY_SSL)
target_compile_options(${PROJECT_NAME} PRIVATE -DVERIFY_SSL)
list(APPEND PLATFORM_OPTION -DVERIFY_SSL)
endif ()

set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
Expand Down
12 changes: 6 additions & 6 deletions cmake/extra.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ if (APPLE)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "" FORCE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE)

set(CPR_USE_BOOST_FILESYSTEM ON)
set(USE_BOOST_FILESYSTEM ON)
add_definitions(-DCPR_USE_BOOST_FILESYSTEM)
add_definitions(-DUSE_BOOST_FILESYSTEM)
endif ()
if(MAC_AppleSilicon)
# Build a Universal binary on macOS
Expand All @@ -59,9 +56,12 @@ if (APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE)
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] "11.0" CACHE STRING "" FORCE)

set(CPR_USE_BOOST_FILESYSTEM ON)
set(USE_BOOST_FILESYSTEM ON)
add_definitions(-DCPR_USE_BOOST_FILESYSTEM)
add_definitions(-DUSE_BOOST_FILESYSTEM)
endif()
endif()

if (USE_BOOST_FILESYSTEM)
set(CPR_USE_BOOST_FILESYSTEM ON)
add_definitions(-DCPR_USE_BOOST_FILESYSTEM)
add_definitions(-DUSE_BOOST_FILESYSTEM)
endif ()
2 changes: 1 addition & 1 deletion library/borealis
17 changes: 7 additions & 10 deletions scripts/linux/cn.xfangfang.wiliwili.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,21 @@
<summary>A 3rd party bilibili client</summary>
<launchable type="desktop-id">cn.xfangfang.wiliwili.desktop</launchable>
<translation type="gettext">wiliwili</translation>
<content_rating type="oars-1.1"/>
<supports>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
<control>gamepad</control>
</supports>
<content_rating type="oars-1.1">
<content_attribute id="social-info">mild</content_attribute>
</content_rating>
<description>
<p>
C++ rewritten version of the bilibili electron client.
wiliwili is a cross-platform C++ rewritten version of the bilibili electron client.
It can help users in accessing bilibili on unsupported systems, while supporting keyboard, mouse, gamepad, and touchscreen inputs.
</p>
<p>Features:</p>
<ul>
<li>Multilingual: Simplified Chinese, Traditional Chinese (automatic translation), English...</li>
<li>Multilingual: Simplified Chinese, Traditional Chinese, English...</li>
<li>Theme: Light / Dark</li>
<li>Player: Video, Bangumi, Film and TV show</li>
<li>Personal: You can scan the qrcode to login and view history, collection...</li>
<li>Search: TV style, videos and bangumi...</li>
<li>Search: TV style, Videos and Bangumi...</li>
<li>Activity: Recently updated video of the following uploader</li>
<li>Live: Support watching the following uploader and other system recommendations</li>
<li>Flatpak: wiliwili config directory is ~/.var/app/cn.xfangfang.wiliwili/config/wiliwili</li>
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/cn.xfangfang.wiliwili.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Exec=wiliwili
Icon=cn.xfangfang.wiliwili
Terminal=false
Type=Application
Categories=AudioVideo
Categories=AudioVideo;Audio;Video;
Loading