Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1124


Ignore:
Timestamp:
Apr 21, 2008, 10:35:08 PM (16 years ago)
Author:
rgrieder
Message:
  • completely rewrote FindLua.cmake (hope it still works) It should be more clear now and cache works. Lua_LIBRARIES, Lua_INCLUDE_DIR, Lua_FOUND and Lua_VERSION (5.1 or 5.0) are defined
  • something to add for last commit: when using out-of-source build, you can simply write 'rm -rf *' in the build directory to clean everything, including the CMake cache, but not the binary files in bin/ and bin/lib/
Location:
code/branches/cmake
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cmake/cmake/FindLua.cmake

    r1076 r1124  
    1 # Find Lua includes and library
     1#  Find Lua header and library files
    22#
    3 # This module defines
    4 #  Lua_INCLUDE_DIR
    5 #  Lua_LIBRARIES, the libraries to link against to use Lua.
    6 #  Lua_LIB_DIR, the location of the libraries
    7 #  Lua_FOUND, If false, do not try to use Lua
     3#  When called, this script tries to define:
     4#  Lua_INCLUDE_DIR    Header files directory
     5#  Lua_LIBRARIES      library files (or file when using lua 5.1)
     6#  Lua_FOUND          defined (true) if lua was found
     7#  Lua_VERSION        either 5.1 or 5.0 or undefined
    88#
    9 # Copyright © 2007, Matt Williams
    10 #
    11 # Redistribution and use is allowed according to the terms of the BSD license.
     9#  authors: Benjamin Knecht, Reto Grieder
    1210
    13 MESSAGE(STATUS "lua libs in cache: ${Lua_LIBRARIES}")
    1411IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
    15     SET(Lua_FIND_QUIETLY TRUE) # Already in cache, be silent
     12
     13  # Already in cache, be silent
     14  SET(Lua_FOUND TRUE)
     15  SET(Lua_FIND_QUIETLY TRUE)
     16  MESSAGE(STATUS "Lua was found.")
     17
     18ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
     19
     20  FIND_PATH(Lua_INCLUDE_DIR_51 lua.h
     21    /usr/include/lua5.1
     22    /usr/local/include/lua5.1
     23    ../libs/lua-5.1.3/src)
     24
     25  FIND_PATH(Lua_INCLUDE_DIR_50 lua.h
     26    /usr/include/lua50
     27    /usr/local/include/lua50
     28    /usr/pack/lua-5.0.3-sd/include)
     29
     30  FIND_LIBRARY(Lua_LIBRARY_51 lua5.1
     31    /usr/lib
     32    /usr/local/lib
     33    ../libs/lua-5.1.3/lib)
     34
     35  FIND_LIBRARY(Lua_LIBRARY_1_50 NAMES lua50 lua PATHS
     36        /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
     37    /usr/lib
     38    /usr/local/lib)
     39
     40  FIND_LIBRARY(Lua_LIBRARY_2_50 NAMES lualib50 lualib PATHS
     41        /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
     42    /usr/lib
     43    /usr/local/lib)
     44
     45
     46  IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
     47
     48    # Found newer lua 5.1 libs
     49    SET(Lua_FOUND TRUE)
     50    SET(Lua_VERSION 5.1 CACHE STRING "")
     51    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "")
     52    SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "")
     53
     54  ELSEIF(Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50)
     55
     56    # Found older lua 5.0 libs
     57    SET(Lua_FOUND TRUE)
     58    SET(Lua_VERSION 5.0 CACHE STRING "")
     59    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_50} CACHE PATH "")
     60    SET(Lua_LIBRARIES ${Lua_LIBRARY_1_50} ${Lua_LIBRARY_2_50} CACHE FILEPATH "")
     61
     62  ENDIF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
     63       
     64
     65  IF (Lua_FOUND)
     66    MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}")
     67  ELSE (Lua_FOUND)
     68    IF (Lua_FIND_REQUIRED)
     69      MESSAGE(FATAL_ERROR "Could not find Lua")
     70    ENDIF (Lua_FIND_REQUIRED)
     71  ENDIF (Lua_FOUND)
     72
    1673ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
    1774
    18 FIND_PATH(Lua_INCLUDE_DIR lua.h
    19         /usr/include/lua5.1
    20         /usr/local/include/lua5.1
    21         ../libs/lua-5.1.3/src)
    22 
    23 FIND_LIBRARY(Lua_LIBRARIES lua5.1
    24         /usr/lib
    25         /usr/local/lib
    26         ../libs/lua-5.1.3/lib)
    27 
    28 IF (NOT Lua_INCLUDE_DIR)
    29  FIND_PATH(Lua_INCLUDE_DIR lua.h
    30         /usr/include/lua50
    31         /usr/local/include/lua50
    32         /usr/pack/lua-5.0.3-sd/include)
    33 ENDIF (NOT Lua_INCLUDE_DIR)
    34 
    35 IF (NOT Lua_LIBRARIES)
    36  FIND_LIBRARY(Lua_LIBRARIES lua50
    37         /usr/lib
    38         /usr/local/lib)
    39 
    40  FIND_LIBRARY(Lua_LIBRARY lualib50
    41         /usr/lib
    42         /usr/local/lib)
    43 
    44 #SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
    45 ENDIF (NOT Lua_LIBRARIES)
    46 
    47 #especially for tardis
    48 IF (NOT Lua_LIBRARIES)
    49  FIND_LIBRARY(Lua_LIBRARIES lua
    50         /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
    51 
    52  FIND_LIBRARY(Lua_LIBRARY lualib
    53         /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
    54 
    55 #SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
    56 ENDIF (NOT Lua_LIBRARIES)
    57 
    58 IF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)
    59     SET(Lua_FOUND TRUE)
    60 ENDIF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)
    61 
    62 IF (Lua_FOUND)
    63     MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}")
    64     MESSAGE(STATUS "Found Lua: ${Lua_LIBRARY}")
    65 ELSE (Lua_FOUND)
    66     IF (Lua_FIND_REQUIRED)
    67         MESSAGE(FATAL_ERROR "Could not find Lua")
    68     ENDIF (Lua_FIND_REQUIRED)
    69 ENDIF (Lua_FOUND)
  • code/branches/cmake/src/core/CMakeLists.txt

    r1122 r1124  
    3434  tolualib
    3535  ${Lua_LIBRARIES}
    36   ${Lua_LIBRARY}
    3736  ${OIS_LIBRARIES}
    3837)
  • code/branches/cmake/src/tolua/CMakeLists.txt

    r1123 r1124  
    1414TARGET_LINK_LIBRARIES(tolua
    1515  ${Lua_LIBRARIES}
    16   ${Lua_LIBRARY}
    1716  m
    1817)
     
    5049TARGET_LINK_LIBRARIES(tolualib
    5150  ${Lua_LIBRARIES}
    52   ${Lua_LIBRARY}
    5351)
    5452
Note: See TracChangeset for help on using the changeset viewer.