Skip to content

Commit dac1173

Browse files
authored
Merge pull request #42 from projectM-visualizer/qt
Qt5+pulseaudio support from @deltaoscarmike
2 parents 707e200 + 657e9da commit dac1173

File tree

9 files changed

+210
-50
lines changed

9 files changed

+210
-50
lines changed

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ before_script: ./autogen.sh
44
before_install:
55
- eval "${MATRIX_EVAL}"
66

7+
# TODO: test different combinations of flags, --enable-sdl, --enable-qt, etc
78
script:
8-
- ./configure --enable-sdl --prefix=$PWD/local && make -j8 && make install # build from checkoout
9-
- make dist && tar -zxf projectM-*.tar.gz && cd projectM-* && ./configure --enable-sdl --prefix=$PWD/local && make -j8 && make install # build from dist\
9+
- ./configure --enable-sdl --prefix=$PWD/local && make -j8 && make install # build from checkout
10+
- make dist && tar -zxf projectM-*.tar.gz && cd projectM-* && ./configure --enable-sdl --prefix=$PWD/dist_install && make -j8 && make install # build from dist
1011
- echo "PWD $PWD"
1112
- ls .
1213
- test -e src/projectM-sdl/projectMSDL
1314
- test -e src/libprojectM/libprojectM.la
14-
- test -e local/share/projectM/fonts/Vera.ttf
15-
- test -e local/share/projectM/shaders/blur.cg
16-
- test -d local/share/projectM/presets
17-
- test -e local/lib/libprojectM.la
18-
- test -e local/include/projectM.hpp
15+
- test -e dist_install/share/projectM/fonts/Vera.ttf
16+
- test -e dist_install/share/projectM/shaders/blur.cg
17+
- test -d dist_install/share/projectM/presets
18+
- test -e dist_install/lib/libprojectM.la
19+
- test -e dist_install/include/projectM.hpp
1920

2021
# test on GCC and Clang
2122
matrix:

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ install-data-local:
2222
find "$(PRESETSDIR)" -type f -exec $(INSTALL_DATA) {} $(pm_presets_dir) \;
2323

2424
# from https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable answer: https://stackoverflow.com/a/30960268
25-
# ptomato https://stackoverflow.com/users/172999/ptomato
25+
# ptomato https://stackoverflow.com/users/172999/ptomato
2626

2727
src/libprojectM/config.inp: src/libprojectM/config.inp.in Makefile
2828
$(AM_V_GEN)rm -f $@ $@.tmp && \

configure.ac

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@ AX_CHECK_GL
1111

1212
AC_CHECK_LIB(c, dlopen, LIBDL="", AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl"))
1313

14-
dnl SDL
15-
AC_ARG_ENABLE([sdl],
16-
AS_HELP_STRING([--enable-sdl], [Build SDL2 app]),
17-
[], [enable_sdl=no])
18-
AS_IF([test "x$enable_sdl" = "xyes"], [
19-
m4_include([m4/sdl2.m4])
20-
SDL_VERSION=2.0.5
21-
AS_IF([test "$TRAVIS"], [SDL_VERSION=2.0.2]) # travis has old SDL, we don't care
22-
AM_PATH_SDL2($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
23-
AC_CONFIG_FILES([src/projectM-sdl/Makefile])
24-
])
25-
2614
AC_CONFIG_HEADERS([config.h])
2715
AC_CONFIG_FILES([
2816
Makefile
@@ -32,20 +20,60 @@ AC_CONFIG_FILES([
3220
src/libprojectM/NativePresetFactory/Makefile
3321
src/libprojectM/MilkdropPresetFactory/Makefile
3422
src/NativePresets/Makefile
23+
src/projectM-sdl/Makefile
24+
src/projectM-qt/Makefile
25+
src/projectM-pulseaudio/Makefile
3526
])
3627

37-
dnl from https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable answer: https://stackoverflow.com/a/30960268
38-
dnl ptomato https://stackoverflow.com/users/172999/ptomato
28+
dnl SDL
29+
AC_ARG_ENABLE([sdl],
30+
AS_HELP_STRING([--enable-sdl], [Build SDL2 app]),
31+
[], [enable_sdl=no])
32+
AS_IF([test "x$enable_sdl" = "xyes"], [
33+
m4_include([m4/sdl2.m4])
34+
SDL_VERSION=2.0.5
35+
AS_IF([test "$TRAVIS"], [SDL_VERSION=2.0.2]) # travis has old SDL, we don't care
36+
AM_PATH_SDL2($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
37+
])
3938

39+
dnl from https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable answer: https://stackoverflow.com/a/30960268
40+
dnl ptomato https://stackoverflow.com/users/172999/ptomato
4041
AC_SUBST([PACKAGE])
4142
AC_PROG_SED
4243
AC_CONFIG_FILES([src/libprojectM/config.inp.in])
4344

44-
4545
AC_PREFIX_DEFAULT([/usr/local])
4646

4747
AC_PROG_MKDIR_P
4848

49+
dnl Qt
50+
AC_ARG_ENABLE([qt],
51+
AS_HELP_STRING([--enable-qt], [Build Qt]),
52+
[], [enable_qt=no])
53+
AS_IF([test "x$enable_qt" = "xyes"], [
54+
PKG_CHECK_MODULES(QT, [Qt5Core, Qt5Gui, Qt5Widgets Qt5OpenGL], [], [AC_MSG_ERROR([Qt libraries are required.])])
55+
qt_CPPFLAGS="`$PKG_CONFIG --cflags-only-I Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $CPPFLAGS"
56+
qt_LDFLAGS="`$PKG_CONFIG --libs-only-L Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $LDFLAGS"
57+
qt_LIBS="`$PKG_CONFIG --libs-only-l Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $LIBS"
58+
59+
if ! `$PKG_CONFIG --atleast-version=5.0.0 Qt5Core`; then
60+
AC_MSG_ERROR([Qt >= 5.0.0 is required. Try installing qtdeclarative5-dev])
61+
fi
62+
63+
AC_CHECK_PROGS(MOC, [moc-qt5 moc])
64+
AC_CHECK_PROGS(UIC, [uic-qt5 uic])
65+
AC_CHECK_PROGS(RCC, [rcc])
66+
if test -z "$MOC" || test -z "$UIC" || test -z "$RCC"; then
67+
AC_MSG_ERROR([Qt utility programs moc, uic, and rcc are required.])
68+
fi
69+
70+
PKG_CHECK_MODULES(LIBPULSE, [libpulse], [], [AC_MSG_ERROR([Pulseaudio library libpulse is required.])])
71+
])
72+
73+
AM_CONDITIONAL([ENABLE_SDL], [test "$enable_sdl" = yes])
74+
AM_CONDITIONAL([ENABLE_QT], [test "$enable_qt" = yes])
75+
76+
4977
my_CFLAGS="-Wall -Wchar-subscripts -Wformat-security -Wmissing-declarations -Wpointer-arith -Wshadow -Wsign-compare -Wtype-limits "
5078
AC_SUBST([my_CFLAGS])
5179

@@ -82,9 +110,12 @@ compiler: ${CC}
82110
cflags: ${CFLAGS}
83111
ldflags: ${LDFLAGS}
84112
113+
- - -
85114
86115
Applications:
87116
=====
88117
118+
libprojectM: yes
89119
SDL: ${enable_sdl}
120+
Qt & Pulseaudio: ${enable_qt}
90121
])

src/Makefile.am

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
SUBDIRS=libprojectM projectM-sdl NativePresets
1+
if ENABLE_SDL
2+
PROJECTM_SDL_SUBDIR = projectM-sdl
3+
endif
4+
5+
if ENABLE_QT
6+
PROJECTM_QT_SUBDIR = projectM-qt projectM-pulseaudio
7+
endif
8+
9+
SUBDIRS=libprojectM NativePresets ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
SUFFIXES = .hpp .cpp _moc.cpp _qrc.qrc
2+
3+
projectM_pulseaudio_qtheaders = \
4+
QPulseAudioDeviceChooser.hpp \
5+
QPulseAudioDeviceModel.hpp \
6+
QPulseAudioThread.hpp
7+
8+
nodist_projectM_pulseaudio_moc_sources = $(projectM_pulseaudio_qtheaders:.hpp=_moc.cpp)
9+
10+
.hpp_moc.cpp:
11+
@MOC@ -o$@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(MOC_CPPFLAGS)\
12+
$(qt_CPPFLAGS) $(qt_LDFLAGS) $(qt_LIBS) $<
13+
14+
ui_PulseDeviceChooserDialog.h: PulseDeviceChooserDialog.ui
15+
@UIC@ -o $@ $<
16+
17+
AM_CPPFLAGS = \
18+
-include $(top_builddir)/config.h \
19+
-DSYSCONFDIR=\""$(sysconfdir)"\" \
20+
-DPROJECTM_PREFIX=\""${prefix}"\" \
21+
-I${top_srcdir}/src/libprojectM \
22+
-I${top_srcdir}/src/libprojectM/Renderer \
23+
-I${top_srcdir}/src/projectM-qt \
24+
${QT_CFLAGS} \
25+
${LIBPULSE_CFLAGS} \
26+
-fPIC
27+
28+
AM_CFLAGS = ${my_CFLAGS} \
29+
-fvisibility=hidden \
30+
-ffunction-sections \
31+
-fdata-sections
32+
33+
bin_PROGRAMS = projectM-pulseaudio
34+
35+
projectM_pulseaudio_SOURCES = \
36+
qprojectM-pulseaudio.cpp \
37+
QPulseAudioDeviceChooser.cpp \
38+
QPulseAudioDeviceModel.cpp \
39+
QPulseAudioThread.cpp \
40+
PulseDeviceChooserDialog.ui \
41+
$(projectM_pulseaudio_qtheaders)
42+
43+
nodist_projectM_pulseaudio_SOURCES = \
44+
$(nodist_projectM_pulseaudio_moc_sources)
45+
46+
projectM_pulseaudio_LDADD = \
47+
${QT_LIBS} \
48+
${LIBPULSE_LIBS} \
49+
${top_srcdir}/src/projectM-qt/libprojectM_qt.a \
50+
${top_srcdir}/src/libprojectM/libprojectM.la
51+
52+
projectM_pulseaudio_LDFLAGS = -static
53+
54+
projectM_pulseaudio_PROGRAM = projectM-pulseaudio
55+
56+
BUILT_SOURCES = \
57+
ui_PulseDeviceChooserDialog.h
58+
59+
CLEANFILES = \
60+
${BUILT_SOURCES} \
61+
${nodist_projectM_pulseaudio_moc_sources}
62+
63+
desktopdir = $(datadir)/applications
64+
dist_desktop_DATA = projectM-pulseaudio.desktop
65+
66+
dist_man_MANS = projectM-pulseaudio.1

src/projectM-qt/Makefile.am

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
SUFFIXES = .hpp .cpp _moc.cpp _qrc.qrc
2+
3+
projectM_qt_qtheaders = qprojectm_mainwindow.hpp \
4+
qpresetfiledialog.hpp \
5+
qplaylistfiledialog.hpp \
6+
qplaylistmodel.hpp \
7+
qprojectmconfigdialog.hpp \
8+
qplaylisttableview.hpp \
9+
qpresettextedit.hpp \
10+
qpreseteditordialog.hpp \
11+
qprojectm.hpp \
12+
qprojectmwidget.hpp
13+
14+
nodist_projectM_qt_moc_sources = $(projectM_qt_qtheaders:.hpp=_moc.cpp)
15+
16+
.hpp_moc.cpp:
17+
@MOC@ -o$@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(MOC_CPPFLAGS)\
18+
$(qt_CPPFLAGS) $(qt_LDFLAGS) $(qt_LIBS) $<
19+
20+
ui_qprojectm_mainwindow.h: qprojectm_mainwindow.ui
21+
@UIC@ -o $@ $<
22+
23+
ui_qpreseteditordialog.h: qpreseteditordialog.ui
24+
@UIC@ -o $@ $<
25+
26+
ui_qprojectmconfigdialog.h: qprojectmconfigdialog.ui
27+
@UIC@ -o $@ $<
28+
29+
application_qrc.cpp: application.qrc
30+
@RCC@ -o $@ $<
31+
32+
33+
BUILT_SOURCES = \
34+
ui_qprojectm_mainwindow.h \
35+
ui_qpreseteditordialog.h \
36+
ui_qprojectmconfigdialog.h
37+
38+
noinst_LIBRARIES = libprojectM_qt.a
39+
40+
libprojectM_qt_a_SOURCES = \
41+
qprojectm_mainwindow.cpp \
42+
configfile.hpp configfile.cpp \
43+
qplaylistfiledialog.cpp \
44+
qplaylistmodel.cpp \
45+
qprojectmconfigdialog.cpp \
46+
qpresettextedit.cpp \
47+
qpreseteditordialog.cpp \
48+
qprojectm_mainwindow.ui \
49+
qpreseteditordialog.ui \
50+
qprojectmconfigdialog.ui \
51+
$(projectM_qt_qtheaders) \
52+
qxmlplaylisthandler.hpp \
53+
nullable.hpp \
54+
application.qrc \
55+
images/*
56+
57+
nodist_libprojectM_qt_a_SOURCES = \
58+
application_qrc.cpp \
59+
$(nodist_projectM_qt_moc_sources)
60+
61+
AM_CPPFLAGS = \
62+
-include $(top_builddir)/config.h \
63+
-DSYSCONFDIR=\""$(sysconfdir)"\" \
64+
-I${top_srcdir}/src/libprojectM \
65+
-I${top_srcdir}/src/libprojectM/Renderer \
66+
${QT_CFLAGS} \
67+
-fPIC
68+
69+
AM_CFLAGS = ${my_CFLAGS} \
70+
-fvisibility=hidden \
71+
-ffunction-sections \
72+
-fdata-sections
73+
74+
CLEANFILES = \
75+
application_qrc.cpp \
76+
${BUILT_SOURCES} \
77+
${nodist_projectM_qt_moc_sources}

src/projectM-qt/libprojectM-qt.pc.in

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

src/projectM-qt/qprojectm_mainwindow.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#include "nullable.hpp"
3939
#include "qprojectmwidget.hpp"
4040

41+
extern int qInitResources();
42+
4143
class PlaylistWriteFunctor {
4244
public:
4345
PlaylistWriteFunctor(const QVector<QProjectM_MainWindow::PlaylistItemMetaData*>::iterator & begin,
@@ -77,7 +79,7 @@ QProjectM_MainWindow::QProjectM_MainWindow ( const std::string & config_file, QM
7779
configDialog(0), hHeader(0), vHeader(0), _menuVisible(true), _menuAndStatusBarsVisible(true),
7880
activePresetIndex(new Nullable<long>), playlistItemCounter(0), m_QPresetEditorDialog(0)
7981
{
80-
82+
qInitResources();
8183

8284
ui = new Ui::QProjectM_MainWindow();
8385
ui->setupUi ( this );

src/projectM-qt/src.pro

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

0 commit comments

Comments
 (0)