ADD_TEST(tracing-process-migration ${CMAKE_BINARY_DIR}/bin/tesh --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/procmig.tesh)
ENDIF(HAVE_TRACING)
+# Lua examples
+if(HAVE_LUA)
+ADD_TEST(lua-masterslave ${CMAKE_BINARY_DIR}/bin/tesh --cd ${CMAKE_HOME_DIRECTORY}/examples/lua master_slave.tesh)
+ADD_TEST(lua-mult-matrix ${CMAKE_BINARY_DIR}/bin/tesh --cd ${CMAKE_HOME_DIRECTORY}/examples/lua mult_matrix.tesh)
+ADD_TEST(lua-masterslave-bypass ${CMAKE_BINARY_DIR}/bin/tesh --cd ${CMAKE_HOME_DIRECTORY}/examples/lua master_slave_bypass.tesh)
+ADD_TEST(lua-msg-masterslave-console ${CMAKE_BINARY_DIR}/bin/tesh --cd ${CMAKE_BINARY_DIR}/examples/msg/masterslave --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave ${CMAKE_HOME_DIRECTORY}/examples/msg/masterslave/masterslave_console.tesh)
+set_tests_properties(lua-masterslave PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
+set_tests_properties(lua-mult-matrix PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
+set_tests_properties(lua-masterslave-bypass PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
+set_tests_properties(lua-msg-masterslave-console PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
+endif(HAVE_LUA)
+
# END TESH TESTS
if(enable_smpi)
if(enable_smpi)
include(FindF2c)
endif(enable_smpi)
+if(enable_lua)
+ include(FindLua51Simgrid)
+endif(enable_lua)
# Checks for header libraries functions.
CHECK_LIBRARY_EXISTS(pthread pthread_create "" pthread)
src/amok/PeerManagement/peermanagement.c
)
+set(LUA_SRC
+ src/bindings/lua/simgrid_lua.c
+ src/bindings/lua/lua_stub_generator.c
+ src/bindings/lua/lua_console.c
+)
+
set(TRACING_SRC
src/instr/instr_routing.c
src/instr/instr_config.c
${AMOK_SRC}
)
+if(${HAVE_LUA})
+ set(simgrid_sources
+ ${simgrid_sources}
+ ${LUA_SRC}
+ )
+elseif(${HAVE_LUA})
+ set(EXTRA_DIST
+ ${EXTRA_DIST}
+ ${LUA_SRC}
+ )
+endif(${HAVE_LUA})
+
file(GLOB_RECURSE examples_to_install_in_doc
"examples/*.c"
"examples/*.h"
"examples/*.cxx"
"examples/*.hpp"
+"examples/*.rb"
+"examples/*.lua"
+"examples/*.java"
"examples/*.xml"
"examples/*README"
)
"tools/*CMakeLists.txt"
"examples/*.c"
"examples/*.cxx"
+"examples/*.lua"
+"examples/*.rb"
"examples/*CMakeLists.txt"
+"src/bindings/*.lua"
+"src/bindings/*.rb"
"src/bindings/*.c"
"src/bindings/*.h"
"src/bindings/*CMakeLists.txt"
${GRAS_COMMON_SRC}
${GRAS_SG_SRC}
${AMOK_SRC}
+ ${LUA_SRC}
${MC_SRC}
${JEDULE_SRC}
${RNGSTREAM_SRC}
DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
endforeach(file ${examples_to_install_in_doc})
+# bindings cruft
+
+if(HAVE_LUA)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua/5.1")
+ add_custom_target(simgrid_lua ALL
+ DEPENDS simgrid
+ ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+ )
+ add_custom_command(
+ OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+ )
+ install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+ DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/lua/5.1
+ )
+endif(HAVE_LUA)
+
###########################################
### Fill in the "make uninstall" target ###
###########################################
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
)
+if(HAVE_LUA)
+ add_custom_command(TARGET uninstall
+ COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/simgrid.${LIB_EXE}
+ WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/"
+ )
+endif(HAVE_LUA)
+
################################################################
## Build a sain "make dist" target to build a source package ###
## containing only the files that I explicitely state ###
endif(${CONTEXT_THREADS})
endif(pthread)
+if(HAVE_LUA)
+ ADD_CUSTOM_TARGET(link_simgrid_lua ALL
+ DEPENDS simgrid
+ ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE}
+ ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE}
+ ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE}
+ )
+ add_custom_command(
+ OUTPUT ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE}
+ ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE}
+ ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE}
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/lua/
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/lua/simgrid.${LIB_EXE} #for test
+
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/msg/masterslave/
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/msg/masterslave/simgrid.${LIB_EXE} #for test
+
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/examples/simdag/
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/examples/simdag/simgrid.${LIB_EXE} #for test
+ )
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${LIB_LUA_NAME}")
+endif(HAVE_LUA)
+
if(HAVE_GRAPHVIZ)
if(HAVE_CGRAPH_LIB)
SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
option(enable_gtnets "Whether gtnets model is activated." on)
option(enable_smpi "This variable set smpi lib." on)
+option(enable_lua "Whether the lua bindings are activated." on)
option(enable_pcre "Whether the pcre lib is activated." on)
if(WIN32 OR APPLE)
set(enable_smpi off CACHE TYPE INTERNAL FORCE)
+set(enable_lua off CACHE TYPE INTERNAL FORCE)
endif(WIN32 OR APPLE)
option(enable_compile_optimizations "" on)
if(enable_smpi)
set(CMAKE_OPTIONS "${CMAKE_OPTIONS} -Denable_smpi=on")
- endif(enable_smpi)
+ endif(enable_smpi)
+
+ if(enable_lua)
+ set(CMAKE_OPTIONS "${CMAKE_OPTIONS} -Denable_lua=on")
+ endif(enable_lua)
if(enable_compile_optimizations)
set(CMAKE_OPTIONS "${CMAKE_OPTIONS} -Denable_compile_optimizations=on")
message(" Compile Gtnets : ${HAVE_GTNETS}")
message(" Gtnets path : ${gtnets_path}")
endif(NOT APPLE AND NOT WIN32)
+message(" Compile Lua : ${HAVE_LUA}")
message(" Compile Smpi : ${enable_smpi}")
message(" Compile Static : ${enable_lib_static}")
message("")