Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add simgrid dependency for bindings.
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
index 9599930..58046e1 100644 (file)
@@ -1,57 +1,42 @@
 ### Make Libs
-if(WIN32)
-  foreach(file ${simgrid_sources})
-    set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "/D DLL_EXPORT")
-  endforeach(file ${simgrid_sources})
-  foreach(file ${gras_sources})
-    set_source_files_properties(${file} PROPERTIES COMPILE_FLAGS "/D DLL_EXPORT")
-  endforeach(file ${gras_sources})
-endif(WIN32)
-
-if(enable_supernovae AND NOT WIN32)
+
+if(enable_supernovae)
        include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
-else(enable_supernovae AND NOT WIN32)  
+else(enable_supernovae)        
        add_library(simgrid SHARED ${simgrid_sources})
        add_library(simgrid_static STATIC ${simgrid_sources})
        add_library(gras SHARED ${gras_sources})
        if(enable_smpi)
                add_library(smpi SHARED ${SMPI_SRC})
        endif(enable_smpi)
-endif(enable_supernovae AND NOT WIN32)
+endif(enable_supernovae)
 
 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
 set_target_properties(gras PROPERTIES VERSION ${libgras_version})
+
 if(enable_smpi)
        set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
 endif(enable_smpi)
 
-if(WIN32)
-       set(GRAS_DEP "wsock32")
-       set(SIMGRID_DEP "wsock32")
-else(WIN32)
-    set(GRAS_DEP "-lm -lpthread")
-    set(SIMGRID_DEP "-lm")
-    set(SMPI_DEP "")
-endif(WIN32)
+set(GRAS_DEP "-lm -lpthread")
+set(SIMGRID_DEP "-lm")
+set(SMPI_DEP "")
 
 if(HAVE_RUBY)
        set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module")
-       exec_program("${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so" 
-                   "${PROJECT_DIRECTORY}"  
-                   OUTPUT_VARIABLE IGNORED)
-       
-       # Make sure this extra link will get cleaned
-        get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
-        set_directory_properties(
-           PROPERTIES
-           ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${PROJECT_DIRECTORY}/src/bindings/ruby/libsimgrid.so")
+       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)
 endif(HAVE_RUBY)
 
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
        add_definitions("-D_XOPEN_SOURCE")
 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
 
-
 if(pthread)
        if(with_context MATCHES pthread)
                SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
@@ -63,18 +48,20 @@ if(pthread)
 endif(pthread)
 
 if(HAVE_LUA)
-       SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${liblua}")
-       exec_program("${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib/libsimgrid.so ${PROJECT_DIRECTORY}/examples/lua/simgrid.so" 
-                     "${PROJECT_DIRECTORY}"
-                     OUTPUT_VARIABLE IGNORED)
-                    
-       # Make sure this extra link will get cleaned
-        get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
-        set_directory_properties(
-           PROPERTIES
-           ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${PROJECT_DIRECTORY}/examples/lua/simgrid.so")
+       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..."
+       )
+       ADD_CUSTOM_TARGET(link_simgrid_lua ALL
+                         DEPENDS simgrid ${PROJECT_DIRECTORY}/examples/lua/simgrid.so)
 endif(HAVE_LUA)
 
+if(HAVE_CGRAPH_H)
+       SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
+endif(HAVE_CGRAPH_H)
+
 if(HAVE_GTNETS)
        SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
 endif(HAVE_GTNETS)
@@ -87,11 +74,15 @@ endif(HAVE_POSIX_GETTIME)
 target_link_libraries(simgrid  ${SIMGRID_DEP})
 target_link_libraries(simgrid_static   ${SIMGRID_DEP})
 target_link_libraries(gras     ${GRAS_DEP})
+
+add_dependencies(gras maintainer_files)
+add_dependencies(simgrid maintainer_files)
+add_dependencies(simgrid_static maintainer_files)
+                               
 if(enable_smpi)
        target_link_libraries(smpi      simgrid ${SMPI_DEP})
 endif(enable_smpi)
 
-
 ### Make EXEs
 
 #src/testall
@@ -164,9 +155,12 @@ add_subdirectory(${PROJECT_DIRECTORY}/examples/amok/saturate)
 
 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
+if(HAVE_CGRAPH_H)
+add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dot)
+endif(HAVE_CGRAPH_H)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/metaxml)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/properties)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/scheduling)
 if(enable_smpi)
        add_subdirectory(${PROJECT_DIRECTORY}/examples/smpi)
-endif(enable_smpi)
\ No newline at end of file
+endif(enable_smpi)