Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "Remove lua from cmake files."
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 28 Feb 2011 14:30:30 +0000 (14:30 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 28 Feb 2011 14:30:30 +0000 (14:30 +0000)
This reverts commit 90fe593afffadbd9a6741267f716795de4517ee8.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9739 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/AddTests.cmake
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/Distrib.cmake
buildtools/Cmake/MakeLib.cmake
buildtools/Cmake/Option.cmake
buildtools/Cmake/Pipol.cmake
buildtools/Cmake/PrintArgs.cmake

index de6a658..1f854de 100644 (file)
@@ -358,6 +358,18 @@ IF(HAVE_TRACING)
   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)
index d76704c..d9fd831 100644 (file)
@@ -23,6 +23,9 @@ endif(enable_gtnets)
 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)
index be8b4db..c485b48 100644 (file)
@@ -292,6 +292,12 @@ set(AMOK_SRC
        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
@@ -474,11 +480,26 @@ set(gras_sources
        ${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"
 )
@@ -597,7 +618,11 @@ file(GLOB_RECURSE add_src_files
 "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"
@@ -766,6 +791,7 @@ set(source_to_pack
        ${GRAS_COMMON_SRC}
        ${GRAS_SG_SRC}
        ${AMOK_SRC}
+       ${LUA_SRC}
        ${MC_SRC}
        ${JEDULE_SRC}
        ${RNGSTREAM_SRC}
index 546d80d..a17eb4d 100644 (file)
@@ -82,6 +82,23 @@ foreach(file ${examples_to_install_in_doc})
           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 ###
 ###########################################
@@ -118,6 +135,14 @@ COMMAND ${CMAKE_COMMAND} -E        echo "uninstall include ok"
 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      ###
index 71e42eb..e5902b8 100644 (file)
@@ -83,6 +83,32 @@ if(pthread)
        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")
index 6e3cbfc..c942375 100644 (file)
@@ -17,10 +17,12 @@ set(pipol_user ${pipol_user} CACHE TYPE INTERNAL FORCE)
 
 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)
index 22151fc..b01c574 100644 (file)
@@ -18,7 +18,11 @@ IF(pipol_user)
        
        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")
index c281f63..4f626b4 100644 (file)
@@ -91,6 +91,7 @@ if(NOT APPLE AND NOT WIN32)
 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("")