Status
History Key
- New content
Removed content
Recent Versions
Choose two versions to compare, or click the link to view it.
- Our changes could be seen here: CMakeLua.patch
- A file named LuaPublicAPIHelper.lua has been added to Modules. This file is intended to help setup the Lua state on CMake start and is designed to let us write things in Lua instead of C++ when it is easier and sensible to do so.
- The CMake API functions which were originally prefixed as "cm_" in global space has been moved to a namespace (table) called "cmake" with the "cm_" prefix removed. This is currently implemented in the LuaPublicAPIHelper so it effectively 'undoes' the "cm_" stuff. This probably should be cleaned up in the C++ side to directly create functions in a cmake table instead.
- Fancy argument handling with respect to tables as discussed in the original CMake Lua experiement wiki has been implemented in the LuaPublicAPIHelper. All API functions now will transparently deal with list of arguments and tables.
- The cmCommand::cmLuaFunc backend binding has been changed to expect a single array (table) argument instead of a variable number of arguments. The reason for this is that Lua has a max number of arguments that are allowed (set by a #define). The default is 2048. For large CMake projects, users might get into trouble if they have large numbers of files under the variable number of arguments system, whereas an array will not have these limitations. The fancy argument handling wrappers make sure to transparently convert variable number of arguments to a single table parameter so users may not need to know about how the backend expects arguments to be passed. However, users still will need to be aware that passing 2048 unique parameters will cause problems.
If they are encouraged to put their files in
tables which has other advantages such as reusing to specify IDEadding, installing, frameworks, etc, then the event of a user hittingthe problem becomes remote:cmake.add_library("simpleLib", cmake.STATIC, sources)
If users don't do this and get into trouble, the work-around is easy
though and can be told to use the following tricks which add braces:cmake.add_library("simpleLib", cmake.STATIC, {'source1.cxx', 'source2.cxx'})
orcmake.add_library({"simpleLib", cmake.STATIC, 'source1.cxx', 'source2.cxx'})In the latter case, since Lua has syntactic sugar for omitting
parenthesis for single argument functions, users may also do this:cmake.add_library{"simpleLib", cmake.STATIC, 'source1.cxx', 'source2.cxx'} - cmLuaUtils has been created to put generic Lua/C++ helper functions in.
- See CMakeLua/Tests/LuaTest/ for on-going/evolving CMakeLists.lua scripts