From: unknown Date: Thu, 12 Jan 2012 16:24:58 +0000 (+0100) Subject: Add a dll for simgrid and protect DLL_EXPORT and DLL_IMPORT from multiple definition X-Git-Tag: exp_20120216~138 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1c76cada7536a194addfbf668f4367f390fe8aed?hp=20d600a51884e28a4e966a12492a16502529115c;ds=sidebyside Add a dll for simgrid and protect DLL_EXPORT and DLL_IMPORT from multiple definition --- diff --git a/buildtools/Cmake/MakeLibWin.cmake b/buildtools/Cmake/MakeLibWin.cmake index 8e3f46308c..4ffd5a4fef 100644 --- a/buildtools/Cmake/MakeLibWin.cmake +++ b/buildtools/Cmake/MakeLibWin.cmake @@ -1,14 +1,16 @@ ### Make Libs #>gcc c:\simgrid-trunk\examples\msg\icomms\peer.c -static -Lc:\simgrid-trunk\lib -lsimgrid -Ic:\simgrid-trunk\include -lwsock32 add_library(simgrid STATIC ${simgrid_sources}) +add_library(simgrid_shared SHARED ${simgrid_sources}) add_library(gras STATIC ${gras_sources}) -set_target_properties(gras PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC" - OUTPUT_NAME "gras") -set_target_properties(simgrid PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC" OUTPUT_NAME "simgrid") +set_target_properties(gras PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC -DDLL_STATIC" VERSION ${libgras_version} OUTPUT_NAME "gras") +set_target_properties(simgrid PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC -DDLL_STATIC" VERSION ${libsimgrid_version} OUTPUT_NAME "simgrid") +set_target_properties(simgrid_shared PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" VERSION ${libsimgrid_version} OUTPUT_NAME "simgrid") set(GRAS_DEP "ws2_32 -lpthread") set(SIMGRID_DEP "ws2_32 -lpcre -lpthread") +set(SIMGRID_SHARED_DEP "ws2_32 -lpthread") if(ARCH_32_BITS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486") @@ -16,5 +18,13 @@ else(ARCH_32_BITS) message(FATAL_ERROR "Sorry, Simgrid fails with full 64bits for now! Please contact us.") endif(ARCH_32_BITS) +target_link_libraries(gras ${GRAS_DEP}) target_link_libraries(simgrid ${SIMGRID_DEP}) -target_link_libraries(gras ${GRAS_DEP}) \ No newline at end of file +target_link_libraries(simgrid_shared ${SIMGRID_SHARED_DEP} ${PATH_PCRE_LIB}) + +find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS) +message(STATUS "pexports: ${PEXPORTS_PATH}") +if(PEXPORTS_PATH) +add_custom_command(TARGET simgrid_shared POST_BUILD +COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/libsimgrid.dll > ${CMAKE_BINARY_DIR}/lib/libsimgrid.ref) +endif(PEXPORTS_PATH) \ No newline at end of file diff --git a/buildtools/Cmake/gras_config.h.in b/buildtools/Cmake/gras_config.h.in index 73e425771b..fe82221115 100644 --- a/buildtools/Cmake/gras_config.h.in +++ b/buildtools/Cmake/gras_config.h.in @@ -4,12 +4,18 @@ /* Set somes variables for Windows compilation */ #ifdef _XBT_DLL_EXPORT - #define DLL_EXPORT + #ifndef DLL_EXPORT + #define DLL_EXPORT + #endif #else #ifdef _XBT_DLL_STATIC - #define DLL_STATIC + #ifndef DLL_STATIC + #define DLL_STATIC + #endif #else - #define DLL_IMPORT + #ifndef DLL_EXPORT + #define DLL_IMPORT + #endif #endif #endif diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index 0581c3e32f..03794ce301 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -29,12 +29,18 @@ SG_BEGIN_DECL() /* take care of DLL usage madness */ #ifdef _XBT_DLL_EXPORT - #define DLL_EXPORT + #ifndef DLL_EXPORT + #define DLL_EXPORT + #endif #else #ifdef _XBT_DLL_STATIC - #define DLL_STATIC + #ifndef DLL_STATIC + #define DLL_STATIC + #endif #else - #define DLL_IMPORT + #ifndef DLL_EXPORT + #define DLL_IMPORT + #endif #endif #endif