Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Backofen, Rainer
amdis
Commits
c815b4af
Commit
c815b4af
authored
Oct 15, 2016
by
Praetorius, Simon
Browse files
has_cxx11 flag corrected
parent
7dd92158
Changes
8
Show whitespace changes
Inline
Side-by-side
AMDiS/cmake/enable_cxx11.cmake
View file @
c815b4af
...
...
@@ -3,37 +3,25 @@ include(CheckCXXSourceCompiles)
include
(
CheckIncludeFileCXX
)
if
(
ENABLE_CXX11
)
check_cxx_compiler_flag
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
)
check_cxx_compiler_flag
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
_FLAG
)
if
(
NOT COMPILER_SUPPORTS_CXX11
)
set
(
CXX11_CODE
"#include <tuple>
\\
n#include <array>
\\
ntemplate<class... T> using std::tuple<T...>;int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);}"
)
if
(
COMPILER_SUPPORTS_CXX11_FLAG
)
set
(
CMAKE_REQUIRED_FLAGS
"-std=c++11"
)
check_cxx_source_compiles
(
"
int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);
}"
CXX_COMPILES_WITH_CXX11
)
check_cxx_source_compiles
(
"
${
CXX11_CODE
}
"
CXX
11
_COMPILES_WITH_CXX11
_FLAG
)
set
(
CMAKE_REQUIRED_FLAGS
""
)
endif
()
if
(
COMPILER_SUPPORTS_CXX11
OR
CXX_COMPILES_WITH_CXX11
)
if
(
COMPILER_SUPPORTS_CXX11
_FLAG AND
CXX
11
_COMPILES_WITH_CXX11
_FLAG
)
add_definitions
(
"-std=c++11"
)
else
()
check_cxx_compiler_flag
(
"-std=c++0x"
COMPILER_SUPPORTS_CXX0X
)
if
(
NOT COMPILER_SUPPORTS_CXX0X
)
set
(
CMAKE_REQUIRED_FLAGS
"-std=c++0x"
)
check_cxx_source_compiles
(
"int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);}"
CXX_COMPILES_WITH_CXX0X
)
set
(
CMAKE_REQUIRED_FLAGS
""
)
endif
()
check_cxx_source_compiles
(
"
${
CXX11_CODE
}
"
CXX11_COMPILES
)
if
(
COMPILER_SUPPORTS_CXX0X OR CXX_COMPILES_WITH_CXX0X
)
add_definitions
(
"-std=c++0x"
)
else
()
check_cxx_source_compiles
(
"int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);}"
CXX11_COMPILES
)
check_include_file_cxx
(
"array"
CXX11_INCLUDES
)
if
(
CXX11_COMPILES AND CXX11_INCLUDES
)
set
(
${
RESULT_VAR
}
true CACHE BOOL
"Enable C++11 compiler features"
)
else
()
if
(
NOT CXX11_COMPILES
)
message
(
FATAL_ERROR
"Compiler does not support C++11."
)
endif
()
endif
()
endif
()
list
(
APPEND COMPILEFLAGS
"-DHAS_CXX11=1"
)
else
()
...
...
AMDiS/cmake3/AMDISConfig.cmake.in
View file @
c815b4af
...
...
@@ -14,8 +14,8 @@
# target_link_libraries(yourTarget AMDiS)
#
if (${CMAKE_VERSION} VERSION_LESS "3.
0
")
message(FATAL_ERROR "The Configuration file was created for CMake version >= 3.
0
")
if (${CMAKE_VERSION} VERSION_LESS "3.
2
")
message(FATAL_ERROR "The Configuration file was created for CMake version >= 3.
2
")
endif ()
list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})
...
...
@@ -39,13 +39,11 @@ set(CMAKE_BUILD_TYPE @CMAKE_BUILD_TYPE@)
add_library(amdis_base INTERFACE)
add_library(AMDiS ALIAS amdis_base)
target_compile_definitions(amdis_base INTERFACE
$<$<CONFIG:Release>:DEBUG=0>
$<$<NOT:$<CONFIG:Release>>:DEBUG=1>)
target_compile_definitions(amdis_base INTERFACE)
if (AMDIS_NEED_CXX11)
set(CMAKE_CXX_STANDARD 11
)
set(CMAKE_CXX_STANDARD_REQUIRED ON
)
include(test_compile_features
)
target_enable_cxx11(AMDIS_NEED_CXX11 amdis_base INTERFACE
)
target_compile_definitions(amdis_base INTERFACE HAS_CXX11=1)
else ()
target_compile_definitions(amdis_base INTERFACE HAS_CXX11=0)
...
...
@@ -220,8 +218,11 @@ endif ()
get_target_property(AMDIS_INCLUDE_DIRS AMDiS INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(AMDIS_LIBRARIES AMDiS INTERFACE_LINK_LIBRARIES)
get_target_property(AMDIS_COMPILEFLAGS AMDiS INTERFACE_COMPILE_OPTIONS)
if (NOT AMDIS_COMPILEFLAGS)
set(AMDIS_COMPILEFLAGS "")
endif()
get_target_property(_DEFINITIONS AMDiS INTERFACE_COMPILE_DEFINITIONS)
foreach(defn ${_DEFINITIONS})
list(APPEND AMDIS_COMPILEFLAGS "-D${defn}")
endforeach(
s
)
endforeach(
defn
)
AMDiS/cmake3/CMakeLists.txt
View file @
c815b4af
...
...
@@ -42,9 +42,7 @@ add_library(amdis_base INTERFACE)
add_library
(
AMDiS::base ALIAS amdis_base
)
target_include_directories
(
amdis_base INTERFACE
${
SOURCE_DIR
}
)
target_compile_definitions
(
amdis_base INTERFACE
$<$<CONFIG:Release>:DEBUG=0>
$<$<NOT:$<CONFIG:Release>>:DEBUG=1>
)
target_compile_definitions
(
amdis_base INTERFACE
)
include
(
test_compile_features
)
target_enable_cxx11
(
ENABLE_CXX11 amdis_base INTERFACE
)
...
...
AMDiS/cmake3/test_compile_features.cmake
View file @
c815b4af
include
(
CheckCXXCompilerFlag
)
include
(
CheckCXXSourceCompiles
)
include
(
CheckIncludeFileCXX
)
macro
(
target_enable_cxx11 RESULT_VAR _TARGET_ _SCOPE_
)
check_cxx_compiler_flag
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
)
check_cxx_compiler_flag
(
"-std=c++11"
COMPILER_SUPPORTS_CXX11
_FLAG
)
if
(
NOT COMPILER_SUPPORTS_CXX11
)
set
(
CXX11_CODE
"#include <tuple>
\\
n#include <array>
\\
ntemplate<class... T> using std::tuple<T...>;int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);}"
)
if
(
COMPILER_SUPPORTS_CXX11_FLAG
)
set
(
CMAKE_REQUIRED_FLAGS
"-std=c++11"
)
check_cxx_source_compiles
(
"
int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);
}"
CXX_COMPILES_WITH_CXX11
)
check_cxx_source_compiles
(
"
${
CXX11_CODE
}
"
CXX
11
_COMPILES_WITH_CXX11
_FLAG
)
set
(
CMAKE_REQUIRED_FLAGS
""
)
endif
()
if
(
COMPILER_SUPPORTS_CXX11
OR
CXX_COMPILES_WITH_CXX11
)
if
(
COMPILER_SUPPORTS_CXX11
_FLAG AND
CXX
11
_COMPILES_WITH_CXX11
_FLAG
)
target_compile_options
(
${
_TARGET_
}
${
_SCOPE_
}
"-std=c++11"
)
set
(
${
RESULT_VAR
}
true CACHE BOOL
"Enable C++11 compiler features"
)
else
()
check_cxx_compiler_flag
(
"-std=c++0x"
COMPILER_SUPPORTS_CXX0X
)
if
(
NOT COMPILER_SUPPORTS_CXX0X
)
set
(
CMAKE_REQUIRED_FLAGS
"-std=c++0x"
)
check_cxx_source_compiles
(
"int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);}"
CXX_COMPILES_WITH_CXX0X
)
set
(
CMAKE_REQUIRED_FLAGS
""
)
endif
()
if
(
COMPILER_SUPPORTS_CXX0X OR CXX_COMPILES_WITH_CXX0X
)
target_compile_options
(
${
_TARGET_
}
${
_SCOPE_
}
"-std=c++0x"
)
set
(
${
RESULT_VAR
}
true CACHE BOOL
"Enable C++11 compiler features"
)
set
(
${
RESULT_VAR
}
true CACHE BOOL
"Enable C++11 compiler features"
FORCE
)
else
()
check_cxx_source_compiles
(
"int main(){decltype(1) vec[]={1,2,3}; for(auto&& x:vec);}"
CXX11_COMPILES
)
check_include_file_cxx
(
"array"
CXX11_INCLUDES
)
check_cxx_source_compiles
(
"
${
CXX11_CODE
}
"
CXX11_COMPILES
)
if
(
CXX11_COMPILES
AND CXX11_INCLUDES
)
set
(
${
RESULT_VAR
}
true CACHE BOOL
"Enable C++11 compiler features"
)
if
(
CXX11_COMPILES
)
set
(
${
RESULT_VAR
}
true CACHE BOOL
"Enable C++11 compiler features"
FORCE
)
else
()
set
(
${
RESULT_VAR
}
false CACHE BOOL
"Enable C++11 compiler features"
)
endif
()
set
(
${
RESULT_VAR
}
false CACHE BOOL
"Enable C++11 compiler features"
FORCE
)
endif
()
endif
()
endmacro
(
target_enable_cxx11
)
AMDiS/src/config/Config_clang.h
View file @
c815b4af
...
...
@@ -47,7 +47,7 @@ typedef size_t aligned_size_t __attribute__ ((aligned(CACHE_LINE)));
// C++11 features
// --------------
#if
def
HAS_CXX11
#if HAS_CXX11
// __has_feature(cxx_rvalue_references)
#if CLANG_VERSION >= 20900 && !defined(HAS_VARIADIC_TEMPLATES)
...
...
AMDiS/src/config/Config_gcc.h
View file @
c815b4af
...
...
@@ -47,7 +47,7 @@ typedef size_t aligned_size_t __attribute__ ((aligned(CACHE_LINE)));
// C++11 features
// --------------
#if
def
HAS_CXX11
#if HAS_CXX11
#if GCC_VERSION >= 40300 && !defined(HAS_VARIADIC_TEMPLATES)
#define HAS_VARIADIC_TEMPLATES 1
...
...
AMDiS/src/config/Config_intel.h
View file @
c815b4af
...
...
@@ -51,7 +51,7 @@ typedef __declspec(align(CACHE_LINE)) size_t aligned_size_t;
// C++11 features
// --------------
#if
def
HAS_CXX11
#if HAS_CXX11
#if INTEL_VERSION >= 1201 && !defined(HAS_VARIADIC_TEMPLATES)
#define HAS_VARIADIC_TEMPLATES 1
...
...
AMDiS/src/traits/basic.hpp
View file @
c815b4af
...
...
@@ -35,7 +35,7 @@
#include
<boost/utility/enable_if.hpp>
#endif
#if
def
HAS_CXX11
#if HAS_CXX11
#include
<type_traits>
#endif
...
...
@@ -45,7 +45,7 @@ namespace AMDiS
// introduce some shortcuts for boost::mpl
// ---------------------------------------
#if
def
HAS_CXX11
#if HAS_CXX11
template
<
bool
B
>
using
bool_
=
std
::
integral_constant
<
bool
,
B
>
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment