From 487c82609cbf24856d4d1254d29aebc837284390 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 30 Dec 2017 23:12:25 +0100 Subject: [PATCH] Make lol-lua an optional dependency. --- build/autotools/m4/lol-conf.m4 | 3 ++- doc/samples/benchsuite.vcxproj | 3 --- doc/samples/btphystest.vcxproj | 3 --- doc/samples/meshviewer/Makefile.am | 2 +- doc/samples/meshviewer/meshviewer.cpp | 2 ++ doc/samples/meshviewer/scenesetup.cpp | 2 ++ doc/samples/nacl_phystest.vcxproj | 3 --- doc/tutorial/01_triangle.vcxproj | 3 --- doc/tutorial/02_cube.vcxproj | 3 --- doc/tutorial/03_noise.vcxproj | 3 --- doc/tutorial/04_texture.vcxproj | 3 --- doc/tutorial/05_easymesh.cpp | 1 + doc/tutorial/06_sprite.vcxproj | 3 --- doc/tutorial/07_input.vcxproj | 3 --- doc/tutorial/08_fbo.vcxproj | 3 --- doc/tutorial/11_fractal.vcxproj | 3 --- doc/tutorial/12_voronoi.vcxproj | 3 --- doc/tutorial/13_shader_builder.vcxproj | 3 --- doc/tutorial/14_lol_lua.cpp | 2 ++ doc/tutorial/15_lolimgui.vcxproj | 3 --- doc/tutorial/Makefile.am | 4 ++-- src/Makefile.am | 1 + src/application/application.cpp | 1 - src/easymesh/easymeshlua.cpp | 1 + src/engine/world.cpp | 3 --- src/engine/world.h | 2 +- src/lol-core.vcxproj | 4 +--- src/lol-core.vcxproj.filter | 3 +++ src/lol/extras.h | 4 ---- src/lol/lua.h | 23 +++++++++++++++++++++++ src/lolua/baselua.cpp | 1 + src/t/test-base.vcxproj | 3 --- src/t/test-entity.vcxproj | 3 --- src/t/test-image.vcxproj | 3 --- src/t/test-math.vcxproj | 3 --- src/t/test-sys.vcxproj | 3 --- 36 files changed, 43 insertions(+), 73 deletions(-) create mode 100644 src/lol/lua.h diff --git a/build/autotools/m4/lol-conf.m4 b/build/autotools/m4/lol-conf.m4 index cbc2ea3f..98e0f183 100644 --- a/build/autotools/m4/lol-conf.m4 +++ b/build/autotools/m4/lol-conf.m4 @@ -244,7 +244,7 @@ LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS" LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS" LOL_DEPS="${LOL_DEPS} \$(lol_builddir)/src/liblol-core.a" LOL_DEPS="${LOL_DEPS} \$(lol_builddir)/src/3rdparty/liblol-bullet.a" -LOL_DEPS="${LOL_DEPS} \$(lol_builddir)/src/3rdparty/liblol-lua.a" +LOL_LUA_DEPS="${LOL_LUA_DEPS} \$(lol_builddir)/src/3rdparty/liblol-lua.a" dnl How to use the Lol Engine inside this tree AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(lol_srcdir)/src" @@ -257,6 +257,7 @@ dnl Extra flags AC_SUBST(LOL_CFLAGS) AC_SUBST(LOL_LIBS) AC_SUBST(LOL_DEPS) +AC_SUBST(LOL_LUA_DEPS) AC_SUBST(AM_CFLAGS) AC_SUBST(AM_CPPFLAGS) diff --git a/doc/samples/benchsuite.vcxproj b/doc/samples/benchsuite.vcxproj index 42992e30..ac7bdded 100644 --- a/doc/samples/benchsuite.vcxproj +++ b/doc/samples/benchsuite.vcxproj @@ -44,9 +44,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {B1E10086-A1DA-401A-834D-969C9DBB5CC1} diff --git a/doc/samples/btphystest.vcxproj b/doc/samples/btphystest.vcxproj index 6166e21f..53ac0edc 100644 --- a/doc/samples/btphystest.vcxproj +++ b/doc/samples/btphystest.vcxproj @@ -54,9 +54,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - diff --git a/doc/samples/meshviewer/Makefile.am b/doc/samples/meshviewer/Makefile.am index 38dd3ec5..6e6bbfb1 100644 --- a/doc/samples/meshviewer/Makefile.am +++ b/doc/samples/meshviewer/Makefile.am @@ -11,7 +11,7 @@ meshviewer_SOURCES = meshviewer.cpp meshviewer.h \ scenesetup.cpp scenesetup.h \ shinymvtexture.lolfx shinyfur.lolfx meshviewer_CPPFLAGS = $(AM_CPPFLAGS) -meshviewer_DEPENDENCIES = @LOL_DEPS@ +meshviewer_DEPENDENCIES = @LOL_DEPS@ @LOL_LUA_DEPS@ meshviewer_LDFLAGS = $(AM_LDFLAGS) if LOL_USE_EMSCRIPTEN meshviewer_LDFLAGS += -s EXPORTED_FUNCTIONS="['_main', '_C_Send']" diff --git a/doc/samples/meshviewer/meshviewer.cpp b/doc/samples/meshviewer/meshviewer.cpp index 30617968..fae9fc18 100644 --- a/doc/samples/meshviewer/meshviewer.cpp +++ b/doc/samples/meshviewer/meshviewer.cpp @@ -18,6 +18,8 @@ #include /* for FLT_MAX */ #include +#include + #include "scenesetup.h" using namespace lol; diff --git a/doc/samples/meshviewer/scenesetup.cpp b/doc/samples/meshviewer/scenesetup.cpp index a86ff561..0249642b 100644 --- a/doc/samples/meshviewer/scenesetup.cpp +++ b/doc/samples/meshviewer/scenesetup.cpp @@ -14,6 +14,8 @@ #endif #include +#include + #include "scenesetup.h" namespace lol diff --git a/doc/samples/nacl_phystest.vcxproj b/doc/samples/nacl_phystest.vcxproj index fbe70154..0173f16b 100644 --- a/doc/samples/nacl_phystest.vcxproj +++ b/doc/samples/nacl_phystest.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - diff --git a/doc/tutorial/01_triangle.vcxproj b/doc/tutorial/01_triangle.vcxproj index a1a3e771..833c8628 100644 --- a/doc/tutorial/01_triangle.vcxproj +++ b/doc/tutorial/01_triangle.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {b92abadc-45be-4cc5-b724-9426053123a1} diff --git a/doc/tutorial/02_cube.vcxproj b/doc/tutorial/02_cube.vcxproj index a57ec540..cd2fdcd8 100644 --- a/doc/tutorial/02_cube.vcxproj +++ b/doc/tutorial/02_cube.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {7b083da2-fe08-4f6d-bfdd-195d5c2783eb} diff --git a/doc/tutorial/03_noise.vcxproj b/doc/tutorial/03_noise.vcxproj index db52b6ca..46f4e6e6 100644 --- a/doc/tutorial/03_noise.vcxproj +++ b/doc/tutorial/03_noise.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {b0a53d75-cbb4-4fdf-93ac-2d12a79ada0e} diff --git a/doc/tutorial/04_texture.vcxproj b/doc/tutorial/04_texture.vcxproj index f45ab57c..b0b2f5a2 100644 --- a/doc/tutorial/04_texture.vcxproj +++ b/doc/tutorial/04_texture.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {834852db-edb6-4fd0-bcf9-45cd01126962} diff --git a/doc/tutorial/05_easymesh.cpp b/doc/tutorial/05_easymesh.cpp index 5e85fd51..d2047995 100644 --- a/doc/tutorial/05_easymesh.cpp +++ b/doc/tutorial/05_easymesh.cpp @@ -16,6 +16,7 @@ #endif #include +#include using namespace lol; diff --git a/doc/tutorial/06_sprite.vcxproj b/doc/tutorial/06_sprite.vcxproj index 70325f72..7af7d357 100644 --- a/doc/tutorial/06_sprite.vcxproj +++ b/doc/tutorial/06_sprite.vcxproj @@ -40,9 +40,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {E05E23A5-67DE-42B5-98A3-E63CCE0CC0AF} diff --git a/doc/tutorial/07_input.vcxproj b/doc/tutorial/07_input.vcxproj index 297bf529..930f8ec1 100644 --- a/doc/tutorial/07_input.vcxproj +++ b/doc/tutorial/07_input.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {572E5B9C-7E19-489C-BD8A-E8401CFBBC47} diff --git a/doc/tutorial/08_fbo.vcxproj b/doc/tutorial/08_fbo.vcxproj index a299aec1..992031ec 100644 --- a/doc/tutorial/08_fbo.vcxproj +++ b/doc/tutorial/08_fbo.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {BCEE0132-8E24-49BE-AFEB-96DAD14396BA} diff --git a/doc/tutorial/11_fractal.vcxproj b/doc/tutorial/11_fractal.vcxproj index 36ecad7e..53ebed78 100644 --- a/doc/tutorial/11_fractal.vcxproj +++ b/doc/tutorial/11_fractal.vcxproj @@ -43,9 +43,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {6bf81b39-edc2-4227-9992-c2d8abea95af} diff --git a/doc/tutorial/12_voronoi.vcxproj b/doc/tutorial/12_voronoi.vcxproj index 510df1e7..15a890d3 100644 --- a/doc/tutorial/12_voronoi.vcxproj +++ b/doc/tutorial/12_voronoi.vcxproj @@ -47,9 +47,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {6bf81b39-edc2-4227-9982-c2d8abea95af} diff --git a/doc/tutorial/13_shader_builder.vcxproj b/doc/tutorial/13_shader_builder.vcxproj index 417ca273..39b839de 100644 --- a/doc/tutorial/13_shader_builder.vcxproj +++ b/doc/tutorial/13_shader_builder.vcxproj @@ -37,9 +37,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - diff --git a/doc/tutorial/14_lol_lua.cpp b/doc/tutorial/14_lol_lua.cpp index e867cd72..958373ca 100644 --- a/doc/tutorial/14_lol_lua.cpp +++ b/doc/tutorial/14_lol_lua.cpp @@ -15,6 +15,8 @@ #endif #include +#include + #include "loldebug.h" #include diff --git a/doc/tutorial/15_lolimgui.vcxproj b/doc/tutorial/15_lolimgui.vcxproj index 3e48f12a..df1909b0 100644 --- a/doc/tutorial/15_lolimgui.vcxproj +++ b/doc/tutorial/15_lolimgui.vcxproj @@ -37,9 +37,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - diff --git a/doc/tutorial/Makefile.am b/doc/tutorial/Makefile.am index b2540453..faffa9bb 100644 --- a/doc/tutorial/Makefile.am +++ b/doc/tutorial/Makefile.am @@ -31,7 +31,7 @@ tutorials += 16_movie 05_easymesh_SOURCES = 05_easymesh.cpp 05_easymesh_CPPFLAGS = $(AM_CPPFLAGS) -05_easymesh_DEPENDENCIES = @LOL_DEPS@ +05_easymesh_DEPENDENCIES = @LOL_DEPS@ @LOL_LUA_DEPS@ 06_sprite_SOURCES = 06_sprite.cpp 06_sprite.png 06_sprite_CPPFLAGS = $(AM_CPPFLAGS) @@ -69,7 +69,7 @@ endif 14_lol_lua_SOURCES = 14_lol_lua.cpp 14_lol_lua_CPPFLAGS = $(AM_CPPFLAGS) -14_lol_lua_DEPENDENCIES = @LOL_DEPS@ +14_lol_lua_DEPENDENCIES = @LOL_DEPS@ @LOL_LUA_DEPS@ 15_lolimgui_SOURCES = 15_lolimgui.cpp 15_lolimgui_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/src/Makefile.am b/src/Makefile.am index 66038e5a..a967375d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,6 +31,7 @@ liblol_core_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/3rdparty/bullet3/src -I$(src liblol_core_headers = \ lol/engine-internal.h lol/engine.h lol/public.h lol/extras.h lol/legacy.h \ + lol/lua.h \ \ lol/base/all.h \ lol/base/avl_tree.h lol/base/features.h lol/base/tuple.h lol/base/types.h \ diff --git a/src/application/application.cpp b/src/application/application.cpp index 0f3c9893..ff2b87fc 100644 --- a/src/application/application.cpp +++ b/src/application/application.cpp @@ -176,7 +176,6 @@ Application::Application(char const *name, ivec2 resolution, float framerate) { SceneDisplay::Add(new ApplicationDisplay(name, resolution)); data = new ApplicationData(name, resolution, framerate); - g_world.ExecLuaFile("lua/init.lua"); } bool Application::MustTick() diff --git a/src/easymesh/easymeshlua.cpp b/src/easymesh/easymeshlua.cpp index 7df4cc71..30752f84 100644 --- a/src/easymesh/easymeshlua.cpp +++ b/src/easymesh/easymeshlua.cpp @@ -17,6 +17,7 @@ #include #include +#include #include "loldebug.h" using namespace lol; diff --git a/src/engine/world.cpp b/src/engine/world.cpp index 65d146a9..2952015a 100644 --- a/src/engine/world.cpp +++ b/src/engine/world.cpp @@ -24,7 +24,6 @@ namespace lol class WorldData { friend class World; - lua_State *m_lua_state; }; static WorldData g_world_data; @@ -35,9 +34,7 @@ World g_world; */ World::World() - : LuaLoader() { - g_world_data.m_lua_state = GetLuaState(); } World::~World() diff --git a/src/engine/world.h b/src/engine/world.h index 3ea00c6f..4389e19a 100644 --- a/src/engine/world.h +++ b/src/engine/world.h @@ -18,7 +18,7 @@ namespace lol { -class World : public LuaLoader +class World { public: World(); diff --git a/src/lol-core.vcxproj b/src/lol-core.vcxproj index 5d134ad7..89d4bc9d 100644 --- a/src/lol-core.vcxproj +++ b/src/lol-core.vcxproj @@ -292,6 +292,7 @@ + @@ -400,9 +401,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - diff --git a/src/lol-core.vcxproj.filter b/src/lol-core.vcxproj.filter index 9e450607..4bebcf9e 100644 --- a/src/lol-core.vcxproj.filter +++ b/src/lol-core.vcxproj.filter @@ -505,6 +505,9 @@ lol + + lol + lol diff --git a/src/lol/extras.h b/src/lol/extras.h index 4a678055..3fd90528 100644 --- a/src/lol/extras.h +++ b/src/lol/extras.h @@ -20,9 +20,6 @@ #include #include -// Lua -#include - // Static classes #include #include @@ -59,7 +56,6 @@ #include #include #include -#include // Managers #include diff --git a/src/lol/lua.h b/src/lol/lua.h new file mode 100644 index 00000000..da06649e --- /dev/null +++ b/src/lol/lua.h @@ -0,0 +1,23 @@ +// +// Lol Engine +// +// Copyright © 2010—2017 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#pragma once + +// +// Lua subsystem +// ------------- +// + +// Lua +#include +#include + diff --git a/src/lolua/baselua.cpp b/src/lolua/baselua.cpp index 082d85c2..d1726472 100644 --- a/src/lolua/baselua.cpp +++ b/src/lolua/baselua.cpp @@ -12,6 +12,7 @@ // #include +#include #include #include diff --git a/src/t/test-base.vcxproj b/src/t/test-base.vcxproj index be6e8d07..7f8b9a18 100644 --- a/src/t/test-base.vcxproj +++ b/src/t/test-base.vcxproj @@ -45,9 +45,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {8f59a635-0240-4d7f-a80d-050c3f1670c2} diff --git a/src/t/test-entity.vcxproj b/src/t/test-entity.vcxproj index 1abb1eb6..ef6be401 100644 --- a/src/t/test-entity.vcxproj +++ b/src/t/test-entity.vcxproj @@ -41,9 +41,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {d7f6c2ca-5a13-4fd0-8468-1833923e3ee3} diff --git a/src/t/test-image.vcxproj b/src/t/test-image.vcxproj index 61d3ba4c..b2c39074 100644 --- a/src/t/test-image.vcxproj +++ b/src/t/test-image.vcxproj @@ -42,9 +42,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {5a27ff18-a1ec-49be-9455-415f1c701153} diff --git a/src/t/test-math.vcxproj b/src/t/test-math.vcxproj index 7b4ccbb2..c3af3170 100644 --- a/src/t/test-math.vcxproj +++ b/src/t/test-math.vcxproj @@ -58,9 +58,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {962d4e25-45d3-4ace-8c02-69fa3713abd4} diff --git a/src/t/test-sys.vcxproj b/src/t/test-sys.vcxproj index 115038a0..80fcd3c9 100644 --- a/src/t/test-sys.vcxproj +++ b/src/t/test-sys.vcxproj @@ -41,9 +41,6 @@ {83d3b207-c601-4025-8f41-01dedc354661} - - {d84021ca-b233-4e0f-8a52-071b83bbccc4} - {1782f849-b6e1-466d-9f02-a751f3f8712c}