You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
drahosp edited this page Feb 19, 2013
·
5 revisions
Building pure Lua modules
The CMake script for installing pure modules is easy.
All you have to do is:
define project information editing the dist.info file.
copy the cmake macro folder directory from our Tools
write commands for installing module's files in the CMakeLists.txt file.
Here is an commented example fo the Abelhas module:
# Define projects name# The NONE tells CMake to not check for compilers as they are not neededproject ( abelhas NONE )
# Define minimun version of CMake for compatibilitycmake_minimum_required ( VERSION2.8 )
# Include our macros. # Notice that once dist.cmake is loaded there is no need to directly point to files.# Every cmake file and find package script can be used directly if placed in cmake/ folder.include ( cmake/dist.cmake )
include ( lua )
# All is set up, so install:# First argument is the require name. Second argument is the source of the module.install_lua_module ( psopso.lua )
# or: install_lua_module ( pso.submodule src/pso_submodule.lua )# LuaDist will take care of the installation and renaming automatically# Install files README COPYING to data directory (share/abelhas)install_data ( READMECOPYING )
# Install all files from examples directory into the default destination folder (share/abelhas/example)install_example ( examples/ )
# Install the content of the doc directory into the default documentation folder (share/abelhas/doc)install_doc ( doc/ )
That's all. Alternatively you can use CMake INSTALL command and install using INSTALL_* variables, but the included macro simplifies things considerably.
If you want to install a lua based application simply call:
install_lua_executable ( app_namesrc/app.lua )
LuaDist will automatically generate a binary executable for your application.