Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove the link before creating it
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
index 1bd3ded..34890fb 100644 (file)
@@ -8,6 +8,7 @@ else(enable_supernovae)
        add_library(gras SHARED ${gras_sources})
        if(enable_smpi)
                add_library(smpi SHARED ${SMPI_SRC})
+               add_library(smpi_static STATIC ${SMPI_SRC})
        endif(enable_smpi)
 endif(enable_supernovae)
 
@@ -22,15 +23,20 @@ set(GRAS_DEP "-lm -lpthread")
 set(SIMGRID_DEP "-lm")
 set(SMPI_DEP "")
 
+if(HAVE_PCRE_LIB)
+       SET(SIMGRID_DEP "${SIMGRID_DEP} -lpcre")
+endif(HAVE_PCRE_LIB)
+
 if(HAVE_RUBY)
        set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
-       ADD_CUSTOM_COMMAND(
-         OUTPUT ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
-         COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so
-         COMMENT "Generating libsimgrid.so link for binding ruby..."
-       )
        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.${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)
 
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
@@ -48,14 +54,27 @@ if(pthread)
 endif(pthread)
 
 if(HAVE_LUA)
-       SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")      
-    ADD_CUSTOM_COMMAND(
-         OUTPUT ${PROJECT_DIRECTORY}/examples/lua/simgrid.so
-         COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so
-         COMMENT "Generating libsimgrid.so link for binding lua..."
+       SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")   
+         
+    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}
+       )
+       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
+               
+               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.${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                      
        )
-       ADD_CUSTOM_TARGET(link_simgrid_lua ALL
-                         DEPENDS simgrid ${PROJECT_DIRECTORY}/examples/lua/simgrid.so)
 endif(HAVE_LUA)
 
 if(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
@@ -81,6 +100,7 @@ add_dependencies(simgrid_static maintainer_files)
                                
 if(enable_smpi)
        target_link_libraries(smpi      simgrid ${SMPI_DEP})
+       target_link_libraries(smpi_static simgrid ${SMPI_DEP})
 endif(enable_smpi)
 
 ### Make EXEs
@@ -129,6 +149,7 @@ add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/all2all)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/pmm)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/synchro)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/properties)
+add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/console)
 
 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/properties)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/actions)