Skip to content

Commit

Permalink
Merge pull request #52 from MrAnno/cmake-rpath
Browse files Browse the repository at this point in the history
ci/release: install dependencies on Linux
  • Loading branch information
norberttak authored Dec 16, 2022
2 parents 2d1acac + edc2b52 commit c22e442
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-20.04, windows-latest]

name: Build and Test (CMake, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand All @@ -59,12 +59,15 @@ jobs:
- uses: actions/checkout@v3

- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -qq && sudo apt-get install -y build-essential cmake liblua5.3-dev libhidapi-dev
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update -qq && sudo apt-get install -y build-essential cmake liblua5.3-dev libhidapi-dev
echo 'XPANEL_INSTALL_DEPS_FLAG=-DINSTALL_DEPS=ON' >> $GITHUB_ENV
- name: Build
run: |
cmake -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -S . -B build
cmake -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -S . -B build ${XPANEL_INSTALL_DEPS_FLAG}
cmake --build build
- name: Run tests
Expand All @@ -73,8 +76,8 @@ jobs:
- name: Install
run: cmake --build build --target install

- name: Upload built plugin (Linux)
if: matrix.os == 'ubuntu-latest'
- name: Upload built plugin (Linux glibc 2.31)
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: built-plugin-linux
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: v${{ inputs.release-version }}
WINDOWS_RELEASE_PLUGIN_ZIP: xpanel_windows_v${{ inputs.release-version }}.zip
LINUX_RELEASE_PLUGIN_ZIP: xpanel_linux_v${{ inputs.release-version }}.zip
LINUX_RELEASE_PLUGIN_ZIP: xpanel_linux_v${{ inputs.release-version }}_glibc2.31.zip
SAMPLE_CONFIG_ZIP: sample_configs_v${{ inputs.release-version }}.zip

steps:
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set(PLUGIN_INSTALL_DIR ${PROJECT_NAME}/64)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/.cmake)

option(INSTALL_DEPS "Install dependencies into the plugin's directory" OFF)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "C++ standard is a requirement")
Expand Down
14 changes: 10 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ elseif (UNIX)
set(XPANEL_PLUGIN_FILENAME "lin")
endif()

set_target_properties(xpanel PROPERTIES PREFIX "")
set_target_properties(xpanel PROPERTIES OUTPUT_NAME ${XPANEL_PLUGIN_FILENAME})
set_target_properties(xpanel PROPERTIES SUFFIX ".xpl")
set_target_properties(xpanel PROPERTIES PREFIX "" OUTPUT_NAME ${XPANEL_PLUGIN_FILENAME} SUFFIX ".xpl")

install(TARGETS xpanel DESTINATION ${PLUGIN_INSTALL_DIR})
if (INSTALL_DEPS)
set_target_properties(xpanel PROPERTIES INSTALL_RPATH "\$ORIGIN")
install(TARGETS xpanel
RUNTIME_DEPENDENCIES POST_EXCLUDE_REGEXES "lib(c|gcc_s|m|stdc|stdc\\+\\+|atomic|rt|dl|pthread)\\." "ld-linux"
DESTINATION ${PLUGIN_INSTALL_DIR}
)
else()
install(TARGETS xpanel DESTINATION ${PLUGIN_INSTALL_DIR})
endif()

0 comments on commit c22e442

Please sign in to comment.