### Make Libs
-# If we need supernovae, rewrite the lib content to use it
+
+# Try to make Mac a bit more complient to open source standards
+if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ add_definitions("-D_XOPEN_SOURCE")
+endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+
+###############################
+# Declare the library content #
+###############################
+# If we want supernovae, rewrite the libs' content to use it
include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake)
-# Declare our libraries
+# Actually declare our libraries
+
add_library(simgrid SHARED ${simgrid_sources})
+set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
+
add_library(gras SHARED ${gras_sources})
+set_target_properties(gras PROPERTIES VERSION ${libgras_version})
+
if(enable_lib_static)
add_library(simgrid_static STATIC ${simgrid_sources})
endif(enable_lib_static)
+
if(enable_smpi)
add_library(smpi SHARED ${SMPI_SRC})
+ set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version})
if(enable_lib_static)
add_library(smpi_static STATIC ${SMPI_SRC})
endif(enable_lib_static)
endif(enable_smpi)
+add_dependencies(gras maintainer_files)
+add_dependencies(simgrid maintainer_files)
+
# if supernovaeing, we need some depends to make sure that the source gets generated
if (enable_supernovae)
add_dependencies(simgrid ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c)
endif(enable_smpi)
endif(enable_supernovae)
+# Compute the dependencies of GRAS
+##################################
+set(GRAS_DEP "-lm -lpthread")
-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(HAVE_POSIX_GETTIME)
+ SET(GRAS_DEP "${GRAS_DEP} -lrt")
+endif(HAVE_POSIX_GETTIME)
-set(GRAS_LDEP "-lm -lpthread")
-set(SIMGRID_LDEP "-lm")
-set(SMPI_LDEP "")
-if(APPLE)
- set(SMPI_LDEP "-Wl,-U -Wl,_smpi_simulated_main")
-endif(APPLE)
+# the following is probably unneed since it kills the previous
+# GRAS_DEP (and is thus probably invalid).
+# My guess is that pthread is never true [Mt]
+# FIXME: KILLME if we get a working windows with that?
+if(pthread AND (with_context MATCHES windows))
+ SET(GRAS_DEP "msg")
+endif(pthread AND (with_context MATCHES windows))
+
+target_link_libraries(gras ${GRAS_DEP})
+# Compute the dependencies of SimGrid
+#####################################
+set(SIMGRID_DEP "-lm")
if(HAVE_PCRE_LIB)
- SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lpcre")
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lpcre")
endif(HAVE_PCRE_LIB)
-
if(HAVE_RUBY)
- set(SIMGRID_LDEP "${SIMGRID_LDEP} -l${RUBY_LIBRARY_NAME} -module")
+ set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME}")
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_LDEP "${SIMGRID_LDEP} -lpthread")
- endif(with_context MATCHES pthread)
-
- if(with_context MATCHES windows)
- SET(GRAS_LDEP "msg")
- endif(with_context MATCHES windows)
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
+ endif(with_context MATCHES pthread)
endif(pthread)
if(HAVE_LUA)
- SET(SIMGRID_LDEP "${SIMGRID_LDEP} -ldl -l${LIB_LUA_NAME}")
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${LIB_LUA_NAME}")
endif(HAVE_LUA)
if(HAVE_GRAPHVIZ)
-
if(HAVE_CGRAPH_LIB)
- SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lcgraph")
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph")
else(HAVE_CGRAPH_LIB)
if(HAVE_AGRAPH_LIB)
- SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lagraph -lcdt")
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lagraph -lcdt")
endif(HAVE_AGRAPH_LIB)
- endif(HAVE_CGRAPH_LIB)
-
+ endif(HAVE_CGRAPH_LIB)
endif(HAVE_GRAPHVIZ)
if(HAVE_GTNETS)
- SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lgtnets")
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
endif(HAVE_GTNETS)
if(HAVE_POSIX_GETTIME)
- SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lrt")
- SET(GRAS_LDEP "${GRAS_LDEP} -lrt")
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt")
endif(HAVE_POSIX_GETTIME)
-target_link_libraries(simgrid ${SIMGRID_LDEP})
-target_link_libraries(gras ${GRAS_LDEP})
-add_dependencies(gras maintainer_files)
-add_dependencies(simgrid maintainer_files)
+target_link_libraries(simgrid ${SIMGRID_DEP})
+
+# Compute the dependencies of SMPI
+##################################
+set(SMPI_LDEP "")
+if(APPLE)
+ set(SMPI_LDEP "-Wl,-U -Wl,_smpi_simulated_main")
+endif(APPLE)
if(enable_smpi)
target_link_libraries(smpi simgrid ${SMPI_LDEP})
endif(enable_smpi)
+# Pass dependencies to static libs
+##################################
if(enable_lib_static)
- target_link_libraries(simgrid_static ${SIMGRID_LDEP})
+ target_link_libraries(simgrid_static ${SIMGRID_DEP})
add_dependencies(simgrid_static maintainer_files)
set_target_properties(simgrid_static PROPERTIES OUTPUT_NAME simgrid)
if(enable_smpi)
endif(enable_smpi)
endif(enable_lib_static)
-### Make EXEs
-
-#tools/gras
+###################################################################
+### Load all files declaring binaries (tools, examples and tests) #
+###################################################################
add_subdirectory(${PROJECT_DIRECTORY}/tools/gras)
-
-#tools/tesh
add_subdirectory(${PROJECT_DIRECTORY}/tools/tesh)
-#testsuite/xbt
add_subdirectory(${PROJECT_DIRECTORY}/testsuite/xbt)
-
-#testsuite/surf
add_subdirectory(${PROJECT_DIRECTORY}/testsuite/surf)
-
-#testsuite/simdag
add_subdirectory(${PROJECT_DIRECTORY}/testsuite/simdag)
-
-#teshsuite
add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/xbt)
add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/datadesc)
add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/gras/msg_handle)
add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/simdag/platforms)
add_subdirectory(${PROJECT_DIRECTORY}/teshsuite/msg)
-#examples
add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/ping)
add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/rpc)
add_subdirectory(${PROJECT_DIRECTORY}/examples/gras/spawn)
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)