Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cc30280e531f8bdaaf6c35c05d43f51c8ee22045
[simgrid.git] / buildtools / Cmake / MakeLibWin.cmake
1 ### Make Libs
2 #>gcc c:\simgrid-trunk\examples\msg\icomms\peer.c -static -Lc:\simgrid-trunk\lib -lsimgrid -Ic:\simgrid-trunk\include -lwsock32
3 add_library(simgrid SHARED ${simgrid_sources})
4
5 set_target_properties(simgrid  PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" VERSION ${libsimgrid_version} OUTPUT_NAME "simgrid")
6
7
8 # libpthreadGC2.dll
9 if(ARCH_32_BITS)
10   find_library(PATH_PTHREAD_LIB
11     NAMES pthreadGC2.dll
12     HINTS
13     $ENV{PATH}
14     PATH_SUFFIXES bin/ c/bin
15     )
16 else()
17   find_library(PATH_PTHREAD_LIB
18     NAMES pthreadGC2-w64.dll
19     HINTS
20     $ENV{PATH}
21     PATH_SUFFIXES bin/ c/bin
22     )
23 endif()
24
25 set(SIMGRID_DEP "ws2_32 -pthread -lpcre")
26 set(SMPI_DEP "${LIBRARY_OUTPUT_PATH}/libsimgrid.dll")
27
28 if(ARCH_32_BITS)
29   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486")
30 else()
31   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
32   #        message(FATAL_ERROR "Sorry, Simgrid fails with full 64bits for now! Please contact us.")
33 endif()
34
35 target_link_libraries(simgrid   ${SIMGRID_DEP} -lkernel32)
36
37 find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)
38 message(STATUS "pexports: ${PEXPORTS_PATH}")
39 if(PEXPORTS_PATH)
40   add_custom_command(TARGET simgrid POST_BUILD
41     COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/libsimgrid.dll > ${CMAKE_BINARY_DIR}/lib/libsimgrid.def)
42 endif()
43
44 if(enable_smpi)
45   add_library(smpi SHARED ${SMPI_SRC})
46   set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version} OUTPUT_NAME "smpi")
47
48   set(SMPI_LDEP "")
49   target_link_libraries(smpi    simgrid ${SMPI_LDEP})
50 endif()