Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem3/cmake/GenerateToluaBindings.cmake @ 2679

Last change on this file since 2679 was 2664, checked in by rgrieder, 16 years ago

Merged buildsystem2 to buildsystem3.

Note: Bare merge, just resolved conflicts. To testing, no nothing.

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1 #
2 #             ORXONOX - the hottest 3D action shooter ever to exist
3 #                             > www.orxonox.net <
4 #
5 #        This program is free software; you can redistribute it and/or
6 #         modify it under the terms of the GNU General Public License
7 #        as published by the Free Software Foundation; either version 2
8 #            of the License, or (at your option) any later version.
9 #
10 #       This program is distributed in the hope that it will be useful,
11 #        but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #                 GNU General Public License for more details.
14 #
15 #   You should have received a copy of the GNU General Public License along
16 #      with this program; if not, write to the Free Software Foundation,
17 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 #
19 #
20 #  Author:
21 #    Adrian Friedli
22 #  Description:
23 #    Sets the CMake options that will generate Tolua++ bindings.
24 #  Parameters:
25 #    _tolua_package - Name of the package, e.g. "Core"
26 #    _target_source_files - Variable name of the target source files, the
27 #                           script will add the generated files to this list.
28 #    ARGN - The header files in the style "INTPUTFILES Foo.h Bar.h"
29 #  Global Variables: (need to be set before)
30 #    TOLUA_PARSER_SOURCE - Lua file with the parser source code
31 #    TOLUA_PARSER_DEPENDENCIES - All the dependent lua files
32 #    ORXONOX_RUNTIME_LIBRARY_DIRECTORY - Working directory
33 #
34
35FUNCTION(GENERATE_TOLUA_BINDINGS _tolua_package _target_source_files)
36  SET(_tolua_inputfiles ${ARGN})
37  LIST(REMOVE_ITEM _tolua_inputfiles "INPUTFILES")
38
39  SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg")
40  SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.cc")
41  SET(_tolua_hfile   "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")
42
43  SET(${_target_source_files}
44    ${${_target_source_files}}
45    ${_tolua_cxxfile}
46    ${_tolua_hfile}
47    PARENT_SCOPE
48  )
49  SOURCE_GROUP("Tolua" FILES ${_tolua_cxxfile} ${_tolua_hfile})
50
51  # Create temporary package file
52  FILE(REMOVE ${_tolua_pkgfile})
53  FOREACH(_tolua_inputfile ${_tolua_inputfiles})
54    FILE(APPEND ${_tolua_pkgfile} "\$cfile \"${_tolua_inputfile}\"\n")
55  ENDFOREACH(_tolua_inputfile)
56
57  ADD_CUSTOM_COMMAND(
58    OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}
59    COMMAND tolua++app_orxonox -n ${_tolua_package}
60                               -w ${CMAKE_CURRENT_SOURCE_DIR}
61                               -o ${_tolua_cxxfile}
62                               -H ${_tolua_hfile}
63                               -s ${TOLUA_PARSER_SOURCE}
64                                  ${_tolua_pkgfile}
65    DEPENDS              ${TOLUA_PARSER_DEPENDENCIES}
66    IMPLICIT_DEPENDS CXX ${_tolua_inputfiles}
67    WORKING_DIRECTORY    ${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}
68    COMMENT "Generating tolua bind files for package ${_tolua_package}"
69  )
70ENDFUNCTION(GENERATE_TOLUA_BINDINGS)
Note: See TracBrowser for help on using the repository browser.