Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Added support for gcc and c++11 features.
Browse files Browse the repository at this point in the history
  • Loading branch information
esok committed Mar 24, 2015
1 parent 7e2a9d1 commit 6bc3224
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ ENABLE_TESTING()
SET(NV_CMAKE_DIR "${NV_SOURCE_DIR}/cmake")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${NV_CMAKE_DIR}")

# GCC check (needs -std:c++11 flag)
if(CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS("-std=c++11")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

IF(WIN32)
# gnuwin32 paths:
SET(GNUWIN32_PATH "${NV_SOURCE_DIR}/extern/gnuwin32")
Expand Down Expand Up @@ -68,3 +73,4 @@ IF(WIN32)
ENDIF(WIN32)

INCLUDE(CPack)

5 changes: 5 additions & 0 deletions src/nvcore/nvcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@
#define NV_CC_CPP11 (__cplusplus > 199711L)
#else
// @@ IC: This works in CLANG, about GCC?
// @@ ES: Doesn't work in gcc. These 3 features are available in GCC >= 4.4.
#ifdef __clang__
#define NV_CC_CPP11 (__has_feature(cxx_deleted_functions) && __has_feature(cxx_rvalue_references) && __has_feature(cxx_static_assert))
#elif defined __GNUC__
#define NV_CC_CPP11 ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
#endif
#endif

// Endiannes:
Expand Down

0 comments on commit 6bc3224

Please sign in to comment.