Use a compile test to see if we need to provide the GCC atomic built-ins ourselves, or not.
This commit is contained in:
parent
576979c562
commit
a31639682b
@ -99,7 +99,7 @@ find_package(ZLIB REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(SIMGEAR_HEADLESS)
|
||||
message(STATUS "headlesss mode")
|
||||
message(STATUS "headless mode")
|
||||
set(NO_OPENSCENEGRAPH_INTERFACE 1)
|
||||
else()
|
||||
find_package(OpenGL REQUIRED)
|
||||
@ -179,6 +179,13 @@ check_cxx_source_compiles(
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(WARNING_FLAGS -Wall)
|
||||
|
||||
# certain GCC versions don't provide the atomic builds, and hence
|
||||
# require is to provide them in SGAtomic.cxx
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH})
|
||||
check_cxx_source_compiles(
|
||||
"int main() { unsigned mValue; return __sync_add_and_fetch(&mValue, 1); }"
|
||||
GCC_ATOMIC_BUILTINS_FOUND)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(WIN32)
|
||||
|
@ -16,5 +16,7 @@
|
||||
#cmakedefine HAVE_SVN_CLIENT_H
|
||||
#cmakedefine HAVE_LIBSVN_CLIENT_1
|
||||
|
||||
#cmakedefine GCC_ATOMIC_BUILTINS_FOUND
|
||||
|
||||
// set if building headless (no OSG or OpenGL libs)
|
||||
#cmakedefine NO_OPENSCENEGRAPH_INTERFACE
|
||||
|
@ -17,10 +17,13 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include "SGAtomic.hxx"
|
||||
|
||||
#if defined(SGATOMIC_USE_GCC4_BUILTINS) && defined (__i386__)
|
||||
#if defined(SGATOMIC_USE_GCC4_BUILTINS) && !defined (GCC_ATOMIC_BUILTINS_FOUND)
|
||||
|
||||
// Usually the appropriate functions are inlined by gcc.
|
||||
// But if gcc is called with something equivalent to -march=i386,
|
||||
|
Loading…
Reference in New Issue
Block a user