Skip to content

Commit

Permalink
BUILD: Allow disabling individual engines with automake
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 authored and DrMcCoy committed Jan 12, 2019
1 parent 4db1283 commit 4d1cbb9
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 10 deletions.
26 changes: 26 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,30 @@ dnl pthread
AX_PTHREAD()
AM_CONDITIONAL([HAVE_PTHREAD], [test x"$ax_pthread_ok" = xyes])

AC_DEFUN([AX_ADD_ENGINE], [
AC_ARG_ENABLE([$1], [AS_HELP_STRING([--disable-$1], [Disable building with support for $3 @<:@default=no@:>@])], [], [enable_$1=yes])
if test "x$enable_$1" = "xyes"; then
AC_DEFINE([ENABLE_$2], 1, [Defined to 1 if we are building with support for $3])
AM_CONDITIONAL(ENABLE_$2, true)
ENGINE_SUMMARY="$ENGINE_SUMMARY
$3: yes"
else
AM_CONDITIONAL(ENABLE_$2, false)
ENGINE_SUMMARY="$ENGINE_SUMMARY
$3: no"
fi
])

AX_ADD_ENGINE([nwn], [NWN], [Neverwinter Nights], [])
AX_ADD_ENGINE([nwn2], [NWN2], [Neverwinter Nights 2], [])
AX_ADD_ENGINE([kotor], [KOTOR], [Star Wars: Knights of the Old Republic], [lzma])
AX_ADD_ENGINE([kotor2], [KOTOR2], [Star Wars: Knights of the Old Republic II: The Sith Lords], [])
AX_ADD_ENGINE([jade], [JADE], [Jade Empire], [])
AX_ADD_ENGINE([witcher], [WITCHER], [The Witcher], [])
AX_ADD_ENGINE([sonic], [SONIC], [Sonic Chronicles: The Dark Brotherhood], [])
AX_ADD_ENGINE([dragonage], [DRAGONAGE], [Dragon Age: Origins], [libxml2])
AX_ADD_ENGINE([dragonage2], [DRAGONAGE2], [Dragon Age II], [libxml2])

dnl Extra flags
case "$target" in
*darwin*)
Expand Down Expand Up @@ -350,6 +374,8 @@ AC_CONFIG_FILES([Makefile])

AC_OUTPUT

AC_MSG_NOTICE([Enabled engines: $ENGINE_SUMMARY])

AC_MSG_NOTICE([Enabled libraries:])
AC_MSG_NOTICE([ libmad: $enable_mad])
AC_MSG_NOTICE([ libvorbis: $enable_vorbis])
Expand Down
36 changes: 36 additions & 0 deletions src/engines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,64 @@

#include "src/engines/engineprobe.h"

#ifdef ENABLE_NWN
#include "src/engines/nwn/probes.h"
#endif
#ifdef ENABLE_NWN2
#include "src/engines/nwn2/probes.h"
#endif
#ifdef ENABLE_KOTOR
#include "src/engines/kotor/probes.h"
#endif
#ifdef ENABLE_KOTOR2
#include "src/engines/kotor2/probes.h"
#endif
#ifdef ENABLE_JADE
#include "src/engines/jade/probes.h"
#endif
#ifdef ENABLE_WITCHER
#include "src/engines/witcher/probes.h"
#endif
#ifdef ENABLE_SONIC
#include "src/engines/sonic/probes.h"
#endif
#ifdef ENABLE_DRAGONAGE
#include "src/engines/dragonage/probes.h"
#endif
#ifdef ENABLE_DRAGONAGE2
#include "src/engines/dragonage2/probes.h"
#endif

#include "src/engines.h"

void createEngineProbes(std::list<const Engines::EngineProbe *> &probes) {
#ifdef ENABLE_NWN
Engines::NWN::createEngineProbes(probes);
#endif
#ifdef ENABLE_NWN2
Engines::NWN2::createEngineProbes(probes);
#endif
#ifdef ENABLE_KOTOR
Engines::KotOR::createEngineProbes(probes);
#endif
#ifdef ENABLE_KOTOR2
Engines::KotOR2::createEngineProbes(probes);
#endif
#ifdef ENABLE_JADE
Engines::Jade::createEngineProbes(probes);
#endif
#ifdef ENABLE_WITCHER
Engines::Witcher::createEngineProbes(probes);
#endif
#ifdef ENABLE_SONIC
Engines::Sonic::createEngineProbes(probes);
#endif
#ifdef ENABLE_DRAGONAGE
Engines::DragonAge::createEngineProbes(probes);
#endif
#ifdef ENABLE_DRAGONAGE2
Engines::DragonAge2::createEngineProbes(probes);
#endif
}

void destroyEngineProbes(std::list<const Engines::EngineProbe *> &probes) {
Expand Down
18 changes: 18 additions & 0 deletions src/engines/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,30 @@ src_engines_libengines_la_LIBADD = \
# Subdirectories

include src/engines/aurora/rules.mk
if ENABLE_NWN
include src/engines/nwn/rules.mk
endif
if ENABLE_NWN2
include src/engines/nwn2/rules.mk
endif
if ENABLE_KOTOR
include src/engines/kotor/rules.mk
endif
if ENABLE_KOTOR2
include src/engines/kotor2/rules.mk
endif
if ENABLE_JADE
include src/engines/jade/rules.mk
endif
if ENABLE_WITCHER
include src/engines/witcher/rules.mk
endif
if ENABLE_SONIC
include src/engines/sonic/rules.mk
endif
if ENABLE_DRAGONAGE
include src/engines/dragonage/rules.mk
endif
if ENABLE_DRAGONAGE2
include src/engines/dragonage2/rules.mk
endif
40 changes: 30 additions & 10 deletions src/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

bin_PROGRAMS += src/xoreos
src_xoreos_SOURCES =
src_xoreos_LDADD =

src_xoreos_SOURCES += \
src/cline.h \
Expand All @@ -41,16 +42,35 @@ if WIN32
src_xoreos_SOURCES += dists/win32/xoreos.rc
endif

src_xoreos_LDADD = \
src/engines/dragonage2/libdragonage2.la \
src/engines/dragonage/libdragonage.la \
src/engines/sonic/libsonic.la \
src/engines/witcher/libwitcher.la \
src/engines/jade/libjade.la \
src/engines/kotor2/libkotor2.la \
src/engines/kotor/libkotor.la \
src/engines/nwn2/libnwn2.la \
src/engines/nwn/libnwn.la \
if ENABLE_DRAGONAGE2
src_xoreos_LDADD += src/engines/dragonage2/libdragonage2.la
endif
if ENABLE_DRAGONAGE2
src_xoreos_LDADD += src/engines/dragonage/libdragonage.la
endif
if ENABLE_SONIC
src_xoreos_LDADD += src/engines/sonic/libsonic.la
endif
if ENABLE_WITCHER
src_xoreos_LDADD += src/engines/witcher/libwitcher.la
endif
if ENABLE_JADE
src_xoreos_LDADD += src/engines/jade/libjade.la
endif
if ENABLE_KOTOR2
src_xoreos_LDADD += src/engines/kotor2/libkotor2.la
endif
if ENABLE_KOTOR
src_xoreos_LDADD += src/engines/kotor/libkotor.la
endif
if ENABLE_NWN2
src_xoreos_LDADD += src/engines/nwn2/libnwn2.la
endif
if ENABLE_NWN
src_xoreos_LDADD += src/engines/nwn/libnwn.la
endif

src_xoreos_LDADD += \
src/engines/libengines.la \
src/events/libevents.la \
src/video/libvideo.la \
Expand Down

0 comments on commit 4d1cbb9

Please sign in to comment.