endif(enable_model-checking AND HAVE_MMAP)
if(enable_lua)
- include(FindLua51)
+ include(FindLua51Simgrid)
if(LUA51_FOUND)
set(HAVE_LUA 1)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${LUA_INCLUDE_DIR} ")
- foreach(path_lua ${LUA_LIBRARIES})
- string(REGEX REPLACE "liblua.*" "" path_lua_to_use ${path_lua})
- string(REGEX MATCH ".*lua.*" operation "${path_lua}")
- if(operation)
- string(REGEX REPLACE "${path_lua_to_use}" "" liblua ${path_lua})
- string(REPLACE "lib" "" liblua "${liblua}")
- string(REGEX REPLACE "[.][^.]*$" "" liblua "${liblua}")
- endif(operation)
- endforeach(path_lua ${LUA_LIBRARIES})
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${LUA_LIBRARY_DIR} ")
else(LUA51_FOUND)
message("Lua binding need version 5.1 and cmake version 2.8")
message("Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
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}
+ ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.so
)
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}
+ 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
)
- install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.${LIB_EXE}
+ install(FILES ${CMAKE_BINARY_DIR}/lib/lua/5.1/simgrid.so
DESTINATION $ENV{DESTDIR}${prefix}/lib/lua/5.1
)
endif(HAVE_LUA)
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.${LIB_EXE}
+ ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.so
)
add_custom_command(
- 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}
+ 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
)
- install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.${LIB_EXE}
+ install(FILES ${CMAKE_BINARY_DIR}/lib/ruby/${install_link_ruby}/libsimgrid.so
DESTINATION $ENV{DESTDIR}${prefix}/lib/ruby/${install_link_ruby}/
)
install(FILES ${PROJECT_DIRECTORY}/src/bindings/ruby/simgrid.rb
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.${LIB_EXE}
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${prefix}/lib/lua/5.1/simgrid.so
WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
)
endif(HAVE_LUA)
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.${LIB_EXE}
+ 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}/simgrid.rb
WORKING_DIRECTORY "${PROJECT_DIRECTORY}/"
)
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.${LIB_EXE}
+ DEPENDS simgrid ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
)
add_custom_command(
- 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}
+ 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
)
endif(HAVE_RUBY)
endif(pthread)
if(HAVE_LUA)
- SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${LIB_LUA_NAME}")
ADD_CUSTOM_TARGET(link_simgrid_lua ALL
DEPENDS simgrid
- ${PROJECT_DIRECTORY}/examples/lua/simgrid.${LIB_EXE}
- ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.${LIB_EXE}
- ${PROJECT_DIRECTORY}/examples/simdag/simgrid.${LIB_EXE}
+ ${PROJECT_DIRECTORY}/examples/lua/simgrid.so
+ ${PROJECT_DIRECTORY}/examples/msg/masterslave/simgrid.so
+ ${PROJECT_DIRECTORY}/examples/simdag/simgrid.so
)
add_custom_command(
- 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
+ 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
- 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/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/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
+ 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
)
endif(HAVE_LUA)
--- /dev/null
+find_path(HAVE_LUA_H lua.h
+ HINTS
+ $ENV{LD_LIBRARY_PATH}
+ PATH_SUFFIXES lua/ lua/5.1/ include
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr
+)
+
+find_library(HAVE_LUA51_LIB
+ NAME lua.5.1 lua5.1
+ HINTS
+ $ENV{LD_LIBRARY_PATH}
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr
+)
+
+set(LIB_LUA_NAME ${HAVE_LUA51_LIB})
+string(REGEX MATCH "liblua.*$" LIB_LUA_NAME "${LIB_LUA_NAME}")
+string(REPLACE ".${LIB_EXE}" "" LIB_LUA_NAME "${LIB_LUA_NAME}")
+string(REPLACE "lib" "" LIB_LUA_NAME "${LIB_LUA_NAME}")
+
+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(CMAKE_SYSTEM_NAME MATCHES "Darwin")
option(enable_gtnets "Whether gtnets model is activated." on)
option(enable_java "Whether the Java bindings are activated." on)
+if(WIN32 OR APPLE)
+option(enable_lua "Whether the lua bindings are activated." off)
+option(enable_ruby "Whether the Ruby bindings are activated." off)
+else(WIN32 OR APPLE)
option(enable_lua "Whether the lua bindings are activated." on)
option(enable_ruby "Whether the Ruby bindings are activated." on)
+endif(WIN32 OR APPLE)
option(enable_doc "Whether we should rebuild the documentation" off)
option(enable_compile_optimizations "" off)
option(enable_compile_warnings "Whether compilation warnings should be turned into errors." off)
if(WIN32 OR APPLE) #actually not enable with windows and Apple
message("-- Mode supernovae and maintainer are disabled.")
- message("-- Model checking is disabled.")
- message("-- Smpi, Ruby, Lua and GTnets are disabled.")
+ message("-- Smpi and GTnets are disabled.")
set(enable_supernovae false CACHE TYPE INTERNAL FORCE)
set(enable_maintainer_mode false CACHE TYPE INTERNAL FORCE)
- set(enable_lua false CACHE TYPE INTERNAL FORCE)
- set(enable_ruby false CACHE TYPE INTERNAL FORCE)
set(enable_smpi false CACHE TYPE INTERNAL FORCE)
set(enable_gtnets false CACHE TYPE INTERNAL FORCE)
- set(enable_model-checking false CACHE TYPE INTERNAL FORCE)
mark_as_advanced(enable_supernovae)
mark_as_advanced(enable_maintainer_mode)
- mark_as_advanced(enable_lua)
- mark_as_advanced(enable_ruby)
mark_as_advanced(enable_smpi)
mark_as_advanced(enable_gtnets)
mark_as_advanced(gtnets_path)
- mark_as_advanced(enable_model-checking)
endif(WIN32 OR APPLE)
+
if(enable_supernovae AND enable_model-checking)
set(enable_model-checking false CACHE TYPE INTERNAL FORCE)
message("\n\nWith supernovae mode the model checking must be disable.!!!\n\n")
mark_as_advanced(LUA_LIB_PATH_3)
mark_as_advanced(HAVE_LUA5_1_LAUXLIB_H)
mark_as_advanced(HAVE_LUA5_1_LUALIB_H)
+mark_as_advanced(HAVE_LUA51_LIB)
+mark_as_advanced(HAVE_LUA_H)
mark_as_advanced(RUBY_LIB_PATH_1)
mark_as_advanced(RUBY_LIB_PATH_2)
mark_as_advanced(CLEAR gtnets_path)
endif(enable_java)
if(enable_lua)
message("")
- message("LUA_INCLUDE_DIR : ${LUA_INCLUDE_DIR}")
- message("LIBLUA : ${liblua}")
+ message("HAVE_LUA_H = ${HAVE_LUA_H}")
+ message("HAVE_LUA51_LIB = ${HAVE_LUA51_LIB}")
+ message("LUA_INCLUDE_DIR = ${LUA_INCLUDE_DIR}")
+ message("LIB_LUA_NAME = ${LIB_LUA_NAME}")
+ message("LUA_LIBRARY_DIR = ${LUA_LIBRARY_DIR}")
+
endif(enable_lua)
if(enable_memcheck)
message("")
message(" Gtnets path : ${gtnets_path}")
endif(NOT APPLE AND NOT WIN32)
message(" Compile Java : ${HAVE_JAVA}")
-if(NOT APPLE AND NOT WIN32)
message(" Compile Lua : ${HAVE_LUA}")
message(" Compile Ruby : ${HAVE_RUBY}")
+if(NOT APPLE AND NOT WIN32)
message(" Compile Smpi : ${enable_smpi}")
endif(NOT APPLE AND NOT WIN32)
message(" Compile Static : ${enable_lib_static}")
if(NOT APPLE AND NOT WIN32)
message(" Maintainer mode: ${enable_maintainer_mode}")
message(" Supernovae mode: ${enable_supernovae}")
-message(" Model checking : ${enable_model-checking}")
endif(NOT APPLE AND NOT WIN32)
+message(" Model checking : ${enable_model-checking}")
message(" Tracing mode : ${enable_tracing}")
message(" Latency bound : ${enable_latency_bound_tracking}")
message(" Graphviz mode : ${enable_graphviz}")
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.${LIB_EXE}
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.${LIB_EXE} ${CMAKE_HOME_DIRECTORY}/examples/gras/console/simgrid.${LIB_EXE}
+ ${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
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
)
-
-
### Add definitions for compile
target_link_libraries(ping_simulator_console simgrid pthread m )