diff --git a/.gitmodules b/.gitmodules index 31a6eb1df..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "build"] - path = build - url = https://github.com/c3d/build.git diff --git a/.travis.yml b/.travis.yml index 267db87fb..99dc99715 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,47 @@ language: cpp -addons: - apt: - packages: - - libsdl2-dev - - libglew-dev - - libftgl-dev - - libsdl2-dev - - libdevil-dev - - g++-7 - sources: - - ubuntu-toolchain-r-test +before_script: ./autogen.sh +before_install: + - eval "${MATRIX_EVAL}" -script: CC_STD=g++-7 CXX_STD=g++-7 make -j4 +script: ./configure && make -j8 + +# test on GCC and Clang +matrix: + include: + # linux/clang + - os: linux + addons: + apt: + sources: + - llvm-toolchain-trusty-5.0 + packages: + - clang-5.0 + - libsdl2-dev + - libglew-dev + - libftgl-dev + - libsdl2-dev + - libdevil-dev + env: + - MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0" + # linux/gcc + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + - libsdl2-dev + - libglew-dev + - libftgl-dev + - libsdl2-dev + - libdevil-dev + env: + - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" + + # osx/xcode/clang + - os: osx + osx_image: xcode8 + env: + - MATRIX_EVAL="brew update && brew install sdl2" diff --git a/BUILDING_OSX.txt b/BUILDING_OSX.txt index 7d2d93075..f93b88d7d 100644 --- a/BUILDING_OSX.txt +++ b/BUILDING_OSX.txt @@ -21,5 +21,5 @@ make -j4 Download & install SDL: https://www.libsdl.org/release/SDL2-2.0.7.dmg -5. -make +5. configure and build +./autogen.sh && ./configure && make diff --git a/Makefile b/Makefile deleted file mode 100644 index 1f7888560..000000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -.PHONY: src - -all: src - -src: - $(MAKE) -C src \ No newline at end of file diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000000000..7f0afa96d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS=src +EXTRA_DIST=README.md AUTHORS.txt +CLEANFILES= diff --git a/README.md b/README.md index 656923b69..c8c4b59c5 100644 --- a/README.md +++ b/README.md @@ -50,14 +50,12 @@ Helix * [OSX Build instructions](https://github.com/projectM-visualizer/projectm/raw/master/BUILDING_OSX.txt) ## Linux -* `sudo apt-get install libsdl2-dev libglew-dev libftgl-dev libsdl2-dev libdevil-dev` +* `sudo apt-get install autoconf libtool libsdl2-dev libglew-dev libftgl-dev libsdl2-dev libdevil-dev` -## Building From Source -* Uses [build](https://github.com/c3d/build) Make scripts -* Binaries are in `build/obj` -* Symlink `presets` to the same directory as the binary +## Building From Source Clone ``` -make +./autogen.sh +./configure && make && sudo make install ``` # Using the library diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 000000000..bbb40083d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +autoreconf --install || exit 1 diff --git a/build b/build deleted file mode 160000 index 7f0436fc2..000000000 --- a/build +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7f0436fc2765649af4c564f1daf5380e8969e9c1 diff --git a/configure.ac b/configure.ac new file mode 100644 index 000000000..74d58744a --- /dev/null +++ b/configure.ac @@ -0,0 +1,97 @@ +AC_INIT([projectM], [1], [mischa@mvstg.biz], [https://github.com/revmischa/projectm]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects]) + +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +LT_INIT + +AC_PROG_CXX + +AC_CONFIG_MACRO_DIRS([m4 m4/autoconf-archive]) +m4_include([m4/sdl2.m4]) +AX_CHECK_GL + +AC_CHECK_LIB(c, dlopen, LIBDL="", AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")) + +dnl Check for SDL +SDL_VERSION=2.0.5 +AS_IF([test "$TRAVIS"], [SDL_VERSION=2.0.2]) # travis has old SDL, we don't care +AM_PATH_SDL2($SDL_VERSION, :, AC_MSG_WARN([*** SDL version $SDL_VERSION not found!])) + +AC_CONFIG_HEADERS([config.h]) + +AC_CONFIG_FILES([ + Makefile + src/Makefile + src/libprojectM/Makefile + src/libprojectM/Renderer/Makefile + src/libprojectM/NativePresetFactory/Makefile + src/libprojectM/MilkdropPresetFactory/Makefile + src/projectM-sdl/Makefile +]) + +AC_PREFIX_DEFAULT([/usr]) + +AC_PROG_MKDIR_P + +AC_ARG_ENABLE([logging], +AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), +[], enable_logging=yes) +AS_IF([test "x$enable_logging" = "xyes"], [ +AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) +]) + +AC_ARG_ENABLE([debug], +AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), +[], [enable_debug=no]) +AS_IF([test "x$enable_debug" = "xyes"], [ +AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) +]) + +my_CFLAGS="\ +-Wall \ +-Wchar-subscripts \ +-Wformat-security \ +-Wmissing-declarations \ +-Wpointer-arith \ +-Wshadow \ +-Wsign-compare \ +-Wtype-limits \ +" +AC_SUBST([my_CFLAGS]) + +# check OS +AC_CANONICAL_HOST +AC_MSG_CHECKING("Freedom") +case $host_os in + darwin*) + # OSX needs CoreFoundation + AC_MSG_RESULT("hoarderware detected") + LIBS="$LIBS -framework CoreFoundation" + ;; + linux*) + # limux needs dl + AC_MSG_RESULT("GNU/LINUX") + LIBS="$LIBS -ldl" + ;; +esac + + + +AC_OUTPUT + +AC_MSG_RESULT([ +$PACKAGE $VERSION +===== + +prefix: ${prefix} +sysconfdir: ${sysconfdir} +libdir: ${libdir} +includedir: ${includedir} + +compiler: ${CC} +cflags: ${CFLAGS} +ldflags: ${LDFLAGS} + +logging: ${enable_logging} +debug: ${enable_debug} +]) diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index f69bbc73f..000000000 --- a/src/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: libprojectM SDL - -all: libprojectM SDL - -libprojectM: - $(MAKE) -C libprojectM - -SDL: - $(MAKE) -C projectM-sdl diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 000000000..701e040df --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=libprojectM projectM-sdl diff --git a/src/libprojectM/Common.hpp b/src/libprojectM/Common.hpp index 68a137607..8e2a7547d 100755 --- a/src/libprojectM/Common.hpp +++ b/src/libprojectM/Common.hpp @@ -61,7 +61,7 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode); #define STRING_LINE_SIZE 1024 -#ifdef LINUX +#ifdef __linux__ #include #define projectM_isnan std::isnan #endif @@ -79,7 +79,7 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode); #define projectM_isnan(x) ((x) != (x)) #endif -#ifdef LINUX +#ifdef __linux__ #define projectM_fmax fmax #endif @@ -91,7 +91,7 @@ extern FILE *fmemopen(void *buf, size_t len, const char *pMode); #define projectM_fmax(x,y) ((x) >= (y) ? (x): (y)) #endif -#ifdef LINUX +#ifdef __linux__ #define projectM_fmin fmin #endif diff --git a/src/libprojectM/Makefile b/src/libprojectM/Makefile deleted file mode 100644 index 064bec5e8..000000000 --- a/src/libprojectM/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -BUILD=../../build/ - -SOURCES=projectM.cpp PCM.cpp Preset.cpp fftsg.cpp KeyHandler.cpp \ - timer.cpp wipemalloc.cpp PresetLoader.cpp PresetChooser.cpp \ - PipelineMerger.cpp ConfigFile.cpp \ - TimeKeeper.cpp PresetFactory.cpp PresetFactoryManager.cpp - -CONFIG=libgl - -CPPFLAGS+= -I . -I Renderer -CPPFLAGS_linux=-DLINUX -LDFLAGS+=-lgl -SUBDIRS=Renderer MilkdropPresetFactory NativePresetFactory - -PRODUCTS=libprojectM.lib - -include $(BUILD)rules.mk - -$(BUILD)rules.mk: - cd .. && git submodule update --init --recursive diff --git a/src/libprojectM/Makefile.am b/src/libprojectM/Makefile.am new file mode 100644 index 000000000..097c135f2 --- /dev/null +++ b/src/libprojectM/Makefile.am @@ -0,0 +1,32 @@ +EXTRA_DIST= +CLEANFILES= + +SUBDIRS=Renderer NativePresetFactory MilkdropPresetFactory + +AM_CPPFLAGS = \ +-include $(top_builddir)/config.h \ +-DSYSCONFDIR=\""$(sysconfdir)"\" \ +-I$(top_srcdir)/src/libprojectM \ +-I$(top_srcdir)/src/libprojectM/Renderer + +#lib_LTLIBRARIES = libprojectM.la # public, shared library +noinst_LTLIBRARIES = libprojectM_impl.la # intermediate, static library + +# link libRenderer, MilkdropPresetFactory, NativePresetFactory to intermediate lib +libprojectM_impl_la_LIBADD = \ +$(top_srcdir)/src/libprojectM/MilkdropPresetFactory/libMilkdropPresetFactory.la \ +$(top_srcdir)/src/libprojectM/NativePresetFactory/libNativePresetFactory.la \ +$(top_srcdir)/src/libprojectM/Renderer/libRenderer.la +libprojectM_impl_la_SOURCES = ConfigFile.cpp Preset.cpp PresetLoader.cpp timer.cpp \ + KeyHandler.cpp PresetChooser.cpp TimeKeeper.cpp PCM.cpp PresetFactory.cpp \ + fftsg.cpp wipemalloc.cpp PipelineMerger.cpp PresetFactoryManager.cpp projectM.cpp + +# just put intermediate lib in shared lib +#libprojectM_la_SOURCES = +#libprojectM_la_LIBADD = libprojectM_impl.la + +pkginclude_HEADERS = projectM.hpp +pkgconfigdir = $(libdir)/pkgconfig +# pkgconfig_DATA = src/libprojectM.pc +# EXTRA_DIST += src/libprojectM.pc.in +# CLEANFILES += src/libprojectM.pc diff --git a/src/libprojectM/MilkdropPresetFactory/Makefile b/src/libprojectM/MilkdropPresetFactory/Makefile deleted file mode 100644 index be1a66b67..000000000 --- a/src/libprojectM/MilkdropPresetFactory/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -BUILD=../../../build/ - -SOURCES= \ - BuiltinFuncs.cpp \ - Func.cpp MilkdropPreset.cpp \ - PresetFrameIO.cpp \ - CustomShape.cpp \ - Eval.cpp \ - MilkdropPresetFactory.cpp \ - PerPixelEqn.cpp BuiltinParams.cpp \ - InitCond.cpp Parser.cpp \ - CustomWave.cpp Expr.cpp \ - PerPointEqn.cpp Param.cpp \ - PerFrameEqn.cpp \ - IdlePreset.cpp \ - ../PresetFactory.cpp \ - - -CPPFLAGS+= -I. -I.. -LIBRARIES= -PRODUCTS=MilkdropPresetFactory.lib - -include $(BUILD)rules.mk - -$(BUILD)rules.mk: - cd .. && git submodule update --init --recursive diff --git a/src/libprojectM/MilkdropPresetFactory/Makefile.am b/src/libprojectM/MilkdropPresetFactory/Makefile.am new file mode 100644 index 000000000..b8dff2149 --- /dev/null +++ b/src/libprojectM/MilkdropPresetFactory/Makefile.am @@ -0,0 +1,12 @@ +noinst_LTLIBRARIES=libMilkdropPresetFactory.la + +libMilkdropPresetFactory_la_SOURCES= \ +BuiltinFuncs.cpp Func.cpp BuiltinParams.cpp IdlePreset.cpp Parser.cpp \ +InitCond.cpp PerFrameEqn.cpp CustomShape.cpp \ +PerPixelEqn.cpp CustomWave.cpp MilkdropPreset.cpp PerPointEqn.cpp \ +Eval.cpp MilkdropPresetFactory.cpp PresetFrameIO.cpp \ +Expr.cpp Param.cpp MilkdropPresetFactory.cpp + +libMilkdropPresetFactory_la_CPPFLAGS = ${my_CFLAGS} \ +-I$(top_srcdir)/src/libprojectM + diff --git a/src/libprojectM/NativePresetFactory/Makefile b/src/libprojectM/NativePresetFactory/Makefile deleted file mode 100644 index 79e645684..000000000 --- a/src/libprojectM/NativePresetFactory/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -BUILD=../../../build/ - -SOURCES=NativePresetFactory.cpp -CPPFLAGS+= -I. -I.. -PRODUCTS=NativePresetFactory.lib - -include $(BUILD)rules.mk - -$(BUILD)rules.mk: - cd .. && git submodule update --init --recursive diff --git a/src/libprojectM/NativePresetFactory/Makefile.am b/src/libprojectM/NativePresetFactory/Makefile.am new file mode 100644 index 000000000..e9649e51d --- /dev/null +++ b/src/libprojectM/NativePresetFactory/Makefile.am @@ -0,0 +1,10 @@ +noinst_LTLIBRARIES=libNativePresetFactory.la + +libNativePresetFactory_la_SOURCES= \ + NativePreset.hpp NativePresetFactory.hpp \ + MilkdropCompatability.hpp NativePresetFactory.cpp + +libNativePresetFactory_la_CPPFLAGS = ${my_CFLAGS} \ + -I$(top_srcdir)/src/libprojectM + + diff --git a/src/libprojectM/PresetLoader.cpp b/src/libprojectM/PresetLoader.cpp index f1a276989..4f184ceb9 100644 --- a/src/libprojectM/PresetLoader.cpp +++ b/src/libprojectM/PresetLoader.cpp @@ -16,7 +16,7 @@ #include #include -#ifdef LINUX +#ifdef __linux__ extern "C" { #include diff --git a/src/libprojectM/PresetLoader.hpp b/src/libprojectM/PresetLoader.hpp index 565ec4c05..dea950154 100644 --- a/src/libprojectM/PresetLoader.hpp +++ b/src/libprojectM/PresetLoader.hpp @@ -9,7 +9,7 @@ #include "win32-dirent.h" #endif -#ifdef LINUX +#ifdef __linux__ #include #endif diff --git a/src/libprojectM/Renderer/FBO.hpp b/src/libprojectM/Renderer/FBO.hpp index aa0e30ca4..78f5ac4ce 100755 --- a/src/libprojectM/Renderer/FBO.hpp +++ b/src/libprojectM/Renderer/FBO.hpp @@ -49,7 +49,7 @@ #include #endif /** WIN32 */ -#ifdef LINUX +#ifdef __linux__ #ifdef USE_GLES1 #include #else diff --git a/src/libprojectM/Renderer/Makefile b/src/libprojectM/Renderer/Makefile.am similarity index 56% rename from src/libprojectM/Renderer/Makefile rename to src/libprojectM/Renderer/Makefile.am index ac38e3ddf..7d4cd4327 100644 --- a/src/libprojectM/Renderer/Makefile +++ b/src/libprojectM/Renderer/Makefile.am @@ -1,6 +1,6 @@ -BUILD=../../../build/ +noinst_LTLIBRARIES = libRenderer.la -SOURCES= \ +libRenderer_la_SOURCES = \ SOIL2/image_DXT.c \ SOIL2/image_helper.c \ SOIL2/SOIL2.c \ @@ -22,20 +22,8 @@ SOURCES= \ TextureManager.cpp \ VideoEcho.cpp \ RenderItemDistanceMetric.cpp \ - RenderItemMatcher.cpp \ - ../KeyHandler.cpp + RenderItemMatcher.cpp +libRenderer_la_CPPFLAGS = ${my_CFLAGS} \ +-I$(top_srcdir)/src/libprojectM -CONFIG=libftgl libGL libfreetype - -CPPFLAGS+= -I. -I.. -ISOIL2 -CPPFLAGS_linux=-DLINUX -LDFLAGS+=-lftgl -lgl -lfreetype -lprojectM - -LIBRARIES= -PRODUCTS=Renderer.lib - -include $(BUILD)rules.mk - -$(BUILD)rules.mk: - cd .. && git submodule update --init --recursive diff --git a/src/libprojectM/Renderer/MilkdropWaveform.cpp b/src/libprojectM/Renderer/MilkdropWaveform.cpp index 105b8c242..77144d938 100644 --- a/src/libprojectM/Renderer/MilkdropWaveform.cpp +++ b/src/libprojectM/Renderer/MilkdropWaveform.cpp @@ -6,7 +6,7 @@ */ #include -#ifdef LINUX +#ifdef __linux__ #include #endif #ifdef EMSCRIPTEN diff --git a/src/libprojectM/Renderer/RenderItemMatcher.cpp b/src/libprojectM/Renderer/RenderItemMatcher.cpp index cf107502a..612f118db 100644 --- a/src/libprojectM/Renderer/RenderItemMatcher.cpp +++ b/src/libprojectM/Renderer/RenderItemMatcher.cpp @@ -31,4 +31,4 @@ void RenderItemMatcher::setMatches _results.matches.push_back(std::make_pair(lhs_src[i], rhs_src[j])); } } -} \ No newline at end of file +} diff --git a/src/libprojectM/Renderer/Renderer.hpp b/src/libprojectM/Renderer/Renderer.hpp index ccb9a44ad..437c454f4 100644 --- a/src/libprojectM/Renderer/Renderer.hpp +++ b/src/libprojectM/Renderer/Renderer.hpp @@ -28,7 +28,7 @@ #endif #endif /** USE_FTGL */ -#ifdef LINUX +#ifdef __linux__ #include #endif diff --git a/src/libprojectM/Renderer/TextureManager.cpp b/src/libprojectM/Renderer/TextureManager.cpp index 6034e9417..b017e44ba 100644 --- a/src/libprojectM/Renderer/TextureManager.cpp +++ b/src/libprojectM/Renderer/TextureManager.cpp @@ -1,4 +1,4 @@ -#ifdef LINUX +#ifdef __linux__ #include #endif #ifdef EMSCRIPTEN @@ -21,7 +21,7 @@ #include "win32-dirent.h" #endif -#ifdef LINUX +#ifdef __linux__ #include #endif #ifdef EMSCRIPTEN diff --git a/src/libprojectM/Renderer/Waveform.cpp b/src/libprojectM/Renderer/Waveform.cpp index 4465a0ff6..181e0464b 100644 --- a/src/libprojectM/Renderer/Waveform.cpp +++ b/src/libprojectM/Renderer/Waveform.cpp @@ -5,7 +5,7 @@ * Author: pete */ -#ifdef LINUX +#ifdef __linux__ #include #endif #ifdef WIN32 diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp index 6ff0d291c..130b6be2d 100755 --- a/src/libprojectM/projectM.cpp +++ b/src/libprojectM/projectM.cpp @@ -30,7 +30,7 @@ #include "timer.h" #include -#ifdef LINUX +#ifdef __linux__ #include "time.h" #endif @@ -179,7 +179,7 @@ void projectM::readConfig (const std::string & configFile ) ( "Smooth Preset Duration", config.read("Smooth Transition Duration", 10)); _settings.presetDuration = config.read ( "Preset Duration", 15 ); - #ifdef LINUX + #ifdef __linux__ _settings.presetURL = config.read ( "Preset Path", "/usr/local/share/projectM/presets" ); #endif @@ -199,7 +199,7 @@ void projectM::readConfig (const std::string & configFile ) ( "Menu Font", "../Resources/fonts/VeraMono.ttf"); #endif - #ifdef LINUX + #ifdef __linux__ _settings.titleFontURL = config.read ( "Title Font", "/usr/local/share/projectM/fonts/Vera.tff" ); _settings.menuFontURL = config.read diff --git a/src/projectM-sdl/Makefile b/src/projectM-sdl/Makefile deleted file mode 100644 index e5753ce1d..000000000 --- a/src/projectM-sdl/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -BUILD=../../build/ - -SOURCES= \ - pmSDL.cpp \ - projectM_SDL_main.cpp - -CPPFLAGS+=-I. -I../libprojectM -CPPFLAGS_macosx-clang+=-F/Library/Frameworks - -LDFLAGS_macosx-clang+=-framework OpenGL -F/Library/Frameworks -framework SDL2 -LDFLAGS+=-lGL -ldl -lSDL2 -LIBRARIES=../libprojectM \ - ../libprojectM/NativePresetFactory ../libprojectM/MilkdropPresetFactory ../libprojectM/Renderer - -PRODUCTS=projectMSDL.exe - -include $(BUILD)rules.mk - -$(BUILD)rules.mk: - cd .. && git submodule update --init --recursive diff --git a/src/projectM-sdl/Makefile.am b/src/projectM-sdl/Makefile.am new file mode 100644 index 000000000..b84c419f0 --- /dev/null +++ b/src/projectM-sdl/Makefile.am @@ -0,0 +1,17 @@ +AM_CPPFLAGS = \ +-include $(top_builddir)/config.h \ +-DSYSCONFDIR=\""$(sysconfdir)"\" \ +-I${top_srcdir}/src/libprojectM \ +-I${top_srcdir}/src/libprojectM/Renderer \ +${SDL_CFLAGS} + +AM_CFLAGS = ${my_CFLAGS} \ +-fvisibility=hidden \ +-ffunction-sections \ +-fdata-sections + +bin_PROGRAMS = projectMSDL +projectMSDL_SOURCES = pmSDL.cpp projectM_SDL_main.cpp +projectMSDL_LDADD = ${SDL_LIBS} ${top_srcdir}/src/libprojectM/libprojectM_impl.la +projectMSDL_LDFLAGS = -static +projectMSDL_PROGRAM = projectMSDL diff --git a/src/projectM-sdl/pmSDL.cpp b/src/projectM-sdl/pmSDL.cpp index 0df60e921..030f42a34 100644 --- a/src/projectM-sdl/pmSDL.cpp +++ b/src/projectM-sdl/pmSDL.cpp @@ -141,7 +141,7 @@ void projectMSDL::keyHandler(SDL_Event *sdl_evt) { // handle keyboard input (for our app first, then projectM) switch (sdl_keycode) { case SDLK_f: - if (sdl_mod & KMOD_LGUI || sdl_mod & KMOD_RGUI) { + if (sdl_mod & KMOD_LGUI || sdl_mod & KMOD_RGUI || sdl_mod & KMOD_LCTRL) { // command-f: fullscreen toggleFullScreen(); return; // handled