Permalink
Browse files

New Lua bindings and library (#511)

* Updated setup script

* Removed lua and luabind. Replaced with luajit and sol. Didn't change the code to use it yet

* Added luajit to cmake

* Moved individual script_bindings files' contents to script_initializer

* Changed luabind forward declarations to sol forward declarations

* Now ignoring a bunch of warnings so that sol.hpp can be included

* Started fixing things to use sol, again this time not moving binding methods to a single file

* System wrapper for lua. First few bindings done

* More bindings

* Collision filter fixed. .collisions now returns a table and works a bit differently

* More wrapper updates

* Tried to made wrappers more ready to use default values

* Moving component stuff to use the new lua wrapper

* Fixed some more wrappers

* Hooked up engine to new lua stuff. More basic wrappers

* Possibly not-optimal Component bindings

* Created new compound registry bindings

* Working on final script bindings

Only some Ogre classes haven't been updated yet

* Finished the largest file with new bindings, perhaps could be split

* Thrive main library now compiles. tests still need fixing

* Updated ogre tests, everything now compiles

* Played around a bit with error reporting from lua

* Fixed the first few classes for the new bindings

* Added SystemWrapper bindings

* Added system class creation helper

* Fixing lua scripts for new things

* Engine now more carefully casts things to Systems

* Added a new Bullet physics wrapper

* Started adding Lua replacements of C++ GameState and Engine

* Lua fixes

* Added luabindings for Game

* Removed stuff that is now in lua from the C++ side

* Started moving stuff from C++ to Lua and creating wrappers for C++ code to use

Fixing lua scripts and creating wrappers for C++ to use

* Renamed GameState to GameStateData

* Moved stuff from engine.cpp to lua engine

Also fixed compiling entity.cpp

* Updated to new GameStateData

* C++ now compiles. Lua files are still a mess

* Finished reimplementing the removed c++ stuff in lua

Switched lua classes to use "create" method as a constructor so now
"init" can be used like before

* First Lua systems can now be created without errors

There are still bunch of lua scripts that need fixing

* Updated sol library

* Exposed ComponentWrapper to Lua

* Fixed engine binding things as sol::var when they should have been sol::property

* Fixed Component registering from Lua

* Rewrote microbe ai classes for new sol bindings

* Added notes about changed things

Fixed species_system.lua. There was an improperly formatted function
call in this file, I added an explanation to the notes on how to fix
this

* Lua stacktraces now don't include the top most entry

the entry was always [C]:-1 so it wasn't very helpful

* Fixed Component::TYPE_ID access from Lua

* Removed some old systems code

* Fixed indentation

* Updated examples

* Updated more Lua files to use new classes

* Added missing call to .new on EntityFilter

* Added missing call to ScriptEntityFilter bindings

* The engine now stops loading Lua scripts after the first failed file

* Exposed correct constructor for PowerupSystem

* More fixes to Lua files

* Added cmake argument LUA_CHECKS which enables more lua debug checks

Also the linuxrelease refuses to build if LUA_CHECKS is on

* Updated Entity documentation

* Exposed EntityManager to Lua

* Updated systems to have a proper init method and added base classes to some systems

* Added some lua class checks and some notes about usage

* Rewrote some more Lua scripts to use new classes

* Some random formatting change

* Added get method for current GameState to Engine

* Fixed C++ systems that relied on broken Entity constructors

* Added table call constructors for some Ogre types

* Changed the lua error functions slightly

* Fixed some lua bindings being wrong

* Still fixing lua scripts

* Removed old system that doesn't even work with Ogre 2.0

* Added missing Touchable bases to RigidBodyComponent

* shutdown is now called even if an error occurs

* cleanup

* Replaced entity addComponent luabindings

* C++ components now expose a factory to lua. Also updated entity to accept the factory constructed c++ stuff

* Renamed factory functions to be just 'new'

* Lua fixed class calls

* Added an unwrap function to lua

* Collision shapes now properly use factories to create shared_ptrs

* Components now share a macro for binding common things.

+ Added the component "castFrom" function

* Fixed Microbe not casting accessed Components to their subclasses

* All setup code now runs. But the game crashes just after entering the main loop

* Fixed moving temporary prevents copy elision

* Fixed engine shutdown causing a crash

CEGUIWIndow is now a factory, because probably CEGUI will delete the
window with its parent

GameStateData owning the SceneManager checks is ogre still valid before
destructing

* Formatting change. Main loop now starts

* Fixed reading thrive version when the file was one folder up

* Fixed startup message thrive version

* Exposed rootGuiWindow again

* Added processRemovals to EntityManager Lua bindings

* Exposed paused Engine property to Lua

* Thrive now starts and shows the menu correctly!

* Made FPS counter actually accurate

* Made Game time utilities take things by reference

* Added frame time counting to FPS counter

* Added a convenience getComponent lua function

* Switched fixes to use the new convenience getComponent

* Made Components use cheaper casts when accessed from Lua

* Various lua binding fixes and lua updates to use new classes

* setup now attempts to set LUAJIT_ENABLE_LUA52COMPAT on in luajit makefile

* Fixed microbe spawn function not correctly attempting to spawn a cell

Also removed slightly confusing call constructor that isn't actually
used all that often

* Microbe editor can now be entered

* Added a workaround for crash after loading save

* Fixed container bindings to accept "get" without default value

* Exposed EntityManager methods required for saving/loading

* Restored intro video

* Systems no longer have an enabled property, GameState already manages which ones to run

Fixed saving and loading

* Changed to use the new class syntax

* Everything now mostly work

There's just 3 cells just after splitting

and all the compounds drain out of cells immediately

(and there's a workaround to a crash in restoring sounds after loading
game)

* Fixed bug venting everything

Current bugs:
3 cells spawn after dividing when tutorial is completed and after that
(but not when tutorial is skipped)

If tutorial is complete and the game is started again from the main menu
and the tutorial is skipped the game crashes. Also other way around
works: if you first play normally and then play the tutorial the game
crashes when exiting the editor.

* Fixed including sol directly

* Removed unneeded lua link creation

* Fixed packaging script and included librtmp in releases

* Updated SOL

CEGUIWindow is now a basic usertype, which can be used as an example if
others need to be converted

* Updated CEGUI version

* Added a few more libraries Narotiza mentioned being missing

* Windows support for luajit

* Fixed setup system not being configured to pull updates

* Updated sol to fix compile errors

* Updated CEGUI version

also some cleanup on CEGUIVideoPlayer

* Added option to profile Lua memory usage

* Split some really long lines

* Lua now automatically sets the version number in the GUI

* Removed Cg program manager from CMakeLists and added a better error for missing Ogre plugins

* Removed more references to CgProgramManager plugin

* Added a cscope indexing script

* Added a commented out debugging line

* Fixed Lua errors caused by the earlier merge

also removed some process speed things from bio_process_registry.cpp

* Workaround for compile errors due to disagreement regarding cegui version
  • Loading branch information...
hhyyrylainen committed May 5, 2017
1 parent b92c626 commit 8055e8541bc9ef4ac1c9e58d56d89a1f03513503
Showing with 21,793 additions and 39,215 deletions.
  1. +5 −0 .gitignore
  2. +3 −3 .gitmodules
  3. +59 −45 CMakeLists.txt
  4. +41 −13 SetupThrive.rb
  5. +0 −86 contrib/lua/CMakeLists.txt
  6. +6 −0 contrib/lua/building.txt
  7. +0 −6 contrib/lua/lua/README
  8. +0 −533 contrib/lua/lua/doc/contents.html
  9. BIN contrib/lua/lua/doc/logo.gif
  10. +0 −116 contrib/lua/lua/doc/lua.1
  11. +0 −83 contrib/lua/lua/doc/lua.css
  12. +0 −118 contrib/lua/lua/doc/luac.1
  13. +0 −26 contrib/lua/lua/doc/manual.css
  14. +0 −10,507 contrib/lua/lua/doc/manual.html
  15. BIN contrib/lua/lua/doc/osi-certified-72x60.png
  16. +0 −412 contrib/lua/lua/doc/readme.html
  17. +0 −1,284 contrib/lua/lua/src/lapi.c
  18. +0 −24 contrib/lua/lua/src/lapi.h
  19. +0 −959 contrib/lua/lua/src/lauxlib.c
  20. +0 −212 contrib/lua/lua/src/lauxlib.h
  21. +0 −458 contrib/lua/lua/src/lbaselib.c
  22. +0 −211 contrib/lua/lua/src/lbitlib.c
  23. +0 −881 contrib/lua/lua/src/lcode.c
  24. +0 −83 contrib/lua/lua/src/lcode.h
  25. +0 −155 contrib/lua/lua/src/lcorolib.c
  26. +0 −52 contrib/lua/lua/src/lctype.c
  27. +0 −95 contrib/lua/lua/src/lctype.h
  28. +0 −398 contrib/lua/lua/src/ldblib.c
  29. +0 −580 contrib/lua/lua/src/ldebug.c
  30. +0 −34 contrib/lua/lua/src/ldebug.h
  31. +0 −673 contrib/lua/lua/src/ldo.c
  32. +0 −46 contrib/lua/lua/src/ldo.h
  33. +0 −173 contrib/lua/lua/src/ldump.c
  34. +0 −161 contrib/lua/lua/src/lfunc.c
  35. +0 −33 contrib/lua/lua/src/lfunc.h
  36. +0 −1,213 contrib/lua/lua/src/lgc.c
  37. +0 −157 contrib/lua/lua/src/lgc.h
  38. +0 −67 contrib/lua/lua/src/linit.c
  39. +0 −665 contrib/lua/lua/src/liolib.c
  40. +0 −527 contrib/lua/lua/src/llex.c
  41. +0 −78 contrib/lua/lua/src/llex.h
  42. +0 −309 contrib/lua/lua/src/llimits.h
  43. +0 −279 contrib/lua/lua/src/lmathlib.c
  44. +0 −99 contrib/lua/lua/src/lmem.c
  45. +0 −57 contrib/lua/lua/src/lmem.h
  46. +0 −725 contrib/lua/lua/src/loadlib.c
  47. +0 −287 contrib/lua/lua/src/lobject.c
  48. +0 −607 contrib/lua/lua/src/lobject.h
  49. +0 −107 contrib/lua/lua/src/lopcodes.c
  50. +0 −288 contrib/lua/lua/src/lopcodes.h
  51. +0 −323 contrib/lua/lua/src/loslib.c
  52. +0 −1,638 contrib/lua/lua/src/lparser.c
  53. +0 −119 contrib/lua/lua/src/lparser.h
  54. +0 −322 contrib/lua/lua/src/lstate.c
  55. +0 −228 contrib/lua/lua/src/lstate.h
  56. +0 −185 contrib/lua/lua/src/lstring.c
  57. +0 −46 contrib/lua/lua/src/lstring.h
  58. +0 −1,019 contrib/lua/lua/src/lstrlib.c
  59. +0 −588 contrib/lua/lua/src/ltable.c
  60. +0 −41 contrib/lua/lua/src/ltable.h
  61. +0 −283 contrib/lua/lua/src/ltablib.c
  62. +0 −77 contrib/lua/lua/src/ltm.c
  63. +0 −57 contrib/lua/lua/src/ltm.h
  64. +0 −497 contrib/lua/lua/src/lua.c
  65. +0 −444 contrib/lua/lua/src/lua.h
  66. +0 −9 contrib/lua/lua/src/lua.hpp
  67. +0 −432 contrib/lua/lua/src/luac.c
  68. +0 −551 contrib/lua/lua/src/luaconf.h
  69. +0 −55 contrib/lua/lua/src/lualib.h
  70. +0 −258 contrib/lua/lua/src/lundump.c
  71. +0 −28 contrib/lua/lua/src/lundump.h
  72. +0 −867 contrib/lua/lua/src/lvm.c
  73. +0 −44 contrib/lua/lua/src/lvm.h
  74. +0 −76 contrib/lua/lua/src/lzio.c
  75. +0 −65 contrib/lua/lua/src/lzio.h
  76. +1 −0 contrib/lua/luajit
  77. +14,018 −0 contrib/lua/sol.hpp
  78. +8 −0 contrib/lua/sol_changes.txt
  79. +0 −1 contrib/luabind
  80. +9 −5 cpack/PackageProject.rb
  81. +71 −35 linux_setup/RubySetupSystem.rb
  82. +26 −0 linux_setup/RunCodeIndexing.rb
  83. +19 −41 mingw_setup/boost/install.ps1
  84. +6 −0 mingw_setup/cAudio/install.ps1
  85. +1 −1 mingw_setup/cegui/install.ps1
  86. +50 −0 mingw_setup/luajit/install.ps1
  87. +4 −2 mingw_setup/mingw/install.ps1
  88. +4 −4 mingw_setup/ogre/install.ps1
  89. +1 −0 mingw_setup/ogre_dependencies/install.ps1
  90. +5 −4 mingw_setup/setup.ps1
  91. +101 −0 scripts/class.lua
  92. +3 −2 scripts/colours.lua
  93. +117 −116 scripts/console.lua
  94. +16 −12 scripts/console_commands.lua
  95. +21 −13 scripts/examples/component.lua
  96. +27 −20 scripts/examples/system.lua
  97. +85 −0 scripts/game.lua
  98. +247 −0 scripts/lua_engine/game_state.lua
  99. +10 −10 scripts/{ → lua_engine}/keymap.lua
  100. +460 −0 scripts/lua_engine/lua_engine.lua
  101. +9 −0 scripts/lua_engine/manifest.txt
  102. +63 −0 scripts/lua_engine/system.lua
  103. +178 −0 scripts/lua_notes.md
  104. +89 −58 scripts/main_menu/main_menu_hud.lua
  105. +35 −32 scripts/main_menu/setup.lua
  106. +10 −3 scripts/manifest.txt
  107. +70 −45 scripts/microbe_editor/microbe_editor.lua
  108. +91 −85 scripts/microbe_editor/microbe_editor_hud.lua
  109. +40 −38 scripts/microbe_editor/setup.lua
  110. +26 −24 scripts/microbe_stage/agent_vacuole.lua
  111. +9 −6 scripts/microbe_stage/biome.lua
  112. +17 −14 scripts/microbe_stage/camera.lua
  113. +2 −2 scripts/microbe_stage/configs.lua
  114. +253 −200 scripts/microbe_stage/microbe.lua
  115. +73 −61 scripts/microbe_stage/microbe_ai.lua
  116. +19 −16 scripts/microbe_stage/microbe_control.lua
  117. +52 −21 scripts/microbe_stage/microbe_replacement.lua
  118. +69 −45 scripts/microbe_stage/microbe_stage_hud.lua
  119. +46 −26 scripts/microbe_stage/movement_organelle.lua
  120. +106 −21 scripts/microbe_stage/nucleus_organelle.lua
  121. +79 −69 scripts/microbe_stage/organelle.lua
  122. +35 −14 scripts/microbe_stage/organelle_component.lua
  123. +31 −28 scripts/microbe_stage/patch_system.lua
  124. +20 −18 scripts/microbe_stage/process_organelle.lua
  125. +123 −119 scripts/microbe_stage/setup.lua
  126. +48 −43 scripts/microbe_stage/spawn_system.lua
  127. +71 −63 scripts/microbe_stage/species_system.lua
  128. +22 −19 scripts/microbe_stage/storage_organelle.lua
  129. +8 −5 scripts/microbe_stage/switch_game_state_system.lua
  130. +73 −43 scripts/microbe_stage_tutorial/microbe_stage_tutorial_hud.lua
  131. +70 −69 scripts/microbe_stage_tutorial/setup.lua
  132. +29 −18 scripts/quick_save.lua
  133. +0 −22 scripts/sandbox/game_state.lua
  134. +98 −10 scripts/util.lua
  135. +2 −2 src/bullet/CMakeLists.txt
  136. +13 −10 src/bullet/bullet_to_ogre_system.cpp
  137. +4 −5 src/bullet/bullet_to_ogre_system.h
  138. +26 −16 src/bullet/collision_filter.cpp
  139. +5 −6 src/bullet/collision_filter.h
  140. +121 −63 src/bullet/collision_shape.cpp
  141. +31 −36 src/bullet/collision_shape.h
  142. +40 −35 src/bullet/collision_system.cpp
  143. +6 −9 src/bullet/collision_system.h
  144. +12 −10 src/bullet/debug_drawing.cpp
  145. +2 −3 src/bullet/debug_drawing.h
  146. +59 −0 src/bullet/physical_world.cpp
  147. +46 −0 src/bullet/physical_world.h
  148. +87 −62 src/bullet/rigid_body_system.cpp
  149. +7 −10 src/bullet/rigid_body_system.h
  150. +0 −48 src/bullet/script_bindings.cpp
  151. +0 −25 src/bullet/script_bindings.h
  152. +16 −10 src/bullet/update_physics_system.cpp
  153. +2 −3 src/bullet/update_physics_system.h
  154. +0 −2 src/engine/CMakeLists.txt
  155. +16 −90 src/engine/component.cpp
  156. +18 −4 src/engine/component.h
  157. +37 −21 src/engine/component_factory.cpp
  158. +3 −4 src/engine/component_factory.h
  159. +282 −312 src/engine/engine.cpp
  160. +37 −122 src/engine/engine.h
  161. +110 −57 src/engine/entity.cpp
  162. +21 −18 src/engine/entity.h
  163. +31 −0 src/engine/entity_manager.cpp
  164. +17 −1 src/engine/entity_manager.h
  165. +67 −223 src/engine/game_state.cpp
  166. +48 −192 src/engine/game_state.h
  167. +28 −20 src/engine/player_data.cpp
  168. +6 −7 src/engine/player_data.h
  169. +12 −12 src/engine/rng.cpp
  170. +3 −4 src/engine/rng.h
  171. +10 −10 src/engine/rolling_grid.cpp
  172. +3 −4 src/engine/rolling_grid.h
  173. +0 −31 src/engine/script_bindings.cpp
  174. +0 −24 src/engine/script_bindings.h
  175. +68 −47 src/engine/serialization.cpp
  176. +25 −8 src/engine/serialization.h
  177. +32 −129 src/engine/system.cpp
  178. +15 −21 src/engine/system.h
  179. +42 −41 src/engine/tests/entity.cpp
  180. +9 −10 src/engine/touchable.cpp
  181. +3 −4 src/engine/touchable.h
  182. +67 −27 src/game.cpp
  183. +18 −0 src/game.h
  184. +0 −2 src/general/CMakeLists.txt
  185. +12 −13 src/general/locked_map.cpp
  186. +3 −6 src/general/locked_map.h
  187. +29 −30 src/general/powerup_system.cpp
  188. +5 −10 src/general/powerup_system.h
  189. +0 −22 src/general/script_bindings.cpp
  190. +0 −26 src/general/script_bindings.h
  191. +26 −24 src/general/timed_life_system.cpp
  192. +5 −8 src/general/timed_life_system.h
  193. +48 −28 src/gui/CEGUIVideoPlayer.cpp
  194. +3 −5 src/gui/CEGUIVideoPlayer.h
  195. +77 −66 src/gui/CEGUIWindow.cpp
  196. +8 −8 src/gui/CEGUIWindow.h
  197. +0 −2 src/gui/CMakeLists.txt
  198. +0 −99 src/gui/script_bindings.cpp
  199. +0 −26 src/gui/script_bindings.h
  200. +9 −8 src/gui/script_wrappers.cpp
  201. +5 −10 src/gui/script_wrappers.h
  202. +0 −2 src/microbe_stage/CMakeLists.txt
  203. +32 −28 src/microbe_stage/agent_cloud_system.cpp
  204. +5 −7 src/microbe_stage/agent_cloud_system.h
  205. +49 −38 src/microbe_stage/bio_process_registry.cpp
  206. +3 −8 src/microbe_stage/bio_process_registry.h
  207. +29 −27 src/microbe_stage/compound.cpp
  208. +5 −9 src/microbe_stage/compound.h
  209. +39 −31 src/microbe_stage/compound_absorber_system.cpp
  210. +3 −7 src/microbe_stage/compound_absorber_system.h
  211. +93 −61 src/microbe_stage/compound_cloud_system.cpp
  212. +5 −7 src/microbe_stage/compound_cloud_system.h
  213. +60 −54 src/microbe_stage/compound_emitter_system.cpp
  214. +4 −9 src/microbe_stage/compound_emitter_system.h
  215. +81 −116 src/microbe_stage/compound_registry.cpp
  216. +8 −10 src/microbe_stage/compound_registry.h
  217. +36 −32 src/microbe_stage/membrane_system.cpp
  218. +6 −8 src/microbe_stage/membrane_system.h
  219. +54 −41 src/microbe_stage/process_system.cpp
  220. +7 −11 src/microbe_stage/process_system.h
  221. +0 −41 src/microbe_stage/script_bindings.cpp
  222. +0 −26 src/microbe_stage/script_bindings.h
  223. +41 −37 src/microbe_stage/species_component.cpp
  224. +6 −5 src/microbe_stage/species_component.h
  225. +0 −2 src/ogre/CMakeLists.txt
  226. +46 −35 src/ogre/camera_system.cpp
  227. +5 −7 src/ogre/camera_system.h
  228. +173 −164 src/ogre/keyboard.cpp
  229. +3 −4 src/ogre/keyboard.h
  230. +51 −42 src/ogre/light_system.cpp
  231. +5 −7 src/ogre/light_system.h
  232. +1 −28 src/ogre/membrane_generation_system.cpp
  233. +5 −7 src/ogre/membrane_generation_system.h
  234. +49 −26 src/ogre/mouse.cpp
  235. +3 −4 src/ogre/mouse.h
  236. +15 −10 src/ogre/render_system.cpp
  237. +2 −3 src/ogre/render_system.h
  238. +95 −76 src/ogre/scene_node_system.cpp
  239. +10 −14 src/ogre/scene_node_system.h
  240. +0 −647 src/ogre/script_bindings.cpp
  241. +0 −35 src/ogre/script_bindings.h
  242. +43 −36 src/ogre/sky_system.cpp
  243. +5 −7 src/ogre/sky_system.h
  244. +11 −11 src/ogre/tests/script_bindings.cpp
  245. +18 −14 src/ogre/tests/sky_system.cpp
  246. +0 −288 src/ogre/text_overlay.cpp
  247. +0 −206 src/ogre/text_overlay.h
  248. +0 −281 src/ogre/viewport_system.cpp
  249. +0 −209 src/ogre/viewport_system.h
  250. +39 −28 src/ogre/workspace_system.cpp
  251. +5 −7 src/ogre/workspace_system.h
  252. +5 −5 src/scripting/CMakeLists.txt
  253. +0 −59 src/scripting/lua_state.cpp
  254. +0 −98 src/scripting/lua_state.h
  255. +0 −81 src/scripting/luabind.h
  256. +49 −0 src/scripting/luajit.h
  257. +0 −12 src/scripting/script_bindings.cpp
  258. +0 −25 src/scripting/script_bindings.h
  259. +26 −29 src/scripting/script_entity_filter.cpp
  260. +6 −8 src/scripting/script_entity_filter.h
  261. +35 −0 src/scripting/script_helpers.h
  262. +1,101 −49 src/scripting/script_initializer.cpp
  263. +4 −8 src/scripting/script_initializer.h
  264. +25 −0 src/scripting/script_wrapper.h
  265. +0 −23 src/scripting/tests/do_string_assertion.h
  266. +88 −0 src/scripting/wrapper_classes.cpp
  267. +52 −0 src/scripting/wrapper_classes.h
  268. +0 −2 src/sound/CMakeLists.txt
  269. +0 −18 src/sound/script_bindings.cpp
  270. +0 −24 src/sound/script_bindings.h
  271. +121 −81 src/sound/sound_source_system.cpp
  272. +6 −9 src/sound/sound_source_system.h
View
@@ -100,3 +100,8 @@ nbproject/
!thriveversion.ver
# Temporary/backup files
*~
# Cscope files
/cscope.files
/RunCodeIndexing.rb
View
@@ -1,6 +1,6 @@
[submodule "contrib/googletest"]
path = contrib/googletest
url = git://github.com/liquid-mirror/googletest.git
[submodule "contrib/luabind"]
path = contrib/luabind
url = git://github.com/rpavlik/luabind.git
[submodule "contrib/lua/luajit"]
path = contrib/lua/luajit
url = http://luajit.org/git/luajit-2.0.git
View
@@ -88,7 +88,7 @@ set(OGRE_PLUGINS
# Plugin_OctreeSceneManager
# Plugin_OctreeZone
Plugin_ParticleFX
Plugin_CgProgramManager
# Plugin_CgProgramManager
# Plugin_PCZSceneManager
RenderSystem_GL
)
@@ -137,21 +137,36 @@ find_package(Bullet REQUIRED QUIET)
include_directories(SYSTEM ${BULLET_INCLUDE_DIRS})
##########
# TinyXML #
##########
find_package(TinyXML REQUIRED QUIET)
#######
# Lua #
#######
option(LUA_CHECKS "when ON enables additional Lua safety
checks. Lowers performance so only use while debugging"
OFF)
if(LUA_CHECKS)
add_definitions(-DSOL_CHECK_ARGUMENTS)
endif()
include_directories(
SYSTEM
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua/lua/src"
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/luabind/"
)
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua"
)
link_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua/luajit/src"
)
set(LUA_FOUND TRUE)
if(WIN32)
set(LUA_LIBRARIES lua51.dll)
else()
set(LUA_LIBRARIES luajit.a dl)
endif()
#######
# CEGUI #
@@ -177,26 +192,6 @@ find_package(TinyXML REQUIRED QUIET)
include_directories(SYSTEM ${TINYXML_INCLUDE_DIR})
if(WIN32)
add_definitions(-DLUA_BUILD_AS_DLL)
endif()
add_subdirectory(
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua/"
)
set(LUA_FOUND TRUE)
set(LUA_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/lua/lua/src")
set(LUA_LIBRARIES lua)
#set(BUILD_SHARED_LUABIND ON)
#set(INSTALL_LUABIND ON)
set(LIB_DIR bin)
add_definitions(-DLUABIND_CPLUSPLUS_LUA)
add_subdirectory(
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/luabind/"
)
################
# cAudio #
################
@@ -230,7 +225,10 @@ include_directories(
# Compile using c++11 and using sse2
#no-unused-variable is necessary to supress werror while compiling cAudio
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -msse2 -Wno-unused-function")
# SOL uses a bunch of recursive templates so unless all lua bindings are written to be
# less efficient runtime dynamic bindings we need to have bigger template depth.
# though this may kill compile times
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -msse2 -Wno-unused-function -Wno-error=redundant-decls -ftemplate-depth=1500" )
find_package(Threads)
@@ -265,7 +263,7 @@ target_link_libraries(ThriveLib
${CEGUI_LIBRARY}
${TINYXML_LIBRARIES}
${OpenAL_LIBRARIES}
luabind
${LUA_LIBRARIES}
)
target_link_libraries(ThriveLib
@@ -331,7 +329,7 @@ set_source_files_properties(
)
add_executable(RunTests ${TEST_SOURCE_FILES})
target_link_libraries(RunTests ThriveLib gtest_main)
target_link_libraries(RunTests ThriveLib gtest_main ${LUA_LIBRARIES})
#################
# Documentation #
@@ -367,10 +365,6 @@ install(TARGETS Thrive
LIBRARY DESTINATION bin
)
install(EXPORT lua
DESTINATION bin
)
# Version file
install(FILES
@@ -581,6 +575,8 @@ if(WIN32)
"${MINGW_ENV}/install/bin/avutil-55.dll"
"${MINGW_ENV}/install/bin/swscale-4.dll"
"${MINGW_ENV}/install/bin/swresample-2.dll"
"${CMAKE_SOURCE_DIR}/contrib/lua/luajit/src/lua51.dll"
"${CMAKE_SOURCE_DIR}/contrib/lua/luajit/src/luajit.exe"
DESTINATION bin
CONFIGURATIONS Debug
)
@@ -640,6 +636,12 @@ elseif(UNIX)
OGRE_PLUGIN_LIB_DBG
OGRE_PLUGIN_LIB_REL
)
if(NOT EXISTS "${OGRE_PLUGIN_LIB_REL}" OR NOT EXISTS "${OGRE_PLUGIN_LIB_DBG}")
message(SEND_ERROR "Ogre plugin file doesn't exist: ${OGRE_PLUGIN} . Did you build "
"all the required Ogre plugins?")
endif()
# Release
InstallFollowingSymlink(
${OGRE_PLUGIN_LIB_REL}
@@ -688,12 +690,24 @@ if(UNIX)
"${CMAKE_CURRENT_BINARY_DIR}/CMakeLibraryList.xml" @ONLY
)
add_custom_target(linuxrelease
COMMAND "${CMAKE_SOURCE_DIR}/cpack/PackageProject.rb" "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cpack"
DEPENDS ThriveLib doc
)
# The name of the Thrive target somehow breaks in the above command
add_dependencies(linuxrelease Thrive)
if(LUA_CHECKS)
# creating debug releases is bad
add_custom_target(linuxrelease
# Please don't touch this really complex command output format
COMMAND "ruby" "-e" \"puts \\\"\\033[31m\\\"\; puts 'ERROR: LUA_CHECKS is on. release build is disabled. Please run \\'cmake .. -DLUA_CHECKS=OFF\\' and try again'\; puts \\\"\\033[0m\\\"\; exit(3) \"
)
else()
add_custom_target(linuxrelease
COMMAND "${CMAKE_SOURCE_DIR}/cpack/PackageProject.rb" "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/cpack"
DEPENDS ThriveLib doc
)
# The name of the Thrive target somehow breaks in the above command
add_dependencies(linuxrelease Thrive)
endif()
endif()
View
@@ -25,6 +25,12 @@ def checkRunFolder(suggestedfolder)
end
end
def projectFolder(baseDir)
return File.join baseDir, "thrive"
end
ThriveBranch = "master"
#ThriveBranch = "ruby_setup"
SkipPackageManager = false
@@ -46,7 +52,7 @@ def checkRunFolder(suggestedfolder)
PackagesToInstall = "bullet-devel boost gcc-c++ libXaw-devel freetype-devel " +
"freeimage-devel zziplib-devel boost-devel ois-devel tinyxml-devel " +
"glm-devel ffmpeg-devel ffmpeg-libs openal-soft-devel libatomic Cg"
"glm-devel ffmpeg-devel ffmpeg-libs openal-soft-devel libatomic"
elsif LinuxOS.casecmp("Ubuntu") == 0
@@ -124,12 +130,22 @@ def checkRunFolder(suggestedfolder)
Dir.chdir(File.join(CurrentDir, "thrive")) do
systemChecked "git checkout #{ThriveBranch}"
systemChecked "git pull --recurse-submodules origin #{ThriveBranch}"
system "git checkout #{ThriveBranch}"
if $?.exitstatus > 0
warning "Failed to checkout target thrive branch"
else
systemChecked "git pull --recurse-submodules origin #{ThriveBranch}"
end
systemChecked "git submodule update --recursive"
# submodule init check
if not File.exists? File.join(CurrentDir, "thrive", "contrib/luabind/luabind", "object.hpp")
if not File.exists? File.join(CurrentDir, "thrive", "contrib/lua/luajit/src", "lua.hpp")
warning "Submodules haven't been initialized, initializing now"
@@ -162,14 +178,34 @@ def checkRunFolder(suggestedfolder)
end
success "Assets are good to go"
info "Building luajit"
Dir.chdir(File.join(CurrentDir, "thrive", "contrib/lua/luajit/src")) do
# Make sure XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT is uncommented
outdata = File.read("Makefile").gsub(/#XCFLAGS\+= -DLUAJIT_ENABLE_LUA52COMPAT/,
"XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT")
File.open("Makefile", 'w') do |out|
out << outdata
end
runCompiler CompileThreads
onError "Failed to compile luajit" if $?.exitstatus > 0
end
success "luajit is ok"
FileUtils.mkdir_p "build"
FileUtils.mkdir_p "build/dist"
FileUtils.mkdir_p "build/dist/bin"
info "Making links"
# It seems that if the link is created when it already exists a llink is created into
# It seems that if the link is created when it already exists a link is created into
# the target folder for some reason
createLinkIfDoesntExist "assets/cegui_examples", "cegui_examples"
createLinkIfDoesntExist "assets/fonts", "fonts"
@@ -216,14 +252,6 @@ def checkRunFolder(suggestedfolder)
success "Done compiling thrive"
# Create a link from liblua.so to fix undefined symbol: _Z13luaL_newstatev
Dir.chdir(File.join(CurrentDir, "thrive", "build")) do
FileUtils.ln_sf "contrib/lua/liblua.so", "liblua.so"
end
info "run the game with '#{CurrentDir}/thrive/build/Thrive'"
success "Done"
View
@@ -1,86 +0,0 @@
cmake_minimum_required(VERSION 2.8)
project(lua CXX)
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lua/src)
set(LIB_SOURCES
${SOURCE_DIR}/lapi.c
${SOURCE_DIR}/lauxlib.c
${SOURCE_DIR}/lbaselib.c
${SOURCE_DIR}/lbitlib.c
${SOURCE_DIR}/lcode.c
${SOURCE_DIR}/lcorolib.c
${SOURCE_DIR}/lctype.c
${SOURCE_DIR}/ldblib.c
${SOURCE_DIR}/ldebug.c
${SOURCE_DIR}/ldo.c
${SOURCE_DIR}/ldump.c
${SOURCE_DIR}/lfunc.c
${SOURCE_DIR}/lgc.c
${SOURCE_DIR}/linit.c
${SOURCE_DIR}/liolib.c
${SOURCE_DIR}/llex.c
${SOURCE_DIR}/lmathlib.c
${SOURCE_DIR}/lmem.c
${SOURCE_DIR}/loadlib.c
${SOURCE_DIR}/lobject.c
${SOURCE_DIR}/lopcodes.c
${SOURCE_DIR}/loslib.c
${SOURCE_DIR}/lparser.c
${SOURCE_DIR}/lstate.c
${SOURCE_DIR}/lstring.c
${SOURCE_DIR}/lstrlib.c
${SOURCE_DIR}/ltable.c
${SOURCE_DIR}/ltablib.c
${SOURCE_DIR}/ltm.c
${SOURCE_DIR}/lundump.c
${SOURCE_DIR}/lvm.c
${SOURCE_DIR}/lzio.c
)
set(LIB_HEADERS
${SOURCE_DIR}/lapi.h
${SOURCE_DIR}/lauxlib.h
${SOURCE_DIR}/lcode.h
${SOURCE_DIR}/lctype.h
${SOURCE_DIR}/ldebug.h
${SOURCE_DIR}/ldo.h
${SOURCE_DIR}/lfunc.h
${SOURCE_DIR}/lgc.h
${SOURCE_DIR}/llex.h
${SOURCE_DIR}/llimits.h
${SOURCE_DIR}/lmem.h
${SOURCE_DIR}/lobject.h
${SOURCE_DIR}/lopcodes.h
${SOURCE_DIR}/lparser.h
${SOURCE_DIR}/lstate.h
${SOURCE_DIR}/lstring.h
${SOURCE_DIR}/ltable.h
${SOURCE_DIR}/ltm.h
${SOURCE_DIR}/luaconf.h
${SOURCE_DIR}/lualib.h
${SOURCE_DIR}/lundump.h
${SOURCE_DIR}/lvm.h
${SOURCE_DIR}/lzio.h
)
set_source_files_properties(
${LIB_SOURCES}
PROPERTIES LANGUAGE CXX
)
include_directories(
${SOURCE_DIR}
)
add_library(lua SHARED
${LIB_SOURCES}
${LIB_HEADERS}
)
install(TARGETS lua
EXPORT lua
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin
)
View
@@ -0,0 +1,6 @@
LuaJIT has a really complex makefile so go into the luajit/src folder
and run make
Unfortunately there are some lua 5.2 features that need to be
explicitly enabled. So before running make uncomment this line in
`luajit/src/Makefile`: `#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT`
View
@@ -1,6 +0,0 @@
This is Lua 5.2.2, released on 21 Mar 2013.
For installation instructions, license details, and
further information about Lua, see doc/readme.html.
Oops, something went wrong.

0 comments on commit 8055e85

Please sign in to comment.