Use autotools to build (#27)

* remove c3d/build

* autotools start

* ignore

* autoreconf? idk

* linux/osx gcc/clang

* no glut, need glew tho

* fix test matrix

* fix linux conditional includes?

* sdl makefile am

* SDL2 m4/autoconf

* idk more m4 crap

* ignore more junk

* ug

* go away idk

* renderer makefile

* fixing SDL's broken-ass sdl2.m4 lol

* progress

* cmake go away

* full autotools build working yay

* autogen script, readme update

* fix linux ifdefs

* stuff

* fix linux -ldl

* mac sdl dep for travis

* whoops

* brewwww

* no osx gcc

* no test

* kinda working linux library build

* travis apt packages

* ignore old SDL2 for travis

* typo

* autogen for osx build readme
This commit is contained in:
Mischa Spiegelmock
2018-02-09 14:25:54 -08:00
committed by GitHub
parent 826c918db1
commit 8eaa232dda
31 changed files with 246 additions and 148 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "build"]
path = build
url = https://github.com/c3d/build.git

View File

@ -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"

View File

@ -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

View File

@ -1,6 +0,0 @@
.PHONY: src
all: src
src:
$(MAKE) -C src

3
Makefile.am Normal file
View File

@ -0,0 +1,3 @@
SUBDIRS=src
EXTRA_DIST=README.md AUTHORS.txt
CLEANFILES=

View File

@ -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

3
autogen.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
autoreconf --install || exit 1

1
build

Submodule build deleted from 7f0436fc27

97
configure.ac Normal file
View File

@ -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}
])

View File

@ -1,9 +0,0 @@
.PHONY: libprojectM SDL
all: libprojectM SDL
libprojectM:
$(MAKE) -C libprojectM
SDL:
$(MAKE) -C projectM-sdl

1
src/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS=libprojectM projectM-sdl

View File

@ -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 <cstdlib>
#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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -16,7 +16,7 @@
#include <sstream>
#include <set>
#ifdef LINUX
#ifdef __linux__
extern "C"
{
#include <errno.h>

View File

@ -9,7 +9,7 @@
#include "win32-dirent.h"
#endif
#ifdef LINUX
#ifdef __linux__
#include <dirent.h>
#endif

View File

@ -49,7 +49,7 @@
#include <windows.h>
#endif /** WIN32 */
#ifdef LINUX
#ifdef __linux__
#ifdef USE_GLES1
#include <GLES/gl.h>
#else

View File

@ -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

View File

@ -6,7 +6,7 @@
*/
#include <iostream>
#ifdef LINUX
#ifdef __linux__
#include <GL/gl.h>
#endif
#ifdef EMSCRIPTEN

View File

@ -31,4 +31,4 @@ void RenderItemMatcher::setMatches
_results.matches.push_back(std::make_pair(lhs_src[i], rhs_src[j]));
}
}
}
}

View File

@ -28,7 +28,7 @@
#endif
#endif /** USE_FTGL */
#ifdef LINUX
#ifdef __linux__
#include <GL/gl.h>
#endif

View File

@ -1,4 +1,4 @@
#ifdef LINUX
#ifdef __linux__
#include <GL/gl.h>
#endif
#ifdef EMSCRIPTEN
@ -21,7 +21,7 @@
#include "win32-dirent.h"
#endif
#ifdef LINUX
#ifdef __linux__
#include <dirent.h>
#endif
#ifdef EMSCRIPTEN

View File

@ -5,7 +5,7 @@
* Author: pete
*/
#ifdef LINUX
#ifdef __linux__
#include <GL/gl.h>
#endif
#ifdef WIN32

View File

@ -30,7 +30,7 @@
#include "timer.h"
#include <iostream>
#ifdef LINUX
#ifdef __linux__
#include "time.h"
#endif
@ -179,7 +179,7 @@ void projectM::readConfig (const std::string & configFile )
( "Smooth Preset Duration", config.read<int>("Smooth Transition Duration", 10));
_settings.presetDuration = config.read<int> ( "Preset Duration", 15 );
#ifdef LINUX
#ifdef __linux__
_settings.presetURL = config.read<string> ( "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<string>
( "Title Font", "/usr/local/share/projectM/fonts/Vera.tff" );
_settings.menuFontURL = config.read<string>

View File

@ -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

View File

@ -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

View File

@ -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