Skip to content

Commit

Permalink
Makefile: qt / jack / pulseaudio (#163)
Browse files Browse the repository at this point in the history
Major updates to Makefiles, please report any build time issues!
Adding/updating makefiles for Qt, Jack, and Pulseadio implementations



* detect if we have libpulseaudio, libsdl2, and qt5 and if so just enable them automatically without the user having to.

* jack support, travis build with pa/jack/qt

* pass config opts

* test

* test

* test

* don't always enable sdl

* better libsdl2 detection

* hopefully fixed qt/pulse/jack makefiles

* oops

* travis

* fix jack subdir

* jack fixup

* jack makefile

* libsdl 1 for jack

* jack builds yay (qt version)

* testqt

* readme

* let's always build test

* let's always build test

* sdl2 for travis build test

* qt is required for jack/pulse
  • Loading branch information
revmischa authored Feb 28, 2019
1 parent df86fd1 commit 5598b83
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 66 deletions.
32 changes: 25 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ before_install:

# TODO: test different combinations of flags, --enable-sdl, --enable-qt, etc
script:
- ./configure --enable-sdl --prefix=$PWD/local && make -j8 && make install # build from checkout
- make dist && tar -zxf projectM-*.tar.gz && cd projectM-* && ./configure --enable-sdl --prefix=$PWD/dist_install && make -j8 && make install # build from dist
- echo "PWD $PWD"
- ./configure $PM_OPTS --prefix=$PWD/local && make -j6 && make install # build from checkout
- make dist && tar -zxf projectM-*.tar.gz && cd projectM-* && ./configure $PM_OPTS --prefix=$PWD/dist_install && make -j6 && make install # build from dist
- echo "PWD=$PWD"
- ls .
- test -e src/projectM-sdl/projectMSDL
# - test -e src/projectM-sdl/projectMSDL
- test -e src/libprojectM/libprojectM.la
- test -e dist_install/share/projectM/fonts/Vera.ttf
- test -d dist_install/share/projectM/presets
Expand All @@ -23,7 +23,7 @@ script:
# test on GCC and Clang
matrix:
include:
# linux/clang
# linux/clang with SDL
- os: linux
addons:
apt:
Expand All @@ -35,8 +35,26 @@ matrix:
- libglm-dev
- libc++-dev
env:
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
# linux/gcc
- MATRIX_EVAL="CC=clang-5.0 CXX=clang++-5.0 PM_OPTS=\"--enable-sdl\""
# linux/clang with pulseaudio/qt/jack
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- libsdl2-dev
- clang-5.0
- libglm-dev
- libc++-dev
- qtdeclarative5-dev
- libqt5opengl5-dev
- libjack-dev
- libpulse-dev
- libsdl-dev # for jack
env:
- MATRIX_EVAL="CC=clang-5.0 CXX=clang++-5.0 PM_OPTS=\"--enable-qt --enable-jack --enable-pulseaudio\""
# linux/gcc
- os: linux
addons:
apt:
Expand Down
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PRESETSDIR = presets
EXTRA_DIST=README.md AUTHORS.txt presets fonts $(PRESETSDIR)
CLEANFILES=

# stick apps in bin
# bin_PROGRAMS = $(top_builddir)/bin

# aka /usr/local/share/projectM
pm_data_dir = $(pkgdatadir)
pm_font_dir = $(pm_data_dir)/fonts
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/projectM-visualizer/projectm.svg?branch=master)](https://travis-ci.org/projectM-visualizer/projectm)
[![Backers on Open Collective](https://opencollective.com/projectm/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/projectm/sponsors/badge.svg)](#sponsors)
[![Sponsors on Open Collective](https://opencollective.com/projectm/sponsors/badge.svg)](#sponsors)

![Logo](https://github.com/projectM-visualizer/projectm/raw/master/web/logo.png)

Expand Down Expand Up @@ -71,7 +71,7 @@ Silverjuke (FOSS Jukebox)
```

## Linux (debian/ubuntu)
* `sudo apt-get install autoconf libtool libsdl2-dev libglm-dev`
* `sudo apt install autoconf libtool libsdl2-dev libglm-dev qtdeclarative5-dev libqt5opengl5-dev libjack-dev libpulse-dev libsdl-dev`

## FreeBSD
* `pkg install gcc autoconf automake libtool mesa-libs libGLU sdl2 glm`
Expand Down Expand Up @@ -130,7 +130,7 @@ If you maintain packages of libprojectM, we are happy to work with you! Please n

## Contributors

This project exists thanks to all the people who contribute.
This project exists thanks to all the people who contribute.
<a href="https://github.com/projectM-visualizer/projectm/graphs/contributors"><img src="https://opencollective.com/projectm/contributors.svg?width=890&button=false" /></a>


Expand Down
147 changes: 106 additions & 41 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([projectM], [3.1.0], [[email protected]], [projectM], [https://github.com/revmischa/projectm])
AC_INIT([projectM], [3.1.1], [[email protected]], [projectM], [https://github.com/projectM-visualizer/projectm/])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax])

m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Expand Down Expand Up @@ -72,27 +72,40 @@ AC_CONFIG_FILES([
src/projectM-emscripten/Makefile
src/projectM-qt/Makefile
src/projectM-pulseaudio/Makefile
src/projectM-jack/Makefile
src/projectM-test/Makefile
])
])

dnl SDL
AC_ARG_ENABLE([sdl],
AS_HELP_STRING([--enable-sdl], [Build SDL2 app]),
[], [enable_sdl=no])
AS_IF([test "x$enable_sdl" = "xyes"], [
m4_include([m4/sdl2.m4])
SDL_VERSION=2.0.5
AS_IF([test "$TRAVIS"], [SDL_VERSION=2.0.2]) # travis has old SDL, we don't care
AS_IF([test "EMSCRIPTEN"], [SDL_VERSION=2.0.0]) # emscripten has old SDL, we don't care
AM_PATH_SDL2($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))

# SDL
AC_ARG_ENABLE([sdl], AS_HELP_STRING([--enable-sdl], [Build SDL2 application]), [], [enable_sdl=check])
AS_IF([test "$enable_sdl" != "no"], [
PKG_CHECK_MODULES([SDL], [sdl2], [
m4_include([m4/sdl2.m4])
SDL_VERSION="2.0.5"
AS_IF([test "$TRAVIS"], [SDL_VERSION=2.0.2]) # travis has old SDL, we don't care
AS_IF([test "$EMSCRIPTEN"], [SDL_VERSION=2.0.0]) # emscripten has old SDL, we don't care
# Check for libSDL >= $SDL_VERSION
AM_PATH_SDL2($SDL_VERSION,
[enable_sdl=yes],
[AS_IF([test "$enable_sdl" = "yes"], AC_MSG_ERROR([*** SDL version >= $SDL_VERSION not found!])); enable_sdl=no])
],
[
# not found
AS_IF([test "$enable_sdl" = "yes"], AC_MSG_ERROR([*** libsdl2 not found!]))
enable_sdl=no
])
])

dnl glm

# glm
AS_IF([test "x$enable_emscripten" != "xyes"], [
AC_CHECK_HEADER([glm/glm.hpp],, AC_MSG_ERROR(libglm is required.))
])

dnl Threading

# Threading
AC_ARG_ENABLE([threading],
AS_HELP_STRING([--enable-threading], [multhreading]),
[], [enable_threading=yes])
Expand Down Expand Up @@ -133,32 +146,82 @@ AX_CHECK_COMPILE_FLAG([-std=c++11], [
CXXFLAGS="$CXXFLAGS -std=c++11"])

dnl Qt
AC_ARG_ENABLE([qt],
AS_HELP_STRING([--enable-qt], [Build Qt]),
[], [enable_qt=no])
AS_IF([test "x$enable_qt" = "xyes"], [
PKG_CHECK_MODULES(QT, [Qt5Core, Qt5Gui, Qt5Widgets Qt5OpenGL], [], [AC_MSG_ERROR([Qt libraries are required.])])
qt_CPPFLAGS="`$PKG_CONFIG --cflags-only-I Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $CPPFLAGS"
qt_LDFLAGS="`$PKG_CONFIG --libs-only-L Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $LDFLAGS"
qt_LIBS="`$PKG_CONFIG --libs-only-l Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $LIBS"
if ! `$PKG_CONFIG --atleast-version=5.0.0 Qt5Core`; then
AC_MSG_ERROR([Qt >= 5.0.0 is required. Try installing qtdeclarative5-dev])
fi
AC_CHECK_PROGS(MOC, [moc-qt5 moc])
AC_CHECK_PROGS(UIC, [uic-qt5 uic])
AC_CHECK_PROGS(RCC, [rcc-qt5 rcc])
if test -z "$MOC" || test -z "$UIC" || test -z "$RCC"; then
AC_MSG_ERROR([Qt utility programs moc, uic, and rcc are required.])
fi
PKG_CHECK_MODULES(LIBPULSE, [libpulse], [], [AC_MSG_ERROR([Pulseaudio library libpulse is required.])])
])

AM_CONDITIONAL([ENABLE_SDL], [test "$enable_sdl" = yes])
AM_CONDITIONAL([ENABLE_QT], [test "$enable_qt" = yes])
AM_CONDITIONAL([ENABLE_EMSCRIPTEN], [test "$enable_emscripten" = yes])
AC_ARG_ENABLE([qt], AS_HELP_STRING([--enable-qt], [Enable Qt: needed for pulseaudio and jack GUIs]), [], [enable_qt=check])
AS_IF([test "$enable_qt" != "no"],
[PKG_CHECK_MODULES([qt],
[Qt5Core, Qt5Gui, Qt5Widgets Qt5OpenGL],
[
enable_qt=yes
# do more checks for Qt version and tools
qt_CPPFLAGS="`$PKG_CONFIG --cflags-only-I Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $CPPFLAGS"
qt_LDFLAGS="`$PKG_CONFIG --libs-only-L Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $LDFLAGS"
qt_LIBS="`$PKG_CONFIG --libs-only-l Qt5Core Qt5Gui Qt5Widgets Qt5OpenGL` $LIBS"
AC_SUBST(qt_CPPFLAGS)
AC_SUBST(qt_LDFLAGS)
AC_SUBST(qt_LIBS)
if ! `$PKG_CONFIG --atleast-version=5.0.0 Qt5Core`; then
AC_MSG_WARN([Qt >= 5.0.0 is required. Try installing libqt5opengl5-dev qtdeclarative5-dev])
enable_qt=no
fi
AC_CHECK_PROGS(MOC, [moc-qt5 moc])
AC_CHECK_PROGS(UIC, [uic-qt5 uic])
AC_CHECK_PROGS(RCC, [rcc-qt5 rcc])
if test -z "$MOC" || test -z "$UIC" || test -z "$RCC"; then
AC_MSG_WARN([Qt utility programs moc, uic, and rcc are required.])
enable_qt=no
fi
MOC="$MOC -qt=5"
UIC="$UIC -qt=5"
RCC="$RCC -qt=5"
export QT_SELECT=qt5
],
[AS_IF([test "$enable_qt" = "yes"],
[AC_MSG_ERROR(["Qt5 not found"])],
[enable_qt=no])]
)])


# Pulseaudio
AC_ARG_ENABLE([pulseaudio], AS_HELP_STRING([--enable-pulseaudio], [Build Pulseaudio]), [], [enable_pulseaudio=check])
AS_IF([test "$enable_pulseaudio" != "no"],
[PKG_CHECK_MODULES([libpulse],
[libpulse],
[
# still need qt
AS_IF([test "$enable_qt" = "yes"],
[enable_pulseaudio=yes],
[enable_pulseaudio="Qt required"])
],
[AS_IF([test "$enable_pulseaudio" = "yes"],
[AC_MSG_ERROR([libpulse required, but not found.])],
[enable_pulseaudio=no])])])


# Jack
AC_ARG_ENABLE([jack], AS_HELP_STRING([--enable-jack], [Build Jack]), [], [enable_jack=check])
AS_IF([test "$enable_jack" != "no"],
[PKG_CHECK_MODULES([jack],
[jack],
[
# still need qt
AS_IF([test "$enable_qt" = "yes"],
[enable_jack=yes],
[enable_jack="Qt required"])
],
[AS_IF([test "$enable_jack" = "yes"],
[AC_MSG_ERROR([jack required, but not found.])],
[enable_jack=no])])])


AM_CONDITIONAL([ENABLE_SDL], [test "x$enable_sdl" = "xyes"])
AM_CONDITIONAL([ENABLE_QT], [test "x$enable_qt" = "xyes"])
AM_CONDITIONAL([ENABLE_JACK], [test "x$enable_jack" = "xyes"])
AM_CONDITIONAL([ENABLE_PULSEAUDIO], [test "x$enable_pulseaudio" = "xyes"])
AM_CONDITIONAL([ENABLE_EMSCRIPTEN], [test "x$enable_emscripten" = "xyes"])


my_CFLAGS="-Wall -Wchar-subscripts -Wformat-security -Wpointer-arith -Wshadow -Wsign-compare -Wtype-limits "
Expand Down Expand Up @@ -192,7 +255,9 @@ Applications:
libprojectM: yes
Threading: ${enable_threading}
SDL: ${enable_sdl}
Qt & Pulseaudio: ${enable_qt}
Qt: ${enable_qt}
Pulseaudio: ${enable_pulseaudio}
Jack: ${enable_jack}
OpenGLES: ${enable_gles}
Emscripten: ${enable_emscripten}
])
16 changes: 12 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
if ENABLE_SDL
PROJECTM_SDL_SUBDIR = projectM-sdl projectM-test
PROJECTM_SDL_SUBDIR = projectM-test projectM-sdl
endif

if ENABLE_QT
PROJECTM_QT_SUBDIR = projectM-qt projectM-pulseaudio
PROJECTM_QT_SUBDIR = projectM-qt
endif

if ENABLE_PULSEAUDIO
PROJECTM_PULSEAUDIO_SUBDIR = projectM-qt projectM-pulseaudio
endif

if ENABLE_JACK
PROJECTM_JACK_SUBDIR = projectM-qt projectM-jack
endif

if ENABLE_EMSCRIPTEN
PROJECTM_EMSCRIPTEN_SUBDIR = projectM-emscripten
endif

SUBDIRS=libprojectM NativePresets ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR} ${PROJECTM_EMSCRIPTEN_SUBDIR}

# system headers/libraries/data to install
# for compatibility reasons here as nobase_include
nobase_include_HEADERS = libprojectM/projectM.hpp libprojectM/Common.hpp libprojectM/dlldefs.h libprojectM/event.h libprojectM/fatal.h libprojectM/PCM.hpp

SUBDIRS = libprojectM NativePresets ${PROJECTM_SDL_SUBDIR} ${PROJECTM_QT_SUBDIR} ${PROJECTM_EMSCRIPTEN_SUBDIR} ${PROJECTM_JACK_SUBDIR} ${PROJECTM_PULSEAUDIO_SUBDIR}
34 changes: 34 additions & 0 deletions src/projectM-jack/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
AM_CPPFLAGS = \
${my_CFLAGS} \
-include $(top_builddir)/config.h \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPROJECTM_PREFIX=\""${prefix}"\" \
-DRESOURCE_PREFIX=\""share/projectM"\" \
-I${top_srcdir}/src/libprojectM \
-I${top_srcdir}/src/libprojectM/Renderer \
-I${top_srcdir}/src/projectM-qt \
${jack_CFLAGS} \
${qt_CPPFLAGS} \
-fPIC \
${qt_CFLAGS}

# TODO: add remote control if we have qxt network lib
# if QT_NETWORK_ENABLED
# EXTRA_SRCS = HTTPRemoteControl.cpp
# endif


# TODO: build qprojectM-jack and projectM-jack as separate programs

bin_PROGRAMS = projectM_jack
projectM_jack_SOURCES = qprojectM-jack.cpp ConfigFile.cpp ${EXTRA_SRCS}
projectM_jack_LDADD = \
../projectM-qt/libprojectM_qt.a \
${jack_LIBS} \
${qt_LIBS} \
../libprojectM/libprojectM.la \
-lSDL
projectM_jack_LDFLAGS = -static -fPIC ${qt_LDFLAGS}
projectM_jack_PROGRAM = projectM-jack

dist_man_MANS = projectM-jack.1
Empty file modified src/projectM-jack/make_bundle.sh
100644 → 100755
Empty file.
3 changes: 1 addition & 2 deletions src/projectM-jack/projectM-jack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>

#include <jack/jack.h>

Expand Down Expand Up @@ -384,5 +385,3 @@ int main( int argc, char **argv ) {

return 1;
}


Empty file modified src/projectM-jack/video_init.cpp
100755 → 100644
Empty file.
Empty file modified src/projectM-jack/video_init.h
100755 → 100644
Empty file.
14 changes: 7 additions & 7 deletions src/projectM-pulseaudio/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ projectM_pulseaudio_qtheaders = \
nodist_projectM_pulseaudio_moc_sources = $(projectM_pulseaudio_qtheaders:.hpp=_moc.cpp)

.hpp_moc.cpp:
@MOC@ -o$@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(MOC_CPPFLAGS)\
$(qt_CPPFLAGS) $(qt_LDFLAGS) $(qt_LIBS) $<
@MOC@ -o$@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(MOC_CPPFLAGS) $<

ui_PulseDeviceChooserDialog.h: PulseDeviceChooserDialog.ui
@UIC@ -o $@ $<
Expand All @@ -21,8 +20,9 @@ AM_CPPFLAGS = \
-I${top_srcdir}/src/libprojectM \
-I${top_srcdir}/src/libprojectM/Renderer \
-I${top_srcdir}/src/projectM-qt \
${QT_CFLAGS} \
${LIBPULSE_CFLAGS} \
${qt_CFLAGS} \
${qt_CPPFLAGS} \
${libpulse_CFLAGS} \
-fPIC

AM_CFLAGS = ${my_CFLAGS} \
Expand All @@ -44,12 +44,12 @@ nodist_projectM_pulseaudio_SOURCES = \
$(nodist_projectM_pulseaudio_moc_sources)

projectM_pulseaudio_LDADD = \
${LIBPULSE_LIBS} \
${libpulse_LIBS} \
../projectM-qt/libprojectM_qt.a \
../libprojectM/libprojectM.la \
${QT_LIBS}
${qt_LIBS}

projectM_pulseaudio_LDFLAGS = -static
projectM_pulseaudio_LDFLAGS = -static ${qt_LIBS}

projectM_pulseaudio_PROGRAM = projectM-pulseaudio

Expand Down
Loading

0 comments on commit 5598b83

Please sign in to comment.