Permalink
Browse files

Updated lua macros

  • Loading branch information...
2 parents 2486b4c + c60daf5 commit c1be8f3554a7ec2a51a96ba65bb92da4085aa4ad @drahosp drahosp committed Aug 20, 2012
Showing with 40 additions and 32 deletions.
  1. +23 −22 .travis.yml
  2. +17 −10 cmake/lua.cmake
View
@@ -2,39 +2,40 @@
# LuaDist Travis-CI Hook
#
-# Since CMake is not directly supported we use erlang VMs
-language: erlang
-
+# We assume C build environments
+language: C
+
# Try using multiple Lua Implementations
env:
- - LUA="" # Use automatic dependencies
- - LUA="luajit" # Try with LuaJIT
-# - CMAKE="-DCMAKE_VARIABLE=value"
-# - LUA="lua-5.1.5"
+ - TOOL="" # Use native compiler (GCC usually)
+ - COMPILER="clang" # Use clang
+ - TOOL="i686-w64-mingw32" # 32bit MinGW
+ - TOOL="x86_64-w64-mingw32" # 64bit MinGW
+ - TOOL="arm-linux-gnueabihf" # ARM hard-float (hf), linux
-# Allow luajit to fail
+# Crosscompile builds may fail
matrix:
allow_failures:
- - env: LUA="luajit"
-
-# We need CMake and LuaDist
+ - env: TOOL="i686-w64-mingw32"
+ - env: TOOL="x86_64-w64-mingw32"
+ - env: TOOL="arm-linux-gnueabihf"
+
+# Install dependencies
install:
- - export MODULE=`basename $PWD`
- - sudo apt-get install cmake >/dev/null 2>&1
- - git clone git://github.com/LuaDist/bootstrap.git _luadist >/dev/null 2>&1
- - cd _luadist
- - git submodule update --init >/dev/null 2>&1
- - ./bootstrap >/dev/null 2>&1
- - export LUADIST=$PWD/_install/bin/luadist
- - cd $HOME
+ - git clone git://github.com/LuaDist/_util.git ~/_util
+ - ~/_util/travis install
+
+# Bootstap
+before_script:
+ - ~/_util/travis bootstrap
-# Use LuaDist to deploy the module
+# Build the module
script:
- - $LUADIST _test install $LUA $MODULE-scm $CMAKE -verbose=true -test=true
+ - ~/_util/travis build
# Execute additional tests or commands
#after_script:
-# - [run additional test commans]
+# - ~/_util/travis test
# Only watch the master branch
branches:
View
@@ -31,34 +31,41 @@ endmacro ()
# install_lua_executable ( target source )
# Automatically generate a binary if srlua package is available
# The application or its source will be placed into /bin
-# If the application source did not have .lua suffix then it will be added
+# If the application source did have .lua suffix then it will be removed
# USE: lua_executable ( sputnik src/sputnik.lua )
macro ( install_lua_executable _name _source )
- get_filename_component ( _source_name ${_source} NAME_WE )
# Find srlua and glue
find_program( SRLUA_EXECUTABLE NAMES srlua )
find_program( GLUE_EXECUTABLE NAMES glue )
-
+ # Executable output
+ set ( _exe ${CMAKE_CURRENT_BINARY_DIR}/${_name}${CMAKE_EXECUTABLE_SUFFIX} )
if ( NOT SKIP_LUA_WRAPPER AND SRLUA_EXECUTABLE AND GLUE_EXECUTABLE )
- # Generate binary gluing the lua code to srlua
+ # Generate binary gluing the lua code to srlua, this is a robuust approach for most systems
+ # Recommended, expecially for Windows systems
add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}
+ OUTPUT ${_exe}
COMMAND ${GLUE_EXECUTABLE}
- ARGS ${SRLUA_EXECUTABLE} ${_source} ${CMAKE_CURRENT_BINARY_DIR}/${_name}
+ ARGS ${SRLUA_EXECUTABLE} ${_source} ${_exe}
DEPENDS ${_source}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
# Make sure we have a target associated with the binary
add_custom_target(${_name} ALL
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_name}
+ DEPENDS ${_exe}
)
# Install with run permissions
- install ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${_name} DESTINATION ${INSTALL_BIN} COMPONENT Runtime)
+ install ( PROGRAMS ${_exe} DESTINATION ${INSTALL_BIN} COMPONENT Runtime)
+ # Also install the source as optional component
+ install ( PROGRAMS ${_source} DESTINATION ${INSTALL_FOO}
+ RENAME ${_name}
+ COMPONENT Other
+ )
else()
- # Add .lua suffix and install as is
+ # Install into bin as is, we assume the executable uses UNIX shebang
+ # NOTE: This approach is unsuitable for non UNIX systems
install ( PROGRAMS ${_source} DESTINATION ${INSTALL_BIN}
- RENAME ${_source_name}.lua
+ RENAME ${_name}
COMPONENT Runtime
)
endif()

0 comments on commit c1be8f3

Please sign in to comment.