sonar:fix linux build

This commit is contained in:
xiaoyifang 2022-12-06 09:45:58 +08:00
parent afb5c4f951
commit 1744843956
5 changed files with 133 additions and 11 deletions

110
.github/workflows/cmake build test.yml vendored Normal file
View file

@ -0,0 +1,110 @@
name: CMake Test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
# push:
# branches:
# - dev
# pull_request:
# types: [opened, synchronize, reopened]
jobs:
job1:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.3.2
arch: gcc_64
cached: 'false'
#serialport linuxdeploy need serialport to work.
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtserialport
setup-python: 'false'
- name: ubuntu install thirdparty dependencies
run: |
sudo apt-get install git pkg-config build-essential
sudo apt-get install libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev
sudo apt-get install libxtst-dev liblzo2-dev libbz2-dev
sudo apt-get install libao-dev libavutil-dev libavformat-dev libtiff5-dev libeb16-dev
sudo apt-get install doxygen libzstd-dev libxkbcommon-dev libgstreamer-plugins-base1.0-0 libgstreamer-gl1.0-0
sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
#build opencc
git clone https://github.com/BYVoid/OpenCC
cd OpenCC/
make PREFIX=/usr -j$(nproc)
sudo make install
cd ..
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
- name: Run build-wrapper
run: |
cmake .
cmake --build .
job2:
name: Build and analyze
runs-on: windows-2019
steps:
- uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.3.2
arch: gcc_64
cached: 'false'
#serialport linuxdeploy need serialport to work.
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtserialport
setup-python: 'false'
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
- name: Run build-wrapper
run: |
cmake .
cmake --build .
job3:
name: Build and analyze
runs-on: macos-12
steps:
- uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.3.2
arch: gcc_64
cached: 'false'
#serialport linuxdeploy need serialport to work.
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtserialport
setup-python: 'false'
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
- name: install dependencies
run: |
brew uninstall opencc hunspell ffmpeg@5 ffmpeg@4 libtiff xz lzo libogg libvorbis zstd || true
brew install create-dmg
- name: Run build-wrapper
run: |
cmake .
cmake --build .

4
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "eb"] [submodule "eb"]
path = eb path = thirdparty/eb
url = git@github.com:xiaoyifang/simple-eb.git url = https://github.com/xiaoyifang/simple-eb.git

View file

@ -5,14 +5,14 @@ cmake_minimum_required(VERSION 3.23)
# LINUX, APPLE and MSVC are used to detect system # LINUX, APPLE and MSVC are used to detect system
option(WITH_FFMPEG_PLAYER "Enable support for FFMPEG player" ON) option(WITH_FFMPEG_PLAYER "Enable support for FFMPEG player" ON)
option(WITH_EPWING_SUPPORT "Enable epwing support" ON)
# Remove this once cmake 5.25 becomes minimum version # Remove this once cmake 5.25 becomes minimum version
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
set(LINUX TRUE) set(LINUX TRUE)
endif() endif()
if (APPLE) if (APPLE)
add_subdirectory(eb) add_subdirectory(thirdparty/eb)
endif () endif ()
project(goldendict project(goldendict
@ -76,9 +76,12 @@ if(LINUX)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
pkg_check_modules (LIBXTST IMPORTED_TARGET xtst) pkg_check_modules (LIBXTST IMPORTED_TARGET xtst)
add_library(libeb SHARED IMPORTED) if(WITH_EPWING_SUPPORT)
set_target_properties(libeb PROPERTIES IMPORTED_LOCATION /usr/lib/libeb.so) add_subdirectory(thirdparty/eb EXCLUDE_FROM_ALL)
set_target_properties(libeb PROPERTIES INCLUDE_DIRECTORIES /usr/include/) endif()
# add_library(libeb SHARED IMPORTED)
# set_target_properties(libeb PROPERTIES IMPORTED_LOCATION /usr/lib/libeb.so)
# set_target_properties(libeb PROPERTIES INCLUDE_DIRECTORIES /usr/include/)
endif() endif()
#### Compile time files and preprocessor flags #### Compile time files and preprocessor flags
@ -144,7 +147,7 @@ set(UI_SRC
scanpopup.ui scanpopup.ui
sources.ui sources.ui
) )
if(WITH_EPWING_SUPPORT)
set(EPWING_SUPPORT_SRC set(EPWING_SUPPORT_SRC
epwing.cc epwing.cc
epwing.hh epwing.hh
@ -153,6 +156,9 @@ set(EPWING_SUPPORT_SRC
epwing_charmap.cc epwing_charmap.cc
epwing_charmap.hh epwing_charmap.hh
) )
else()
add_compile_definitions(NO_EPWING_SUPPORT)
endif()
if (APPLE) if (APPLE)
set(MAC_SRC set(MAC_SRC
@ -489,10 +495,12 @@ if(APPLE)
endif() endif()
if(UNIX) if(UNIX)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
${PROJECT_SOURCE_DIR}/thirdparty)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
# pkg-config packages need manually link # pkg-config packages need manually link
PkgConfig::PKGCONFIG_DEPS PkgConfig::PKGCONFIG_DEPS
BZip2::BZip2 BZip2::BZip2
ZLIB::ZLIB #hidden requirement of dsl_details.cc and more? ZLIB::ZLIB #hidden requirement of dsl_details.cc and more?
) )
@ -507,7 +515,11 @@ endif()
if(LINUX) if(LINUX)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libeb X11 PkgConfig::LIBXTST) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE X11 PkgConfig::LIBXTST)
if(WITH_EPWING_SUPPORT)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE eb )
endif()
endif () endif ()
if(APPLE) if(APPLE)

1
eb

@ -1 +0,0 @@
Subproject commit cda417343ceedcb4b44e37e54590979f59c748c9

1
thirdparty/eb vendored Submodule

@ -0,0 +1 @@
Subproject commit b4d020bee71b10c8fc1d15beb5849c5b19fd5fa1