Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
d11222fadeb205b465d7c652c00f3364a17c862a
[simgrid.git] / tools / 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
4 add_library(simgrid SHARED ${simgrid_sources})
5
6 set_target_properties(simgrid  PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" LINK_FLAGS "-shared" VERSION ${libsimgrid_version} PREFIX "lib" SUFFIX ".dll" IMPORT_PREFIX "lib" IMPORT_SUFFIX ".dll")
7
8 set(SIMGRID_DEP "-lws2_32 -lm")
9
10 if (HAVE_PTHREAD)
11   set(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
12 endif()
13
14 if(ARCH_32_BITS)
15   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486 -D_I_X86_")
16   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -march=i486 -D_I_X86_")
17 else()
18   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -D_AMD64_")
19   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -D_AMD64_")
20   #        message(FATAL_ERROR "Sorry, Simgrid fails with full 64bits for now! Please contact us.")
21 endif()
22
23 target_link_libraries(simgrid   ${SIMGRID_DEP})
24
25 find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)
26 message(STATUS "pexports: ${PEXPORTS_PATH}")
27 if(PEXPORTS_PATH)
28   add_custom_command(TARGET simgrid POST_BUILD
29     COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/libsimgrid.dll > ${CMAKE_BINARY_DIR}/lib/libsimgrid.def)
30 endif()