Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a dll for simgrid and protect DLL_EXPORT and DLL_IMPORT from multiple definition
[simgrid.git] / buildtools / Cmake / MakeLibWin.cmake
index 8e3f463..4ffd5a4 100644 (file)
@@ -1,14 +1,16 @@
 ### Make Libs\r
 #>gcc c:\simgrid-trunk\examples\msg\icomms\peer.c -static -Lc:\simgrid-trunk\lib -lsimgrid -Ic:\simgrid-trunk\include -lwsock32        \r
 add_library(simgrid STATIC ${simgrid_sources})\r
+add_library(simgrid_shared SHARED ${simgrid_sources})\r
 add_library(gras STATIC ${gras_sources})\r
 \r
-set_target_properties(gras     PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC"\r
-                                                     OUTPUT_NAME   "gras")\r
-set_target_properties(simgrid  PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC"                                                  OUTPUT_NAME   "simgrid")\r
+set_target_properties(gras            PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC -DDLL_STATIC" VERSION ${libgras_version}    OUTPUT_NAME "gras")\r
+set_target_properties(simgrid         PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_STATIC -DDLL_STATIC" VERSION ${libsimgrid_version} OUTPUT_NAME "simgrid")\r
+set_target_properties(simgrid_shared  PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" VERSION ${libsimgrid_version} OUTPUT_NAME "simgrid")\r
 \r
 set(GRAS_DEP "ws2_32 -lpthread")\r
 set(SIMGRID_DEP "ws2_32 -lpcre -lpthread")\r
+set(SIMGRID_SHARED_DEP "ws2_32 -lpthread")\r
 \r
 if(ARCH_32_BITS)\r
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486")\r
@@ -16,5 +18,13 @@ else(ARCH_32_BITS)
         message(FATAL_ERROR "Sorry, Simgrid fails with full 64bits for now! Please contact us.")\r
 endif(ARCH_32_BITS)\r
 \r
+target_link_libraries(gras     ${GRAS_DEP})\r
 target_link_libraries(simgrid  ${SIMGRID_DEP})\r
-target_link_libraries(gras     ${GRAS_DEP})
\ No newline at end of file
+target_link_libraries(simgrid_shared ${SIMGRID_SHARED_DEP} ${PATH_PCRE_LIB})\r
+\r
+find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)\r
+message(STATUS "pexports: ${PEXPORTS_PATH}")\r
+if(PEXPORTS_PATH)\r
+add_custom_command(TARGET simgrid_shared POST_BUILD\r
+COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/libsimgrid.dll > ${CMAKE_BINARY_DIR}/lib/libsimgrid.ref)\r
+endif(PEXPORTS_PATH)
\ No newline at end of file