Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Declare LOG_DEFAULT_CATEGORY with LOG_NEW_DEFAULT_SUBCATEGORY.
[simgrid.git] / buildtools / Cmake / MakeExeLib.cmake
index 4649640b6869b558d9dcd5b047986fff915d8579..9599930f7a78ddb3c3d131062b7e22c47b97feab 100644 (file)
@@ -1,7 +1,15 @@
 ### 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)
-       include(${PROJECT_DIRECTORY}/buildtools/Cmake/src/CMakeSupernovae.txt)
+       include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
 else(enable_supernovae AND NOT WIN32)  
        add_library(simgrid SHARED ${simgrid_sources})
        add_library(simgrid_static STATIC ${simgrid_sources})
@@ -17,18 +25,26 @@ if(enable_smpi)
        set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
 endif(enable_smpi)
 
-
-set(GRAS_DEP "-lm -lpthread")
-set(SIMGRID_DEP "-lm")
-set(SMPI_DEP "")
-
 if(WIN32)
-       set(GRAS_DEP "-lm")
+       set(GRAS_DEP "wsock32")
+       set(SIMGRID_DEP "wsock32")
+else(WIN32)
+    set(GRAS_DEP "-lm -lpthread")
+    set(SIMGRID_DEP "-lm")
+    set(SMPI_DEP "")
 endif(WIN32)
 
 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 LIEN_OK)
+       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")
 endif(HAVE_RUBY)
 
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
@@ -48,7 +64,15 @@ 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 LIEN_OK)
+       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")
 endif(HAVE_LUA)
 
 if(HAVE_GTNETS)
@@ -60,11 +84,11 @@ if(HAVE_POSIX_GETTIME)
        SET(GRAS_DEP "${GRAS_DEP} -lrt")
 endif(HAVE_POSIX_GETTIME)
 
-target_link_libraries(simgrid  ${SIMGRID_DEP} -fprofile-arcs)
-target_link_libraries(simgrid_static   ${SIMGRID_DEP} -fprofile-arcs)
-target_link_libraries(gras     ${GRAS_DEP} -fprofile-arcs)
+target_link_libraries(simgrid  ${SIMGRID_DEP})
+target_link_libraries(simgrid_static   ${SIMGRID_DEP})
+target_link_libraries(gras     ${GRAS_DEP})
 if(enable_smpi)
-       target_link_libraries(smpi      simgrid ${SMPI_DEP} -fprofile-arcs)
+       target_link_libraries(smpi      simgrid ${SMPI_DEP})
 endif(enable_smpi)
 
 
@@ -125,7 +149,11 @@ add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/priority)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/masterslave)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/trace)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/tracing)
-add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
+
+if(HAVE_MC)
+       add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/mc)
+endif(HAVE_MC)
+
 if(HAVE_GTNETS)
        add_definitions("-lgtnets -L${gtnets_path}/lib -I${gtnets_path}/include/gtnets")
        add_subdirectory(${PROJECT_DIRECTORY}/examples/msg/gtnets)
@@ -138,6 +166,7 @@ add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag)
 add_subdirectory(${PROJECT_DIRECTORY}/examples/simdag/dax)
 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