Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add verification for LUA_CPATH for use require.
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 22 Nov 2010 14:15:49 +0000 (14:15 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 22 Nov 2010 14:15:49 +0000 (14:15 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8593 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/Distrib.cmake
buildtools/Cmake/MakeExeLib.cmake
buildtools/Cmake/Modules/FindLua51Simgrid.cmake
examples/gras/console/CMakeLists.txt

index d8de077..7f3375d 100644 (file)
@@ -78,13 +78,13 @@ 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.so
+                               ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
                )
        add_custom_command(
-               OUTPUT ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.so
-               COMMAND ${CMAKE_COMMAND} -E create_symlink ../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.so
+               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.so
+       install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
                DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
                )
 endif(HAVE_LUA)
@@ -94,13 +94,13 @@ if(HAVE_RUBY)
        file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}")
        add_custom_target(ruby_simgrid ALL
                DEPENDS simgrid
-                               ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.so
+                               ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
        )
        add_custom_command(
-               OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.so
-               COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.so
+               OUTPUT ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
+               COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../libsimgrid.${LIB_EXE} ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
        )
-       install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.so
+       install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
                DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/
        )
        install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
@@ -151,7 +151,7 @@ endif(HAVE_JAVA)
 if(HAVE_LUA)
        add_custom_command(TARGET uninstall
        COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding lua ok"
-       COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.so
+       COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.${LIB_EXE}
        WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
        )
 endif(HAVE_LUA)
@@ -160,7 +160,7 @@ if(HAVE_RUBY)
        string(REGEX REPLACE "^.*ruby/" "" install_link_ruby "${RUBY_ARCH_DIR}")
        add_custom_command(TARGET uninstall
        COMMAND ${CMAKE_COMMAND} -E echo "uninstall binding ruby ok"
-       COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.so
+       COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
        COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/ruby/${install_link_ruby}/simgrid.rb
        WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
        )
index 122efde..0972ce1 100644 (file)
@@ -33,12 +33,12 @@ endif(HAVE_PCRE_LIB)
 if(HAVE_RUBY)
        set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
        ADD_CUSTOM_TARGET(link_simgrid_ruby ALL
-         DEPENDS simgrid ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
+         DEPENDS simgrid ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.${LIB_EXE}
          )
        add_custom_command(
-               OUTPUT ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
-               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so # if it exists, creating the link fails. So cleanup before hand
-               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
+               OUTPUT ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.${LIB_EXE}
+               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
+               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.${LIB_EXE}
        )
 endif(HAVE_RUBY)
 
@@ -61,22 +61,22 @@ if(HAVE_LUA)
          
     ADD_CUSTOM_TARGET(link_simgrid_lua ALL
       DEPENDS  simgrid
-                       ${PROJECT_DIRECTORY}/examples/lua/simgrid.so
-                               ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so
-                               ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so
+                       ${PROJECT_DIRECTORY}/examples/lua/simgrid.${LIB_EXE}
+                               ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.${LIB_EXE}
+                               ${PROJECT_DIRECTORY}/examples/simdag/simgrid.${LIB_EXE}
        )
        add_custom_command(
-               OUTPUT  ${PROJECT_DIRECTORY}/examples/lua/simgrid.so
-                               ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so
-                               ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so
-               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/examples/lua/simgrid.so # if it exists, creating the link fails. So cleanup before hand
-               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/examples/lua/simgrid.so #for test
+               OUTPUT  ${PROJECT_DIRECTORY}/examples/lua/simgrid.${LIB_EXE}
+                               ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.${LIB_EXE}
+                               ${PROJECT_DIRECTORY}/examples/simdag/simgrid.${LIB_EXE}
+               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/examples/lua/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
+               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/examples/lua/simgrid.${LIB_EXE} #for test
                
-               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so # if it exists, creating the link fails. So cleanup before hand
-               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so #for test
+               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
+               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.${LIB_EXE} #for test
                
-               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so # if it exists, creating the link fails. So cleanup before hand
-               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so #for test                      
+               COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_DIRECTORY}/examples/simdag/simgrid.${LIB_EXE} # if it exists, creating the link fails. So cleanup before hand
+               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${PROJECT_DIRECTORY}/examples/simdag/simgrid.${LIB_EXE} #for test                      
        )
 endif(HAVE_LUA)
 
index d68bb18..36ab3c4 100644 (file)
@@ -32,4 +32,14 @@ if(HAVE_LUA_H AND HAVE_LUA51_LIB AND LIB_LUA_NAME)
  set(LUA51_FOUND 1)
  string(REPLACE "/lua.h" "" LUA_INCLUDE_DIR ${HAVE_LUA_H})
  string(REPLACE "/lib${LIB_LUA_NAME}.${LIB_EXE}" "" LUA_LIBRARY_DIR ${HAVE_LUA51_LIB})
-endif(HAVE_LUA_H AND HAVE_LUA51_LIB AND LIB_LUA_NAME)
\ No newline at end of file
+endif(HAVE_LUA_H AND HAVE_LUA51_LIB AND LIB_LUA_NAME)
+
+set(LUA_CPATH "$ENV{LUA_CPATH}")
+string(REGEX MATCH "${LIB_EXE}" LUA_CPATH "${LUA_CPATH}")
+
+if(LUA_CPATH AND APPLE)
+    message("-- LUA_CPATH have extension ${LIB_EXE}")
+else(DEFINED LUA_CPATH AND APPLE)
+    message("-- Please set LUA_CPATH with extension ${LIB_EXE}")
+    message("-- For example, execute command line : export LUA_CPATH=\"./?.dylib\"")
+endif(LUA_CPATH AND APPLE)
\ No newline at end of file
index f943e99..8ebaf02 100644 (file)
@@ -25,8 +25,8 @@ add_custom_command(
                                        OUTPUT  ${CMAKE_CURRENT_SOURCE_DIR}/_ping_simulator.c 
                                                ${CMAKE_CURRENT_SOURCE_DIR}/_ping_client.c 
                                                        ${CMAKE_CURRENT_SOURCE_DIR}/_ping_server.c
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/gras/console/simgrid.so
-                                       COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_HOME_DIRECTORY}/examples/gras/console/simgrid.so
+                                                       ${CMAKE_HOME_DIRECTORY}/examples/gras/console/simgrid.${LIB_EXE}
+                                       COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_HOME_DIRECTORY}/examples/gras/console/simgrid.${LIB_EXE}
                                        COMMAND lua ${CMAKE_CURRENT_SOURCE_DIR}/ping_generator.lua
                                        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} #needed to find simgrid.so. By default CMAKE_CURRENT_BINARY_DIR
                                        )