Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core6/cmake/tools/FindLua5.1.cmake @ 10231

Last change on this file since 10231 was 8351, checked in by rgrieder, 14 years ago

Merged kicklib2 branch back to trunk (includes former branches ois_update, mac_osx and kicklib).

Notes for updating

Linux:
You don't need an extra package for CEGUILua and Tolua, it's already shipped with CEGUI.
However you do need to make sure that the OgreRenderer is installed too with CEGUI 0.7 (may be a separate package).
Also, Orxonox now recognises if you install the CgProgramManager (a separate package available on newer Ubuntu on Debian systems).

Windows:
Download the new dependency packages versioned 6.0 and use these. If you have problems with that or if you don't like the in game console problem mentioned below, you can download the new 4.3 version of the packages (only available for Visual Studio 2005/2008).

Key new features:

  • *Support for Mac OS X*
  • Visual Studio 2010 support
  • Bullet library update to 2.77
  • OIS library update to 1.3
  • Support for CEGUI 0.7 —> Support for Arch Linux and even SuSE
  • Improved install target
  • Compiles now with GCC 4.6
  • Ogre Cg Shader plugin activated for Linux if available
  • And of course lots of bug fixes

There are also some regressions:

  • No support for CEGUI 0.5, Ogre 1.4 and boost 1.35 - 1.39 any more
  • In game console is not working in main menu for CEGUI 0.7
  • Tolua (just the C lib, not the application) and CEGUILua libraries are no longer in our repository. —> You will need to get these as well when compiling Orxonox
  • And of course lots of new bugs we don't yet know about
  • Property svn:eol-style set to native
File size: 3.5 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 #    Reto Grieder
22 #  Description:
23 #    Finds Lua 5.1 on the system.
24 #    Handles REQUIRED and QUIET arguments.
25 #    When the search was successful, the following variables are set:
26 #    LUA5.1_INCLUDE_DIR, LUA5.1_LIBRARY, LUA5.1_VERSION, LUA5.1_FOUND
27 #
28
29INCLUDE(CompareVersionStrings)
30INCLUDE(FindPackageHandleAdvancedArgs)
31INCLUDE(HandleLibraryTypes)
32
33# Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.1.4)
34FUNCTION(DETERMINE_LUA_VERSION _file _varname)
35  IF(EXISTS ${_file})
36    FILE(STRINGS ${_file} _file_content REGEX "LUA_VERSION|LUA_RELEASE")
37  ELSE()
38    SET(${_varname} "0" PARENT_SCOPE)
39    RETURN()
40  ENDIF()
41  STRING(REGEX REPLACE "^.*LUA_RELEASE[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
42  IF(${_varname} STREQUAL "${_file_content}")
43    # At most version 5.1.0
44    STRING(REGEX REPLACE "^.*LUA_VERSION[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
45    IF(${_varname} STREQUAL "${_file_content}")
46      MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
47    ENDIF()
48    IF(${_varname} MATCHES "^[0-9]+\\.[0-9]+$")
49      SET(${_varname} "${${_varname}}.0") # E.g. "3.2" is "3.2.0" actually
50    ENDIF()
51  ENDIF()
52  SET(${_varname} "${${_varname}}" PARENT_SCOPE)
53ENDFUNCTION(DETERMINE_LUA_VERSION)
54
55
56# Find include path
57FIND_PATH(LUA5.1_INCLUDE_DIR lua.h
58  PATHS $ENV{LUA5.1_DIR} $ENV{LUA_DIR}
59  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
60)
61
62# Check whether we really found Lua version 5.1
63IF(LUA5.1_INCLUDE_DIR)
64  DETERMINE_LUA_VERSION(${LUA5.1_INCLUDE_DIR}/lua.h LUA5.1_VERSION)
65  COMPARE_VERSION_STRINGS("${LUA5.1_VERSION}" "5.1" _version_compare TRUE)
66  IF(NOT _version_compare EQUAL 0)
67    # Wrong version
68    MESSAGE(SEND_ERROR "Version of Lua header found is not 5.1")
69    SET(LUA5.1_INCLUDE_DIR "LUA5.1_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
70  ENDIF(NOT _version_compare EQUAL 0)
71ENDIF(LUA5.1_INCLUDE_DIR)
72
73# Find library
74FIND_LIBRARY(LUA5.1_LIBRARY_OPTIMIZED
75  NAMES lua51 lua5.1 lua
76  PATHS $ENV{LUA5.1_DIR} $ENV{LUA_DIR}
77  PATH_SUFFIXES lib64 lib
78)
79FIND_LIBRARY(LUA5.1_LIBRARY_DEBUG
80  NAMES lua51d lua51_d lua5.1d lua5.1_d
81        lua51D lua51_D lua5.1D lua5.1_D
82        luad lua_d luad lua_D
83  PATHS $ENV{LUA5.1_DIR} $ENV{LUA_DIR}
84  PATH_SUFFIXES lib64 lib
85)
86
87# Handle the REQUIRED argument and set LUA5.1_FOUND
88FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua5.1 DEFAULT_MSG
89  LUA5.1_LIBRARY_OPTIMIZED
90  LUA5.1_INCLUDE_DIR
91)
92
93# Collect optimized and debug libraries
94HANDLE_LIBRARY_TYPES(LUA5.1)
95
96MARK_AS_ADVANCED(
97  LUA5.1_INCLUDE_DIR
98  LUA5.1_LIBRARY_OPTIMIZED
99  LUA5.1_LIBRARY_DEBUG
100)
Note: See TracBrowser for help on using the repository browser.