Skip to content

Commit 2f504a2

Browse files
authored
Re-make build system + add CI + fix showstopper bugs (fixes #1) (#2)
* CMake: Re-write build system to be standalone * actor_projectM.cpp: Fix projectM include for libprojectM.pc version 3.1.12 * Pass CMake's PROJECT_VERSION into live plug-in metadata * Add multi-compiler GitHub Actions CI for build on Linux * Make GitHub Dependabot keep our GitHub Actions up to date * Only call projectM_resetGL when window size changed * Fix new/delete mis-matches in lv_projectm_cleanup * Fix keyboard event handling in lv_projectm_events * Bump version to 2.1.1
1 parent b66d1fa commit 2f504a2

File tree

5 files changed

+178
-36
lines changed

5 files changed

+178
-36
lines changed

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2023 Sebastian Pipping <[email protected]>
2+
# Licensed under GPL v3 or later
3+
4+
version: 2
5+
updates:
6+
7+
- package-ecosystem: "github-actions"
8+
commit-message:
9+
include: "scope"
10+
prefix: "Actions"
11+
directory: "/"
12+
labels:
13+
- "enhancement"
14+
schedule:
15+
interval: "weekly"

.github/workflows/linux.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Copyright (c) 2023 Sebastian Pipping <[email protected]>
2+
# Licensed under GPL v3 or later
3+
4+
name: Build on Linux
5+
6+
on:
7+
pull_request:
8+
push:
9+
schedule:
10+
- cron: '0 3 * * 5' # Every Friday at 3am
11+
12+
jobs:
13+
linux:
14+
name: Build (${{ matrix.cc }})
15+
runs-on: ${{ matrix.runs-on }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- cc: gcc-11
21+
cxx: g++-11
22+
clang_major_version: null
23+
clang_repo_suffix: null
24+
runs-on: ubuntu-22.04
25+
- cc: gcc-12
26+
cxx: g++-12
27+
clang_major_version: null
28+
clang_repo_suffix: null
29+
runs-on: ubuntu-22.04
30+
- cc: clang-15
31+
cxx: clang++-15
32+
clang_major_version: 15
33+
clang_repo_suffix: -15
34+
runs-on: ubuntu-22.04
35+
- cc: clang-16
36+
cxx: clang++-16
37+
clang_major_version: 16
38+
clang_repo_suffix: -16
39+
runs-on: ubuntu-22.04
40+
- cc: clang-17
41+
cxx: clang++-17
42+
clang_major_version: 17
43+
clang_repo_suffix:
44+
runs-on: ubuntu-22.04
45+
steps:
46+
- name: Add Clang/LLVM repositories
47+
if: "${{ contains(matrix.cxx, 'clang') }}"
48+
run: |-
49+
set -x
50+
source /etc/os-release
51+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
52+
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}${{ matrix.clang_repo_suffix }} main"
53+
54+
- name: Install build dependencies
55+
run: |-
56+
sudo apt-get update
57+
sudo apt-get install --yes --no-install-recommends \
58+
cmake \
59+
libprojectm-dev \
60+
libvisual-0.4-dev \
61+
pkg-config
62+
63+
- name: Install build dependency Clang ${{ matrix.clang_major_version }}
64+
if: "${{ contains(matrix.cxx, 'clang') }}"
65+
run: |-
66+
sudo apt-get install --yes --no-install-recommends -V \
67+
clang-${{ matrix.clang_major_version }}
68+
69+
- name: Checkout Git branch
70+
uses: actions/checkout@v3
71+
72+
- name: 'Configure with CMake'
73+
run: |-
74+
cmake_args=(
75+
-DCMAKE_C_COMPILER="${{ matrix.cc }}"
76+
-DCMAKE_CXX_COMPILER="${{ matrix.cxx }}"
77+
-S ./
78+
-B build/
79+
)
80+
set -x
81+
cmake "${cmake_args[@]}"
82+
83+
- name: 'Build'
84+
run: |-
85+
set -x
86+
make -C build -j$(nproc) VERBOSE=1
87+
88+
- name: 'Install'
89+
run: |-
90+
set -x -o pipefail
91+
make -C build install DESTDIR="${PWD}"/ROOT/
92+
find ROOT/ | sort | xargs ls -ld

CMakeLists.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copyright (c) 2023 Sebastian Pipping <[email protected]>
2+
# Licensed under GPL v3 or later
3+
4+
cmake_minimum_required(VERSION 3.6)
5+
# CMake features used that need more than CMake 3.0:
6+
# - pkg_get_variable needs >=3.4
7+
# - pkg_check_modules([..] IMPORTED_TARGET [..]) needs >=3.6
8+
9+
project(libvisual-projectm VERSION 2.1.1)
10+
11+
include(FindPkgConfig)
12+
13+
pkg_check_modules(LIBVISUAL libvisual-0.4 REQUIRED IMPORTED_TARGET)
14+
pkg_get_variable(LIBVISUAL_PLUGINS_BASE_DIR libvisual-0.4 pluginsbasedir)
15+
set(LIBVISUAL_ACTOR_PLUGINS_DIR "${LIBVISUAL_PLUGINS_BASE_DIR}/actor")
16+
17+
pkg_check_modules(LIBPROJECTM libprojectM REQUIRED IMPORTED_TARGET)
18+
pkg_get_variable(LIBPROJECTM_PREFIX libprojectM prefix)
19+
20+
add_library(projectM_libvisual MODULE
21+
src/actor_projectM.cpp
22+
src/ConfigFile.cpp
23+
src/ConfigFile.h
24+
src/lvtoprojectM.h
25+
)
26+
27+
target_compile_definitions(projectM_libvisual
28+
PRIVATE
29+
PACKAGE_VERSION="${PROJECT_VERSION}"
30+
PROJECTM_PREFIX="${LIBPROJECTM_PREFIX}"
31+
)
32+
33+
target_link_libraries(projectM_libvisual
34+
PUBLIC
35+
PkgConfig::LIBPROJECTM
36+
PkgConfig::LIBVISUAL
37+
)
38+
39+
install(TARGETS projectM_libvisual
40+
LIBRARY DESTINATION "${LIBVISUAL_ACTOR_PLUGINS_DIR}"
41+
)
42+
43+
message(STATUS "Configuration:")
44+
message(STATUS " CMAKE_BUILD_TYPE: \"${CMAKE_BUILD_TYPE}\"")
45+
message(STATUS " CMAKE_INSTALL_PREFIX: \"${CMAKE_INSTALL_PREFIX}\"")
46+
message(STATUS " LIBPROJECTM_PREFIX: \"${LIBPROJECTM_PREFIX}\"")
47+
message(STATUS " LIBVISUAL_ACTOR_PLUGINS_DIR: \"${LIBVISUAL_ACTOR_PLUGINS_DIR}\"")
48+
message(STATUS " LIBVISUAL_PLUGINS_BASE_DIR: \"${LIBVISUAL_PLUGINS_BASE_DIR}\"")

src/CMakeLists.txt

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/actor_projectM.cpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <sys/types.h>
1212

1313
#include <libvisual/libvisual.h>
14-
#include <projectM.hpp>
14+
#include <libprojectM/projectM.hpp>
1515
#include "lvtoprojectM.h"
1616
#include "ConfigFile.h"
1717

@@ -66,7 +66,7 @@ extern "C" const VisPluginInfo *get_plugin_info (int *count)
6666
info[0].plugname = (char*)"projectM";
6767
info[0].name = (char*)"libvisual projectM";
6868
info[0].author = (char*)"Peter Sperl";
69-
info[0].version = (char*)"1.1";
69+
info[0].version = (char*)PACKAGE_VERSION;
7070
info[0].about = (char*)"projectM";
7171
info[0].help = (char*)"";
7272

@@ -121,10 +121,11 @@ extern "C" int lv_projectm_init (VisPluginData *plugin)
121121
extern "C" int lv_projectm_cleanup (VisPluginData *plugin)
122122
{
123123
ProjectmPrivate *priv = (ProjectmPrivate*)visual_object_get_private (VISUAL_OBJECT (plugin));
124+
visual_log_return_val_if_fail(priv != nullptr, -1);
124125

125126
/* Cleanup, and thus also free our private */
126-
visual_mem_free (priv->PM);
127-
visual_mem_free (priv);
127+
delete priv->PM;
128+
delete priv;
128129
return 0;
129130
}
130131

@@ -156,8 +157,16 @@ extern "C" int lv_projectm_dimension (VisPluginData *plugin, VisVideo *video, in
156157
ProjectmPrivate *priv = (ProjectmPrivate*)visual_object_get_private (VISUAL_OBJECT (plugin));
157158

158159
visual_video_set_dimension (video, width, height);
160+
161+
static int prev_width = 0;
162+
static int prev_height = 0;
159163

160-
priv->PM->projectM_resetGL( width, height );
164+
if (width != prev_width || height != prev_height) {
165+
priv->PM->projectM_resetGL( width, height );
166+
167+
prev_width = width;
168+
prev_height = height;
169+
}
161170

162171
return 0;
163172
}
@@ -180,13 +189,21 @@ extern "C" int lv_projectm_events (VisPluginData *plugin, VisEventQueue *events)
180189
{
181190
switch (ev.type)
182191
{
183-
case VISUAL_EVENT_KEYUP:
192+
case VISUAL_EVENT_KEYDOWN:
184193

185194
evt = lv2pmEvent( ev.type );
186195
key = lv2pmKeycode( ev.event.keyboard.keysym.sym );
187196
mod = lv2pmModifier( ev.event.keyboard.keysym.mod );
188197
priv->PM->key_handler(PROJECTM_KEYDOWN, key,mod);
189198

199+
break;
200+
case VISUAL_EVENT_KEYUP:
201+
202+
evt = lv2pmEvent( ev.type );
203+
key = lv2pmKeycode( ev.event.keyboard.keysym.sym );
204+
mod = lv2pmModifier( ev.event.keyboard.keysym.mod );
205+
priv->PM->key_handler(PROJECTM_KEYUP, key,mod);
206+
190207
break;
191208
case VISUAL_EVENT_RESIZE:
192209
lv_projectm_dimension (plugin, ev.event.resize.video,

0 commit comments

Comments
 (0)