Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
866fe1d9b04cbaf22be18263082bf35b6f7ee08b
[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 add_library(gras SHARED ${gras_sources})
5
6 set_target_properties(gras     PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" VERSION ${libgras_version}    OUTPUT_NAME "gras")
7 set_target_properties(simgrid  PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" VERSION ${libsimgrid_version} OUTPUT_NAME "simgrid")
8
9 # libpthreadGC2.dll
10 if(ARCH_32_BITS)
11   find_library(PATH_PTHREAD_LIB
12     NAMES pthreadGC2.dll
13     HINTS
14     $ENV{PATH}
15     PATH_SUFFIXES bin/ c/bin
16     )
17 else(ARCH_32_BITS)
18   find_library(PATH_PTHREAD_LIB
19     NAMES pthreadGC2-w64.dll
20     HINTS
21     $ENV{PATH}
22     PATH_SUFFIXES bin/ c/bin
23     )
24 endif(ARCH_32_BITS)
25
26 set(GRAS_DEP "ws2_32 ${PATH_PTHREAD_LIB}")
27 set(SIMGRID_DEP "ws2_32 ${PATH_PCRE_LIB} ${PATH_PTHREAD_LIB}")
28
29 if(ARCH_32_BITS)
30   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486")
31 else(ARCH_32_BITS)
32   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
33   #        message(FATAL_ERROR "Sorry, Simgrid fails with full 64bits for now! Please contact us.")
34 endif(ARCH_32_BITS)
35
36 target_link_libraries(gras      ${GRAS_DEP})
37 target_link_libraries(simgrid   ${SIMGRID_DEP})
38
39 find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)
40 message(STATUS "pexports: ${PEXPORTS_PATH}")
41 if(PEXPORTS_PATH)
42   add_custom_command(TARGET simgrid POST_BUILD
43     COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/libsimgrid.dll > ${CMAKE_BINARY_DIR}/lib/libsimgrid.def)
44 endif(PEXPORTS_PATH)
45
46 if(enable_smpi)
47   add_library(smpi SHARED ${SMPI_SRC})
48   set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version} OUTPUT_NAME "smpi")
49
50   set(SMPI_LDEP "")
51   target_link_libraries(smpi    simgrid ${SMPI_LDEP})
52 endif(enable_smpi)