diff --git a/SofaKernel/framework/sofa/core/objectmodel/BaseClass.cpp b/SofaKernel/framework/sofa/core/objectmodel/BaseClass.cpp index 92a62518717..0eae0cfe222 100644 --- a/SofaKernel/framework/sofa/core/objectmodel/BaseClass.cpp +++ b/SofaKernel/framework/sofa/core/objectmodel/BaseClass.cpp @@ -22,6 +22,10 @@ #include #include +#ifdef __GNUC__ +#include +#endif // __GNUC__ + namespace sofa { diff --git a/SofaKernel/framework/sofa/helper/CMakeLists.txt b/SofaKernel/framework/sofa/helper/CMakeLists.txt index baadd398338..4a8598d9a9e 100644 --- a/SofaKernel/framework/sofa/helper/CMakeLists.txt +++ b/SofaKernel/framework/sofa/helper/CMakeLists.txt @@ -336,23 +336,24 @@ if(SOFA-EXTERNAL_FFMPEG) "libswresample.a" "/usr/lib/libiconv.dylib" ) - find_library(FOUNDATION CoreFoundation) - find_library(VIDEO CoreVideo) - find_library(VIDEO_DECOD_ACC VideoDecodeAcceleration) - find_library(ICONV iconv) - target_link_libraries(${PROJECT_NAME} ${FFMPEG_LIBS} ${FOUNDATION} ${VIDEO} ${VIDEO_DECOD_ACC}) + find_library(FOUNDATION CoreFoundation) + ind_library(VIDEO CoreVideo) + find_library(VIDEO_DECOD_ACC VideoDecodeAcceleration) + target_link_libraries(${PROJECT_NAME} ${FFMPEG_LIBS} ${FOUNDATION} ${VIDEO} ${VIDEO_DECOD_ACC}) elseif (UNIX) AddLinkerDependencies(avcodec) - AddLinkerDependencies(avformat) - AddLinkerDependencies(avutil) - AddLinkerDependencies(swscale) - AddLinkerDependencies(avdevice) - AddLinkerDependencies(avfilter) - AddLinkerDependencies(swresample) - endif() + AddLinkerDependencies(avformat) + AddLinkerDependencies(avutil) + AddLinkerDependencies(swscale) + AddLinkerDependencies(avdevice) + AddLinkerDependencies(avfilter) + AddLinkerDependencies(swresample) + endif() endif() if(APPLE) + find_library(ICONV iconv) + target_link_libraries(${PROJECT_NAME} PUBLIC ${ICONV}) # on macOS, -framework CoreServices is needed for FileMonitor list(APPEND SOFAFRAMEWORK_DEPENDENCY_LINK "-framework CoreServices") endif() diff --git a/SofaKernel/framework/sofa/simulation/CMakeLists.txt b/SofaKernel/framework/sofa/simulation/CMakeLists.txt index b6816c6274a..54dc9fab2f3 100644 --- a/SofaKernel/framework/sofa/simulation/CMakeLists.txt +++ b/SofaKernel/framework/sofa/simulation/CMakeLists.txt @@ -131,11 +131,16 @@ set(SOURCE_FILES InitTasks.cpp ) - - add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} PUBLIC SofaCore) set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_SIMULATION_CORE") set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "_d") +# is this a compiler/linker version specific problem? +if(CMAKE_SYSTEM_NAME STREQUAL Linux) + # target_link_options is available from CMake 3.13 + # target_link_options(${PROJECT_NAME} PUBLIC "-pthread") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" ) +endif() + sofa_install_targets(SofaSimulation ${PROJECT_NAME} "sofa/simulation") diff --git a/SofaKernel/framework/sofa/simulation/Locks.h b/SofaKernel/framework/sofa/simulation/Locks.h index 93b9125960e..d04bc0cb56a 100644 --- a/SofaKernel/framework/sofa/simulation/Locks.h +++ b/SofaKernel/framework/sofa/simulation/Locks.h @@ -42,6 +42,7 @@ namespace sofa public: SpinLock() + :_flag() {} ~SpinLock() @@ -70,7 +71,7 @@ namespace sofa private: - std::atomic_flag _flag = ATOMIC_FLAG_INIT; + std::atomic_flag _flag; char _pad [CACHE_LINE - sizeof(std::atomic_flag)]; };