X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6d5bd9ae6e64d42fd7e6aac489774f5e253e1667..3a9a59b738162cb0c36779da79a674675c5a854b:/buildtools/Cmake/MakeExeLib.cmake diff --git a/buildtools/Cmake/MakeExeLib.cmake b/buildtools/Cmake/MakeExeLib.cmake index 4edd843e33..862e0ef1b2 100644 --- a/buildtools/Cmake/MakeExeLib.cmake +++ b/buildtools/Cmake/MakeExeLib.cmake @@ -1,21 +1,37 @@ ### Make Libs -include(FindSupernovae) -if(enable_supernovae AND HAVE_SUPERNOVAE_TOOLS) - include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake) -else(enable_supernovae AND HAVE_SUPERNOVAE_TOOLS) - add_library(simgrid SHARED ${simgrid_sources}) - add_library(gras SHARED ${gras_sources}) +# If we need supernovae, rewrite the lib content to use it +include(${PROJECT_DIRECTORY}/buildtools/Cmake/Supernovae.cmake) + +# Declare our libraries +add_library(simgrid SHARED ${simgrid_sources}) +add_library(gras SHARED ${gras_sources}) +if(enable_lib_static) + add_library(simgrid_static STATIC ${simgrid_sources}) +endif(enable_lib_static) +if(enable_smpi) + add_library(smpi SHARED ${SMPI_SRC}) + if(enable_lib_static) + add_library(smpi_static STATIC ${SMPI_SRC}) + endif(enable_lib_static) +endif(enable_smpi) + +# 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) if(enable_lib_static) - add_library(simgrid_static STATIC ${simgrid_sources}) + add_dependencies(simgrid_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_sg.c) endif(enable_lib_static) + add_dependencies(gras ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_gras.c) + if(enable_smpi) - add_library(smpi SHARED ${SMPI_SRC}) + add_dependencies(smpi ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c) if(enable_lib_static) - add_library(smpi_static STATIC ${SMPI_SRC}) + add_dependencies(smpi_static ${CMAKE_CURRENT_BINARY_DIR}/src/supernovae_smpi.c) endif(enable_lib_static) endif(enable_smpi) -endif(enable_supernovae AND HAVE_SUPERNOVAE_TOOLS) +endif(enable_supernovae) + set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version}) set_target_properties(gras PROPERTIES VERSION ${libgras_version}) @@ -23,19 +39,19 @@ 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 "") +set(GRAS_LDEP "-lm -lpthread") +set(SIMGRID_LDEP "-lm") +set(SMPI_LDEP "") if(APPLE) - set(SMPI_DEP "-Wl,-U -Wl,_smpi_simulated_main") + set(SMPI_LDEP "-Wl,-U -Wl,_smpi_simulated_main") endif(APPLE) if(HAVE_PCRE_LIB) - SET(SIMGRID_DEP "${SIMGRID_DEP} -lpcre") + SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lpcre") endif(HAVE_PCRE_LIB) if(HAVE_RUBY) - set(SIMGRID_DEP "${SIMGRID_DEP} -l${RUBY_LIBRARY_NAME} -module") + set(SIMGRID_LDEP "${SIMGRID_LDEP} -l${RUBY_LIBRARY_NAME} -module") endif(HAVE_RUBY) if(CMAKE_SYSTEM_NAME MATCHES "Darwin") @@ -44,53 +60,53 @@ endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") if(pthread) if(with_context MATCHES pthread) - SET(SIMGRID_DEP "${SIMGRID_DEP} -lpthread") + SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lpthread") endif(with_context MATCHES pthread) if(with_context MATCHES windows) - SET(GRAS_DEP "msg") + SET(GRAS_LDEP "msg") endif(with_context MATCHES windows) endif(pthread) if(HAVE_LUA) - SET(SIMGRID_DEP "${SIMGRID_DEP} -ldl -l${LIB_LUA_NAME}") + SET(SIMGRID_LDEP "${SIMGRID_LDEP} -ldl -l${LIB_LUA_NAME}") endif(HAVE_LUA) if(HAVE_GRAPHVIZ) if(HAVE_CGRAPH_LIB) - SET(SIMGRID_DEP "${SIMGRID_DEP} -lcgraph") + SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lcgraph") else(HAVE_CGRAPH_LIB) if(HAVE_AGRAPH_LIB) - SET(SIMGRID_DEP "${SIMGRID_DEP} -lagraph -lcdt") + SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lagraph -lcdt") endif(HAVE_AGRAPH_LIB) endif(HAVE_CGRAPH_LIB) endif(HAVE_GRAPHVIZ) if(HAVE_GTNETS) - SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets") + SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lgtnets") endif(HAVE_GTNETS) if(HAVE_POSIX_GETTIME) - SET(SIMGRID_DEP "${SIMGRID_DEP} -lrt") - SET(GRAS_DEP "${GRAS_DEP} -lrt") + SET(SIMGRID_LDEP "${SIMGRID_LDEP} -lrt") + SET(GRAS_LDEP "${GRAS_LDEP} -lrt") endif(HAVE_POSIX_GETTIME) -target_link_libraries(simgrid ${SIMGRID_DEP}) -target_link_libraries(gras ${GRAS_DEP}) +target_link_libraries(simgrid ${SIMGRID_LDEP}) +target_link_libraries(gras ${GRAS_LDEP}) add_dependencies(gras maintainer_files) add_dependencies(simgrid maintainer_files) if(enable_smpi) - target_link_libraries(smpi simgrid ${SMPI_DEP}) + target_link_libraries(smpi simgrid ${SMPI_LDEP}) endif(enable_smpi) if(enable_lib_static) - target_link_libraries(simgrid_static ${SIMGRID_DEP}) + target_link_libraries(simgrid_static ${SIMGRID_LDEP}) add_dependencies(simgrid_static maintainer_files) set_target_properties(simgrid_static PROPERTIES OUTPUT_NAME simgrid) if(enable_smpi) - target_link_libraries(smpi_static simgrid ${SMPI_DEP}) + target_link_libraries(smpi_static simgrid ${SMPI_LDEP}) set_target_properties(smpi_static PROPERTIES OUTPUT_NAME smpi) endif(enable_smpi) endif(enable_lib_static)