mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Apply the love-experiment moduleselect branch
You can now: - Enable and disable love's modules, implementations and libraries using configure switches - Use pkg-config for a couple of love's requirements - Build on OSX - Use newer versions of FreeType2 - Get a slightly better error message using automagic
This commit is contained in:
@@ -27,10 +27,12 @@ AUTOMAKE=$(which automake)
|
||||
[[ -x ${AUTOMAKE} ]] || die "Could not find automake."
|
||||
|
||||
automagic() {
|
||||
log "Copying files..." >&2
|
||||
cp platform/unix/configure.ac .
|
||||
cp platform/unix/Makefile.am .
|
||||
|
||||
if ! sh platform/unix/gen-makefile; then
|
||||
log "Running genmodules..." >&2
|
||||
if ! bash platform/unix/genmodules "$1"; then
|
||||
echo "You should be doing this from the root directory of the project."
|
||||
exit 1
|
||||
fi
|
||||
@@ -52,12 +54,15 @@ automagic() {
|
||||
}
|
||||
|
||||
if [[ $1 == "-d" ]]; then
|
||||
automagic 2>&1
|
||||
shift 1
|
||||
automagic "$@" 2>&1
|
||||
else
|
||||
(automagic > /dev/null) 2>&1
|
||||
(automagic "$@" > /dev/null) 2>&1
|
||||
fi
|
||||
if [[ $? -eq 1 ]]; then
|
||||
log "Failed, please contact the developers."
|
||||
log "Failed, sadface."
|
||||
log "You can make this script more verbose running it in debug mode (-d)"
|
||||
log "This is generally a configuration error (I'm looking at you aclocal)"
|
||||
exit 1
|
||||
else
|
||||
log "Success, carry on configuring."
|
||||
|
||||
+42
-16
@@ -12,6 +12,7 @@ AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_SED
|
||||
AC_PROG_MKDIR_P
|
||||
AC_PROG_OBJCXX
|
||||
AC_C_BIGENDIAN
|
||||
AC_LANG([C++])
|
||||
|
||||
@@ -32,33 +33,55 @@ ACLOVE_CXX_FLAG_TEST([-std=c++0x], cxx11name="c++0x", [])
|
||||
ACLOVE_CXX_FLAG_TEST([-std=c++11], cxx11name="c++11", [])
|
||||
AS_VAR_IF([cxx11name], [no], AC_MSG_ERROR([Can't LÖVE without C++11]), CXXFLAGS="$CXXFLAGS -std=$cxx11name")
|
||||
|
||||
# Allow people on OSX to use autotools, they need their platform files
|
||||
AC_ARG_ENABLE([osx],
|
||||
AC_HELP_STRING([--enable-osx], [Compile platform-specific files for OSX]), [], [enable_osx=no])
|
||||
AS_VAR_IF([enable_osx], [no], [], #else
|
||||
ac_cv_search_glLoadIdentity="-framework OpenGL"
|
||||
AC_SUBST([LDFLAGS], ["${LDFLAGS} -framework CoreFoundation -framework Cocoa"])
|
||||
AC_SUBST([CPPFLAGS], ["${CPPFLAGS} -I../platform/macosx"]))
|
||||
|
||||
# --with-lua and --with-luaversion
|
||||
AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
|
||||
[], [with_lua=lua])
|
||||
AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
|
||||
[], [with_luaversion=5.1])
|
||||
|
||||
# pkg-config
|
||||
PKG_CHECK_MODULES([lua], [${with_lua}${with_luaversion}], [lua_found=yes],
|
||||
[PKG_CHECK_MODULES([lua], [${with_lua}], [lua_found=yes], [lua_found=no])])
|
||||
PKG_CHECK_MODULES([freetype2], [freetype2], [], AC_MSG_ERROR([Can't LÖVE without FreeType2]))
|
||||
AM_PATH_SDL2([], [], AC_MSG_ERROR([Can't LÖVE without SDL 2]))
|
||||
|
||||
# Libraries
|
||||
AC_SEARCH_LIBS([sqrt], [m], [], AC_MSG_ERROR([Can't LÖVE without C math library]))
|
||||
AC_SEARCH_LIBS([glLoadIdentity], [GL], [], AC_MSG_ERROR([Can't LÖVE without OpenGL]))
|
||||
AC_SEARCH_LIBS([alSourcePlay], [openal], [], AC_MSG_ERROR([Can't LÖVE without OpenAL]))
|
||||
AC_SEARCH_LIBS([ilInit], [IL], [], AC_MSG_ERROR([Can't LÖVE without DevIL]))
|
||||
AC_SEARCH_LIBS([FT_Load_Glyph], [freetype], [], AC_MSG_ERROR([Can't LÖVE without FreeType]))
|
||||
AC_SEARCH_LIBS([PHYSFS_init], [physfs], [], AC_MSG_ERROR([Can't LÖVE without PhysicsFS]))
|
||||
AC_SEARCH_LIBS([ModPlug_Load], [modplug], [], AC_MSG_ERROR([Can't LÖVE without ModPlug]))
|
||||
AC_SEARCH_LIBS([ov_open], [vorbisfile], [], AC_MSG_ERROR([Can't LÖVE without VorbisFile]))
|
||||
|
||||
# Includes
|
||||
AC_CHECK_HEADER([freetype2/freetype/config/ftheader.h], [includes="$includes -I/usr/include/freetype2"])
|
||||
|
||||
# SDL 2, treated seperately because it combines setting SDL2_LIBS and SDL2_CFLAGS into one step
|
||||
AM_PATH_SDL2([], [], AC_MSG_ERROR([Can't LÖVE without SDL 2]))
|
||||
AC_SEARCH_LIBS([glLoadIdentity], [GL], [], AC_MSG_ERROR([Can't LÖVE without OpenGL]))
|
||||
|
||||
# Lua, treated seperately because of --with-lua
|
||||
AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
|
||||
[], [with_lua=lua])
|
||||
AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
|
||||
[], [with_luaversion=5.1])
|
||||
|
||||
AS_VAR_IF([with_luaversion], [5.2], [luatest=lua_version], [luatest=lua_pcall]) # use lua_version for 5.2
|
||||
AC_SEARCH_LIBS([$luatest], ["${with_lua}${with_luaversion}" "${with_lua}"], [],
|
||||
AC_MSG_ERROR([Can't LÖVE without $with_lua]))
|
||||
AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], [])
|
||||
AC_CHECK_HEADER(["${with_lua}/lua.h"], [includes="$includes -I/usr/include/${with_lua}"], [])
|
||||
AS_VAR_IF([lua_found], [yes],
|
||||
#if
|
||||
[
|
||||
luaheaders_found=yes
|
||||
AC_MSG_CHECKING([for library containing ${luatest}])
|
||||
AC_MSG_RESULT([${lua_LIBS}])],
|
||||
#else
|
||||
[
|
||||
AC_MSG_WARN([Could not find pkg-config definition for ${with_lua}${with_luaversion} or ${with_lua}, falling back to manual detection])
|
||||
AC_SEARCH_LIBS([$luatest], ["${with_lua}${with_luaversion}" "${with_lua}"], [],
|
||||
AC_MSG_ERROR([Can't LÖVE without $with_lua]))
|
||||
luaheaders_found=no
|
||||
AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], [])
|
||||
AC_CHECK_HEADER(["${with_lua}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}"], [])])
|
||||
AS_VAR_IF([luaheaders_found], [yes], [], #else
|
||||
[
|
||||
AC_MSG_WARN([Could not locate lua headers for ${with_lua}${with_luaversion} or ${with_lua}, you probably need to specify them with CPPFLAGS])])
|
||||
|
||||
# mpg123, treated seperately because it can be disabled (default on)
|
||||
AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
|
||||
@@ -93,10 +116,13 @@ AS_VAR_IF([enable_exe], [no], [], #else
|
||||
|
||||
AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
|
||||
AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" == xno])
|
||||
AM_CONDITIONAL([LOVE_TARGET_OSX], [test "x$enable_osx" != xno])
|
||||
|
||||
# Set our includes as automake variable
|
||||
AC_SUBST([LOVE_INCLUDES], ["$includes"])
|
||||
|
||||
m4_include([configure-modules.ac])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#!/bin/bash
|
||||
echo Generating src/Makefile.am ...
|
||||
cd src
|
||||
inc_current='$(srcdir)'
|
||||
inc_modules="$inc_current/modules"
|
||||
inc_libraries="$inc_current/libraries"
|
||||
|
||||
cat > Makefile.am << EOF
|
||||
cat > src/Makefile.am << EOF
|
||||
AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/enet/libenet/include \$(LOVE_INCLUDES) \$(FILE_OFFSET)
|
||||
AM_CXXFLAGS = \$(SDL_CFLAGS)
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
@@ -29,20 +28,11 @@ endif
|
||||
# libLÖVE
|
||||
lib_LTLIBRARIES = liblove.la
|
||||
liblove_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS) \$(SDL_LIBS)
|
||||
liblove_la_SOURCES = \\
|
||||
EOF
|
||||
|
||||
find . \( \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.h" -o -iname "*.lch" \) \) -exec echo '{}' \\ \; \
|
||||
| grep -v -f"../platform/unix/exclude" | head -c -3 >> Makefile.am
|
||||
platform/unix/genmodules >> src/Makefile.am
|
||||
|
||||
printf "\n\n" >> Makefile.am
|
||||
cat >> Makefile.am << EOF
|
||||
if !LOVE_NOMPG123
|
||||
liblove_la_SOURCES += \\
|
||||
./modules/sound/lullaby/Mpg123Decoder.cpp \\
|
||||
./modules/sound/lullaby/Mpg123Decoder.h
|
||||
endif
|
||||
EOF
|
||||
printf "\n" >> src/Makefile.am
|
||||
|
||||
cd ..
|
||||
echo "src/Makefile.am is updated! ^.^"
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
#!/bin/bash
|
||||
|
||||
love_suffix="$1"
|
||||
|
||||
flags=""
|
||||
upper()
|
||||
{
|
||||
echo "$@" | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
implfind()
|
||||
{
|
||||
find "$1" -maxdepth 1 -type d -exec basename '{}' \; | grep -v "^\." | tail -n +2
|
||||
}
|
||||
|
||||
sourcefind()
|
||||
{
|
||||
find "$1" $2 -type f \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.h" -o -iname "*.lch" \) | awk "{print \"./$prefix\"\$0\" \\\\\"}" | grep -v -f"$LOVEROOT/platform/unix/exclude"
|
||||
}
|
||||
|
||||
handlemodule()
|
||||
{
|
||||
module="$1"
|
||||
DEFINENAME="LOVE_MODULE_$(upper "$module")"
|
||||
printf "$DEFINENAME"
|
||||
}
|
||||
|
||||
handleimpl()
|
||||
{
|
||||
module="$1"
|
||||
implementation="$2"
|
||||
name="$3"
|
||||
|
||||
printf "if $name\n"
|
||||
FILES="$(sourcefind "$module/$implementation" | sed "s/^/ /")"
|
||||
if [[ "x$FILES" != "x" ]]; then
|
||||
printf "liblove${love_suffix}_la_SOURCES += \\\\\n"
|
||||
printf "${FILES:0:${#FILES}-2}\n"
|
||||
fi
|
||||
printf "endif\n\n"
|
||||
}
|
||||
|
||||
genmodules()
|
||||
{
|
||||
LOVEROOT="$(pwd)"
|
||||
cd src
|
||||
|
||||
printf "liblove${love_suffix}_la_SOURCES = \\\\\n"
|
||||
sourcefind "common" | sed "s/^/ /"
|
||||
FILES="$(sourcefind "scripts" | sed "s/^/ /")"
|
||||
printf "${FILES:0:${#FILES}-2}\n\n"
|
||||
|
||||
cd modules
|
||||
prefix="modules/"
|
||||
for module in *; do
|
||||
NAME=$(handlemodule "$module")
|
||||
flags="$flags module-$module"
|
||||
|
||||
printf "if $NAME\n"
|
||||
|
||||
for implementation in $(implfind "$module"); do
|
||||
flags="$flags implementation-$module-$implementation"
|
||||
handleimpl "$module" "$implementation" "LOVE_IMPLEMENTATION_$(upper "$module")_$(upper "$implementation")"
|
||||
done
|
||||
|
||||
FILES="$(sourcefind "$module" "-maxdepth 1" | sed "s/^/ /")"
|
||||
if [[ "x$FILES" != "x" ]]; then
|
||||
printf "liblove${love_suffix}_la_SOURCES += \\\\\n"
|
||||
printf "${FILES:0:${#FILES}-2}\n"
|
||||
fi
|
||||
|
||||
printf "endif\n\n"
|
||||
done
|
||||
|
||||
cd ../libraries
|
||||
prefix="libraries/"
|
||||
for library in *; do
|
||||
NAME="LOVE_LIBRARY_$(upper "$library")"
|
||||
flags="$flags library-$library"
|
||||
|
||||
printf "if $NAME\n"
|
||||
printf "liblove${love_suffix}_la_SOURCES += \\\\\n"
|
||||
FILES="$(sourcefind "$library" | sed "s/^/ /")"
|
||||
printf "${FILES:0:${#FILES}-2}\nendif\n\n"
|
||||
done
|
||||
cd ../..
|
||||
}
|
||||
|
||||
genflags()
|
||||
{
|
||||
for flag in $flags; do
|
||||
prettyflag="$(echo "$flag" | sed 's/-/ love./' | sed 's/-/./g')"
|
||||
varflag="enable_$(echo "$flag" | sed 's/^[^-]*-//' | sed 's/[^a-zA-Z0-9]/_/')"
|
||||
defineflag="LOVE_ENABLE_$(upper $(echo $flag | sed 's/^[^-]*-//' | sed 's/-/_/g'))"
|
||||
amflag="$(upper $(echo love-$flag | sed 's/-/_/g'))"
|
||||
printf "AC_ARG_ENABLE([$flag], [ --disable-$flag Turn off $prettyflag], [], [$varflag=true])\n"
|
||||
printf "AH_TEMPLATE([$defineflag], [])\n"
|
||||
printf "if test x\"\$$varflag\" == xtrue; then\n"
|
||||
printf " AC_DEFINE([$defineflag], [])\n"
|
||||
printf "fi\n"
|
||||
printf "AM_CONDITIONAL([$amflag], [test x\$$varflag == xtrue])\n\n"
|
||||
done
|
||||
}
|
||||
|
||||
echo Generating src/Makefile.am ...
|
||||
inc_current='$(srcdir)'
|
||||
inc_modules="$inc_current/modules"
|
||||
inc_libraries="$inc_current/libraries"
|
||||
|
||||
cat > src/Makefile.am << EOF
|
||||
AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/enet/libenet/include \$(LOVE_INCLUDES) \$(FILE_OFFSET) \$(SDL_CFLAGS) \$(freetype2_CFLAGS) \$(lua_CFLAGS)
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
SUBDIRS =
|
||||
|
||||
if LOVE_BUILD_EXE
|
||||
# LÖVE executable
|
||||
bin_PROGRAMS = love${love_suffix}
|
||||
#love_LDFLAGS =
|
||||
love${love_suffix}_LDADD = liblove${love_suffix}.la \$(lua_LIBS)
|
||||
love${love_suffix}_SOURCES = love.cpp
|
||||
|
||||
if LOVE_TARGET_OSX
|
||||
love${love_suffix}_LIBTOOLFLAGS = --tag=OBJCXX
|
||||
love${love_suffix}_SOURCES += \\
|
||||
../platform/macosx/OSX.h \\
|
||||
../platform/macosx/OSX.mm
|
||||
else
|
||||
love${love_suffix}_LIBTOOLFLAGS = --tag=CXX
|
||||
endif
|
||||
endif
|
||||
|
||||
# Compile scripts
|
||||
#scripts/%.lua.h: scripts/%.lua
|
||||
# cd scripts; \
|
||||
# lua auto.lua \$*
|
||||
#TODO: Figure out how to only do this on gnu make, and detect which lua
|
||||
# executable to run
|
||||
|
||||
# libLÖVE
|
||||
lib_LTLIBRARIES = liblove${love_suffix}.la
|
||||
liblove${love_suffix}_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS) \$(SDL_LIBS) \$(freetype2_LIBS) \$(lua_LIBS)
|
||||
EOF
|
||||
|
||||
genmodules >> src/Makefile.am
|
||||
|
||||
cat >> src/Makefile.am << EOF
|
||||
if !LOVE_NOMPG123
|
||||
liblove${love_suffix}_la_SOURCES += \\
|
||||
./modules/sound/lullaby/Mpg123Decoder.cpp \\
|
||||
./modules/sound/lullaby/Mpg123Decoder.h
|
||||
endif
|
||||
EOF
|
||||
|
||||
echo "src/Makefile.am is updated! ^.^"
|
||||
|
||||
echo "Generating configure-modules.ac"
|
||||
genflags > configure-modules.ac
|
||||
echo "configure-modules.ac is updated! ^.^"
|
||||
@@ -86,6 +86,47 @@
|
||||
# undef LOVE_BIG_ENDIAN
|
||||
# define LOVE_LITTLE_ENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# define LOVE_ENABLE_AUDIO
|
||||
# define LOVE_ENABLE_AUDIO_NULL
|
||||
# define LOVE_ENABLE_AUDIO_OPENAL
|
||||
# define LOVE_ENABLE_BOX2D
|
||||
# define LOVE_ENABLE_DDSPARSE
|
||||
# define LOVE_ENABLE_ENET
|
||||
# define LOVE_ENABLE_EVENT
|
||||
# define LOVE_ENABLE_EVENT_SDL
|
||||
# define LOVE_ENABLE_FILESYSTEM
|
||||
# define LOVE_ENABLE_FILESYSTEM_PHYSFS
|
||||
# define LOVE_ENABLE_FONT
|
||||
# define LOVE_ENABLE_FONT_FREETYPE
|
||||
# define LOVE_ENABLE_GRAPHICS
|
||||
# define LOVE_ENABLE_GRAPHICS_OPENGL
|
||||
# define LOVE_ENABLE_IMAGE
|
||||
# define LOVE_ENABLE_IMAGE_MAGPIE
|
||||
# define LOVE_ENABLE_JOYSTICK
|
||||
# define LOVE_ENABLE_JOYSTICK_SDL
|
||||
# define LOVE_ENABLE_KEYBOARD
|
||||
# define LOVE_ENABLE_KEYBOARD_SDL
|
||||
# define LOVE_ENABLE_LOVE
|
||||
# define LOVE_ENABLE_LUASOCKET
|
||||
# define LOVE_ENABLE_MATH
|
||||
# define LOVE_ENABLE_MOUSE
|
||||
# define LOVE_ENABLE_MOUSE_SDL
|
||||
# define LOVE_ENABLE_NOISE1234
|
||||
# define LOVE_ENABLE_PHYSICS
|
||||
# define LOVE_ENABLE_PHYSICS_BOX2D
|
||||
# define LOVE_ENABLE_SOUND
|
||||
# define LOVE_ENABLE_SOUND_LULLABY
|
||||
# define LOVE_ENABLE_SYSTEM
|
||||
# define LOVE_ENABLE_SYSTEM_SDL
|
||||
# define LOVE_ENABLE_THREAD
|
||||
# define LOVE_ENABLE_THREAD_SDL
|
||||
# define LOVE_ENABLE_TIMER
|
||||
# define LOVE_ENABLE_TIMER_SDL
|
||||
# define LOVE_ENABLE_UTF8
|
||||
# define LOVE_ENABLE_WINDOW
|
||||
# define LOVE_ENABLE_WINDOW_SDL
|
||||
# define LOVE_ENABLE_WUFF
|
||||
#endif
|
||||
|
||||
#endif // LOVE_CONFIG_H
|
||||
|
||||
@@ -304,6 +304,7 @@ static const lua_CFunction types[] =
|
||||
|
||||
extern "C" int luaopen_love_audio(lua_State *L)
|
||||
{
|
||||
#ifdef LOVE_ENABLE_AUDIO_OPENAL
|
||||
if (instance == 0)
|
||||
{
|
||||
// Try OpenAL first.
|
||||
@@ -318,7 +319,9 @@ extern "C" int luaopen_love_audio(lua_State *L)
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
#endif
|
||||
|
||||
#ifdef LOVE_ENABLE_AUDIO_NULL
|
||||
if (instance == 0)
|
||||
{
|
||||
// Fall back to nullaudio.
|
||||
@@ -331,6 +334,7 @@ extern "C" int luaopen_love_audio(lua_State *L)
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (instance == 0)
|
||||
return luaL_error(L, "Could not open any audio module.");
|
||||
|
||||
@@ -30,10 +30,8 @@
|
||||
#else
|
||||
#include <ft2build.h>
|
||||
#endif
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
#include <freetype/ftoutln.h>
|
||||
#include <freetype/fttrigon.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -73,4 +71,4 @@ private:
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREETYPE_FONT_H
|
||||
#endif // LOVE_FONT_FREETYPE_FONT_H
|
||||
|
||||
@@ -27,10 +27,8 @@
|
||||
|
||||
// TrueType2
|
||||
#include <ft2build.h>
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
#include <freetype/ftoutln.h>
|
||||
#include <freetype/fttrigon.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -67,4 +65,4 @@ private:
|
||||
} // font
|
||||
} // love
|
||||
|
||||
#endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
#endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
|
||||
|
||||
@@ -37,8 +37,12 @@
|
||||
#endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
|
||||
|
||||
// Libraries.
|
||||
#include "libraries/luasocket/luasocket.h"
|
||||
#include "libraries/enet/lua-enet.h"
|
||||
#ifdef LOVE_ENABLE_LUASOCKET
|
||||
# include "libraries/luasocket/luasocket.h"
|
||||
#endif
|
||||
#ifdef LOVE_ENABLE_ENET
|
||||
# include "libraries/enet/lua-enet.h"
|
||||
#endif
|
||||
|
||||
// Scripts
|
||||
#include "scripts/boot.lua.h"
|
||||
@@ -48,42 +52,106 @@
|
||||
// of addressing implementations directly.
|
||||
extern "C"
|
||||
{
|
||||
#if defined(LOVE_ENABLE_AUDIO)
|
||||
extern int luaopen_love_audio(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_EVENT)
|
||||
extern int luaopen_love_event(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_FILESYSTEM)
|
||||
extern int luaopen_love_filesystem(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_FONT)
|
||||
extern int luaopen_love_font(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_GRAPHICS)
|
||||
extern int luaopen_love_graphics(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_IMAGE)
|
||||
extern int luaopen_love_image(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_JOYSTICK)
|
||||
extern int luaopen_love_joystick(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_KEYBOARD)
|
||||
extern int luaopen_love_keyboard(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_MATH)
|
||||
extern int luaopen_love_math(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_MOUSE)
|
||||
extern int luaopen_love_mouse(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_PHYSICS)
|
||||
extern int luaopen_love_physics(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_SOUND)
|
||||
extern int luaopen_love_sound(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_SYSTEM)
|
||||
extern int luaopen_love_system(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_TIMER)
|
||||
extern int luaopen_love_timer(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_THREAD)
|
||||
extern int luaopen_love_thread(lua_State*);
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_WINDOW)
|
||||
extern int luaopen_love_window(lua_State*);
|
||||
#endif
|
||||
extern int luaopen_love_boot(lua_State*);
|
||||
}
|
||||
|
||||
static const luaL_Reg modules[] = {
|
||||
#if defined(LOVE_ENABLE_AUDIO)
|
||||
{ "love.audio", luaopen_love_audio },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_EVENT)
|
||||
{ "love.event", luaopen_love_event },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_FILESYSTEM)
|
||||
{ "love.filesystem", luaopen_love_filesystem },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_FONT)
|
||||
{ "love.font", luaopen_love_font },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_GRAPHICS)
|
||||
{ "love.graphics", luaopen_love_graphics },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_IMAGE)
|
||||
{ "love.image", luaopen_love_image },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_JOYSTICK)
|
||||
{ "love.joystick", luaopen_love_joystick },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_KEYBOARD)
|
||||
{ "love.keyboard", luaopen_love_keyboard },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_MATH)
|
||||
{ "love.math", luaopen_love_math },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_MOUSE)
|
||||
{ "love.mouse", luaopen_love_mouse },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_PHYSICS)
|
||||
{ "love.physics", luaopen_love_physics },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_SOUND)
|
||||
{ "love.sound", luaopen_love_sound },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_SYSTEM)
|
||||
{ "love.system", luaopen_love_system },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_TIMER)
|
||||
{ "love.timer", luaopen_love_timer },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_THREAD)
|
||||
{ "love.thread", luaopen_love_thread },
|
||||
#endif
|
||||
#if defined(LOVE_ENABLE_WINDOW)
|
||||
{ "love.window", luaopen_love_window },
|
||||
#endif
|
||||
{ "love.boot", luaopen_love_boot },
|
||||
{ 0, 0 }
|
||||
};
|
||||
@@ -152,8 +220,12 @@ int luaopen_love(lua_State * L)
|
||||
love::luax_preload(L, modules[i].func, modules[i].name);
|
||||
}
|
||||
|
||||
#ifdef LOVE_ENABLE_LUASOCKET
|
||||
love::luasocket::__open(L);
|
||||
#endif
|
||||
#ifdef LOVE_ENABLE_ENET
|
||||
love::luax_preload(L, luaopen_enet, "enet");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user