Skip to content

Commit

Permalink
Merge pull request #969 from fspadoni/FixCompilingError
Browse files Browse the repository at this point in the history
[SofaKernel] FIX: A few fix to compile on Mac OSX Xcode 9 and Linux gcc 7.3.0
  • Loading branch information
epernod authored Mar 28, 2019
2 parents 911994d + a127801 commit 9cbb775
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
4 changes: 4 additions & 0 deletions SofaKernel/framework/sofa/core/objectmodel/BaseClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include <sofa/core/objectmodel/BaseClass.h>
#include <sofa/helper/logging/Messaging.h>

#ifdef __GNUC__
#include <cxxabi.h>
#endif // __GNUC__

namespace sofa
{

Expand Down
25 changes: 13 additions & 12 deletions SofaKernel/framework/sofa/helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 7 additions & 2 deletions SofaKernel/framework/sofa/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
3 changes: 2 additions & 1 deletion SofaKernel/framework/sofa/simulation/Locks.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace sofa
public:

SpinLock()
:_flag()
{}

~SpinLock()
Expand Down Expand Up @@ -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)];
};
Expand Down

0 comments on commit 9cbb775

Please sign in to comment.