ornladios/ADIOS2
CMakeLists.txt
:253
check_cxx_source_compiles("
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char * argv[]) { argc = O_DIRECT; }
" O_DIRECT_WORKS)
check_cxx_source_compiles("
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char * argv[]) { argc = O_DIRECT; }
" O_DIRECT_WORKS)
check_cxx_source_compiles("
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <immintrin.h>
#endif
int main() {
__m512i mask = _mm512_set1_epi32(0x1);
char out[32];
_mm512_storeu_si512(out, mask);
return 0;
}"
CXX_SUPPORTS_AVX512)
check_cxx_source_compiles("
#include <pthread.h>
int main() {
pthread_mutex_t m;
pthread_mutex_init(&m, nullptr);
return pthread_mutex_destroy(&m);
}
" ASMJIT_LIBC_HAS_LIBPTHREAD)
# parent scope while check_cxx_source_compiles() continues to set an
check_cxx_source_compiles(
[=[
#include <immintrin.h>
#ifndef _MSC_VER
__attribute__((target("avx2")))
#endif
void func() { _mm256_abs_epi8(_mm256_set1_epi32(42)); }
int main()
{
func();
return 0;
}
]=]
HAVE_AVX2)
check_cxx_source_compiles("
int main() {
#pragma omp parallel for
for (unsigned int i=0; i<10; i++) ;
}" OMP_30_DETECTED)
check_cxx_source_compiles("
int main() {
#pragma omp parallel for simd safelen(4)
for (int i=0; i<10; i++) ;
}" OMP_40_DETECTED)
check_cxx_source_compiles("
#define TEST_QUOTE(str) #str
int main(void) { char xx[] = TEST_QUOTE(str) \"xxx\"; return 0; }
" HAVE_HASH_QUOTING)
check_cxx_source_compiles("\
int fooImplementation() { return 42; }
#if defined(__ANDROID_API__) && __ANDROID_API__ < 30
#error need Android API 30+ to have AT_HWCAP passed into the resolver
#endif
extern \"C\" int(*fooDispatcher())() {
return fooImplementation;
}
int foo() __attribute__((ifunc(\"fooDispatcher\")));
int main() { return foo() - 42; }\
" _CORRADE_CPU_CAN_USE_IFUNC)
check_cxx_source_compiles("
#if !defined(__x86_64__) && !defined(_M_X64)
# error Not x86_64
#endif
int main() {}
" ${OUTPUT_VARNAME})
check_cxx_source_compiles(
"
#include <algorithm>
#if !defined(__clang__) || !defined(_LIBCPP_VERSION)
# error \"This is not clang with libcxx by llvm\"
#endif
int main() {
return 0;
}
"
IS_CLANG_LIBCPP
FAIL_REGEX "This is not clang with libcxx by llvm"
)
check_cxx_source_compiles("
#include<type_traits>
int main() { return std::is_same_v<int, char>; }
" ENTT_HAS_LIBCPP)
check_cxx_source_compiles("#include <unistd.h>\nmain(){fdatasync(0);}" HAVE_FDATASYNC)
CHECK_CXX_SOURCE_COMPILES("
#include <byteswap.h>
int main( int argc, char **argv )
{
return 0;
}
" CDSTEST_HAVE_BYTESWAP_H )
check_cxx_source_compiles("
#include <type_traits>
#if _LIBCPP_VERSION
int main() {}
#endif"
FOLLY_STDLIB_LIBCXX
)
check_cxx_source_compiles("
#include <type_traits>
#if _CPPLIB_VER
int main() {}
#endif"
FOLLY_STDLIB_LIBCPP
)
check_cxx_source_compiles("
int main(int argc, char** argv) {
unsigned size = argc;
char data[size];
return 0;
}"
FOLLY_HAVE_VLA
)
check_cxx_source_compiles("${Iconv_IMPLICIT_TEST_CODE}" Iconv_IS_BUILT_IN)
CHECK_CXX_SOURCE_COMPILES("
#include <string>
#include <map>
#include <vector.hpp>
class TreeElement;
typedef std::map<std::string, TreeElement> SegmentMap;
class TreeElement
{
TreeElement(const std::string& name): number(0) {}
public:
int number;
SegmentMap::const_iterator parent;
std::vector<SegmentMap::const_iterator> children;
static TreeElement Root(std::string& name)
{
return TreeElement(name);
}
};
int main()
{
return 0;
}
"
HAVE_STL_CONTAINER_INCOMPLETE_TYPES)
check_cxx_source_compiles("int main() {return 0;}" CAN_LINK_GUI_GLESV2)
check_cxx_source_compiles(
"
#include <armadillo>
int main(int argc, char** argv) {
arma::mat matInput(2,2);
const arma::mat& matInv = arma::inv(matInput);
return 0;
}
"
ARMADILLO_TEST_PROGRAM_WITH_LAPACK_COMPILES)
check_cxx_source_compiles(
"
#include <libheif/heif.h>
int main()
{
struct heif_image_tiling tiling;
return 0;
}
"
LIBHEIF_SUPPORTS_TILES
)
check_cxx_source_compiles(
"
#include <avif/avif.h>
int main()
{
offsetof(avifImage, numProperties);
return 0;
}
"
AVIF_HAS_OPAQUE_PROPERTIES
)
check_cxx_source_compiles(
"#define _XOPEN_SOURCE\n#include <vector>\n#include <stdio.h>\nextern \"C\"\n {int sprintf(char *str, const char* fmt, ...);}"
DEPRECATE_SPRINTF)
check_cxx_source_compiles(
"
#include <shared_mutex>
int main(int argc, const char * argv[]) {
std::shared_mutex smtx;
smtx.lock_shared();
smtx.unlock_shared();
return 0;
}
"
HAVE_SHARED_MUTEX
)
check_cxx_source_compiles(
"
#include <atomic>
#include <cstdint>
int main(int argc, const char * argv[]) {
std::atomic<uint64_t> x;
return x;
}
"
HAVE_ATOMIC_UINT64_T_WITH_ATOMIC
)
check_cxx_source_compiles("${TEST_LINK_STDCPP_SOURCE_CODE}" _TEST_LINK_STDCPP)
CHECK_CXX_SOURCE_COMPILES("${_cxx_code}" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU
${_CheckCXXCompilerFlag_COMMON_PATTERNS}
)
check_cxx_source_compiles("#include <cryptopp/osrng.h>
int main(int argc, char** argv) { CryptoPP::AES::Encryption oEnc; return 0; }" CRYPTOPP_TEST_KNOWNBUG)
check_cxx_source_compiles("${Iconv_IMPLICIT_TEST_CODE}" Iconv_IS_BUILT_IN)
check_cxx_source_compiles("${SQLITE3_AUTO_EXTENSION_CHECK}" SQLite3_HAS_NON_DEPRECATED_AUTO_EXTENSION)
check_cxx_source_compiles("${INT128_TEST_SOURCE}" INT128_TEST)
CHECK_CXX_SOURCE_COMPILES(
"\#include <poppler/goo/GooString.h>\nint main() { const GooString gs; gs.getChar(0); return 0; }"
LIBPOPPLER_GOOSTRING_HAS_CONSTGETCHAR)
CHECK_CXX_SOURCE_COMPILES(
"\#include <poppler/UnicodeMap.h>\nint main() { Unicode u; char buf[8]; const UnicodeMap *uMap; uMap->mapUnicode(u, buf, sizeof(buf)); return 0; }"
LIBPOPPLER_UNICODEMAP_HAS_CONSTMAPUNICODE)
check_cxx_source_compiles("${TEST_LINK_STDCPP_SOURCE_CODE}" _TEST_LINK_STDCPP_AGAIN)
check_cxx_source_compiles(
"
#include <ad9361.h>
namespace testing
{
auto test_ad9361_multichip_sync = &::ad9361_multichip_sync;
auto test_ad9361_set_bb_rate_custom_filter_manual = &::ad9361_set_bb_rate_custom_filter_manual;
};
int main() {}"
libad9361_SUFFICIENT)
CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
(void)i;
return 0;
}
" ${varname})
CHECK_CXX_SOURCE_COMPILES("
#ifdef _MSC_VER
#include <windows.h>
#endif
int main() {
#ifdef _MSC_VER
volatile LONG val = 1;
MemoryBarrier();
InterlockedCompareExchange(&val, 0, 1);
InterlockedIncrement(&val);
InterlockedDecrement(&val);
#else
volatile unsigned long val = 1;
__sync_synchronize();
__sync_val_compare_and_swap(&val, 1, 0);
__sync_add_and_fetch(&val, 1);
__sync_sub_and_fetch(&val, 1);
#endif
return 0;
}
" LLVM_HAS_ATOMICS)
check_cxx_source_compiles("
#include <intrin.h>
int main(void) {
unsigned long long a = 0, b = 0;
unsigned long long c;
volatile unsigned long long d;
d = _umul128(a, b, &c);
return 0;
}
"
HAVE__UMUL128
)
check_cxx_source_compiles("
#include <intrin.h>
int main(void) {
unsigned long long a = 0, b = 0;
volatile unsigned long long c;
c = __umulh(a, b);
return 0;
}
"
HAVE___UMULH
)
check_cxx_source_compiles(${ITK_CXX_DISABLE_OPTIMIZATION_FLAG} CXX_HAS_DISABLE_OPTIMIZATION_FLAG)
CHECK_CXX_SOURCE_COMPILES(
"\#include <byteswap.h>\nint main() { return bswap_32( 42 ); }"
GDCM_HAVE_BYTESWAP_H)
CHECK_CXX_SOURCE_COMPILES(
"\#include <openssl/bio.h>\nint main() { const void*mem; int len; BIO_new_mem_buf(mem, len); }"
OPENSSL_HAS_CONST_VOID_BIO_NEW_MEM_BUF)
check_cxx_source_compiles("
#include <string>
#include \"utf8.h\"
int main(int argc, char** argv) {
std::string input = std::string(\"utfcpp\");
const char * p = input.c_str();
std::size_t len = input.length();
utf8::is_valid(p, p + len);
}" HAVE_WORKING_UTFCPP)
check_cxx_source_compiles("${atomic_code}" ATOMICS_LOCK_FREE_INSTRUCTIONS)
check_cxx_source_compiles("${atomic_code}" ATOMICS_IN_LIBRARY)
check_cxx_source_compiles("${code}" CXX_COROUTINES_AWAIT_NEEDED)
check_cxx_source_compiles("${code}" CXX_MEMORY_RESOURCE_NO_LINK_NEEDED)
check_cxx_source_compiles("
#include <v8.h>
int main()
{
v8::Persistent<v8::Context> ctx;
ctx.Dispose(0);
return 0;
}"
V8_DISPOSE_HAS_ISOLATE)
check_cxx_source_compiles("${TestSrc}" ${TestVar})
check_cxx_source_compiles("#include <atomic>
int main() {
std::atomic_uint8_t a;
std::atomic_uint16_t b;
std::atomic_uint32_t c;
std::atomic_uint64_t d;
return ++a + ++b + ++c + ++d;
}" HAVE_FULL_ATOMIC_SUPPORT)
check_cxx_source_compiles("${_source_code}" __res)
check_cxx_source_compiles ("${source_code}" COMPILER_SUPPORTS_ARM_NEON)
check_cxx_source_compiles(
"#include <gflags/gflags.h>
int main(int argc, char * argv[]) {
google::ParseCommandLineFlags(&argc, &argv, true);
return 0;
}"
GFLAGS_IN_GOOGLE_NAMESPACE)
# check_cxx_source_compiles() will not use imported targets, which
"check_cxx_source_compiles(), or namespace regex.")
check_cxx_source_compiles(
"${OPENGL_HEADER1}
${OPENGL_HEADER2}
int main() { GLint64 test; return 0; }"
GL_HEADER_HAS_GLINT64
)
check_cxx_source_compiles(
"${OPENGL_HEADER1}
${OPENGL_HEADER2}
int main() { GLuint64 test; return 0; }"
GL_HEADER_HAS_GLUINT64
)
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
#ifdef __FreeBSD__
#include <pthread_np.h>
#endif
int main() {
#ifdef __FreeBSD__
cpuset_t cpumask;
#else
cpu_set_t cpumask;
#endif
CPU_ZERO( &cpumask );
CPU_SET( 0, &cpumask );
pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask);
return 0;
}" COMPILES_PTHREAD_SETAFFINITY_NP)
CHECK_CXX_SOURCE_COMPILES("
#include <sched.h>
int main() {
cpu_set_t cpumask;
sched_setaffinity( 0, &cpumask );
return 0;
}" HAVE_TWO_PARAM_SCHED_SETAFFINITY)
check_cxx_source_compiles("${CheckSourceN2071N2072}" CXX11_N2071_N2072)
check_cxx_source_compiles(
"#include <atomic>
int main() {
static std::atomic<unsigned long long> a{0};
a = a.fetch_add(1LL);
return 0;
}"
ATOMIC_WORKED${I})
check_cxx_source_compiles("${INCLUDE_TEST_SOURCE}" Qt5${_qt_component}_PRIVATE_HEADER_FOUND)
check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_IS_BUILTIN)
check_cxx_source_compiles("${ATOMICS_TEST_SOURCE}"
HAVE_CXX_ATOMICS_INT_WITHOUT_LIB)
check_cxx_source_compiles("${ATOMICS_VOID_PTR_TEST_SOURCE}"
HAVE_CXX_ATOMICS_VOID_PTR_WITH_LIB)
check_cxx_source_compiles("
#include <stdio.h>
#include <readline/readline.h>
#if !defined(RL_VERSION_MAJOR) || !defined(RL_VERSION_MINOR)
#error Ancient version of readline
#endif
int main() { return 0; }
"
_rl_version_check)
check_cxx_source_compiles([[
#include <string_view>
#if __cpp_lib_string_view < 201606
# error no string view support
#endif
int main() {}
]] SIMDJSON_FOUND_STRING_VIEW)
check_cxx_source_compiles("
#include <pthread.h>
int main() { struct timespec timeout; timeout.tv_nsec = 0; return 0; }
" HAVE_PTHREAD_TIMESPEC_NSEC)
check_cxx_source_compiles("
int main() {
return __builtin_ctzll(0);
}" HAVE_BUILTIN_CTZ)
CHECK_CXX_SOURCE_COMPILES("
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return std::atomic_is_lock_free(&x);
}
" ${varname})
CHECK_CXX_SOURCE_COMPILES("
#include <cstddef>
int main() {
size_t *x = (unsigned int *)(NULL);
return 0; }" SIZE_T_IS_UNSIGNED_INT)
check_cxx_source_compiles("
#include <Inventor/events/SoKeyboardEvent.h>
int main() { SoKeyboardEvent::Key key = SoKeyboardEvent::DELETE; return 0; }
" HAVE_SOKEYBOARDEVENT_DELETE)
check_cxx_source_compiles("
#include <Inventor/nodes/SoPolygonOffset.h>
int main() { SoPolygonOffset * p = new SoPolygonOffset; return 0; }
" HAVE_SOPOLYGONOFFSET)
check_cxx_source_compiles("
#include <Inventor/VRMLnodes/SoVRMLMaterial.h>
int main() { SoVRMLMaterial * p = new SoVRMLMaterial; return 0; }
" HAVE_SOVRMLMATERIAL)
check_cxx_source_compiles(
"${CheckCXXAtomic_CODE}"
HAVE_CXX_ATOMIC_STATIC)
check_cxx_source_compiles(
"#include <vector>
int main() { std::vector<int> v(42); for (auto i : v) { ++i; } return 0; }"
STXXL_HAVE_CXX11_RANGE_FOR_LOOP)
check_cxx_source_compiles(
"#include <unistd.h>
#include <sys/syscall.h>
#include <linux/aio_abi.h>
int main() {
aio_context_t context;
long r = syscall(SYS_io_setup, 5, &context);
return (r == 0) ? 0 : -1;
}"
STXXL_HAVE_LINUXAIO_FILE)
check_cxx_source_compiles(
"int main() { int x; __sync_add_and_fetch(&x, +1); return 0; }"
STXXL_HAVE_SYNC_ADD_AND_FETCH)
check_cxx_source_compiles(
"
#include <iconv.h>
// this declaration will fail when there already exists a non const char** version which returns size_t
double iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
int main() { return 0; }
"
HAVE_ICONV_CONST
)
check_cxx_source_compiles("
int main() {
__builtin_bswap16(0);
__builtin_bswap32(0);
__builtin_bswap64(0);
return 0;
}
" HAVE_GCC_BYTESWAP)
check_cxx_source_compiles("
#include <cstdlib>
int main() {
_byteswap_ushort(0);
_byteswap_ulong(0);
_byteswap_uint64(0);
return 0;
}
" HAVE_MSC_BYTESWAP)
check_cxx_source_compiles(
"
#include <string.h>
int main(){char b;char *a = strerror_r(0, &b, 0); static_cast<void>(a); return(0);}
"
STRERROR_R_CHAR_P)
check_cxx_source_compiles("
#include <atomic>
int main() {
std::atomic<long long> x;
return std::atomic_is_lock_free(&x);
}
" ${VARNAME})
CHECK_CXX_SOURCE_COMPILES("${SOURCE}" ${VARNAME})
check_cxx_source_compiles(
"
#include <ios>
int main() {
static_assert(_GLIBCXX_RELEASE < 9);
return 0;
}
"
Kokkos_ENABLE_IMPL_SKIP_NO_RTTI_FLAG
)
CHECK_CXX_SOURCE_COMPILES("${SOURCE}" HAVE_CXX_ATTRIBUTE_WEAK)
CHECK_CXX_SOURCE_COMPILES("${SOURCE}" HAVE_CXX_PRAGMA_WEAK)
CHECK_CXX_SOURCE_COMPILES("${SOURCE}" ${VARNAME})
CHECK_CXX_SOURCE_COMPILES("
#include <ifaddrs.h>
int main(){
struct ifaddrs *ifap;
getifaddrs(&ifap);
return 0;
}
" HAVE_GETIFADDRS
)
CHECK_CXX_SOURCE_COMPILES("
#include <windows.h>
int main(){
SetThreadPriority(GetCurrentThread(), 0);
SetPriorityClass(GetCurrentProcess(), 0);
return 0;
}
" HAVE_WIN_SETTHREADPRIORITY
)
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
int main(){
pthread_t pt;
const char* pt_name = \"test\";
pthread_setname_np(pt, pt_name);
return 0;
}
" HAVE_PTHREAD_SETNAME
)
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
int main(){
pthread_t pt;
cpu_set_t cs;
pthread_setaffinity_np(pt, sizeof(cpu_set_t), &cs);
return 0;
}
" HAVE_PTHREAD_SETAFFINITY_NP
)
CHECK_CXX_SOURCE_COMPILES("
#include <dlfcn.h>
int main(){
dlopen(0, 0);
return 0;
}
" HAVE_DLOPEN
)
check_cxx_source_compiles ("
#include <list>
#include <deque>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif
int
main ()
{
list<int> x; x.push_back(5);
list<int>::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;
;
return 0;
}" HAVE_STL)
check_cxx_source_compiles(
"#include <nmmintrin.h>
int main() {
_mm_crc32_u64(0, 0);
return 0;
}"
USE_SSE)
CHECK_CXX_SOURCE_COMPILES("int main(int n) { int dynamic_array[n]; }" HAVE_DYNAMIC_ARRAY)
CHECK_CXX_SOURCE_COMPILES("${ARM_THUMB2_TEST_SOURCE}" ARM_THUMB2_DETECTED)
check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_IS_BUILTIN)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_CPPEXP_NEEDED)