Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Updated lua macros
Browse files Browse the repository at this point in the history
  • Loading branch information
drahosp committed Aug 15, 2012
1 parent 37fe7f7 commit 3c9e87a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 24 deletions.
42 changes: 26 additions & 16 deletions .travis.yml
Expand Up @@ -2,29 +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:
- git clone git://github.com/LuaDist/_util.git ~/_util
- ~/_util/travis install-luadist
- ~/_util/travis install

# Use LuaDist to deploy the module
# Bootstap
before_script:
- ~/_util/travis bootstrap

# Build the module
script:
- ~/_util/travis script-luadist
- ~/_util/travis build

# Execute additional tests or commands
#after_script:
# - ~/_util/travis test

# Only watch the master branch
branches:
Expand All @@ -37,5 +48,4 @@ notifications:
- luadist-dev@googlegroups.com
email:
on_success: change
on_failure: always

on_failure: always
19 changes: 11 additions & 8 deletions cmake/lua.cmake
Expand Up @@ -38,27 +38,30 @@ macro ( install_lua_executable _name _source )
# 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
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 source as optional resurce
install ( FILES ${_source} DESTINATION ${INSTALL_FOO} COMPONENT Other )
else()
# Add .lua suffix and install as is
# Install into bin as is but without the lua suffix, we assume the executable uses UNIX shebang/hash-bang magic
install ( PROGRAMS ${_source} DESTINATION ${INSTALL_BIN}
RENAME ${_source_name}.lua
RENAME ${_source_name}
COMPONENT Runtime
)
endif()
Expand Down

0 comments on commit 3c9e87a

Please sign in to comment.