From: Martin Quinson Date: Tue, 28 Jul 2015 22:23:38 +0000 (+0200) Subject: pthread is not necessarily defined on windows X-Git-Tag: v3_12~342 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/bbb5704b6d90447fe21ab82dec06c94a14331587?ds=sidebyside pthread is not necessarily defined on windows --- diff --git a/buildtools/Cmake/MakeLib.cmake b/buildtools/Cmake/MakeLib.cmake index 2f46f6d2ac..153ca359f7 100644 --- a/buildtools/Cmake/MakeLib.cmake +++ b/buildtools/Cmake/MakeLib.cmake @@ -58,7 +58,7 @@ else() set(SIMGRID_DEP "${SIMGRID_DEP} -lstdc++") endif() -if(pthread AND ${CONTEXT_THREADS} AND NOT APPLE) +if(HAVE_PTHREAD AND ${CONTEXT_THREADS} AND NOT APPLE) # Clang on recent Mac OS X is not happy about -pthread. SET(SIMGRID_DEP "${SIMGRID_DEP} -pthread") endif() diff --git a/buildtools/Cmake/MakeLibWin.cmake b/buildtools/Cmake/MakeLibWin.cmake index b1a8a3ac98..c62d9bbabc 100644 --- a/buildtools/Cmake/MakeLibWin.cmake +++ b/buildtools/Cmake/MakeLibWin.cmake @@ -9,7 +9,11 @@ add_library(simgrid SHARED ${simgrid_sources}) 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") -set(SIMGRID_DEP "-lws2_32 -lpthread -lm") +set(SIMGRID_DEP "-lws2_32 -lm") + +if (HAVE_PTHREAD) + set(SIMGRID_DEP "${SIMGRID_DEP} -lpthread") +endif() if(ARCH_32_BITS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486 -D_I_X86_") diff --git a/include/xbt/xbt_os_thread.h b/include/xbt/xbt_os_thread.h index 539d57befa..727aa92b9e 100644 --- a/include/xbt/xbt_os_thread.h +++ b/include/xbt/xbt_os_thread.h @@ -25,12 +25,13 @@ SG_BEGIN_DECL() /** \brief Thread data type (opaque structure) */ typedef struct xbt_os_thread_ *xbt_os_thread_t; -#include #ifdef _XBT_WIN32 /* defined if this is a windows system, 32bits or 64bits) */ #include typedef DWORD xbt_os_thread_key_t; #else /* assume that every non-windows system is POSIX-compatible */ + +#include typedef pthread_key_t xbt_os_thread_key_t; #endif