1# This file is part of RawTherapee. 2# 3# Copyright (C) 2018 Flössie <floessie.mail@gmail.com> 4# 5# RawTherapee is free software: you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation, either version 3 of the License, or 8# (at your option) any later version. 9# 10# RawTherapee is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with RawTherapee. If not, see <https://www.gnu.org/licenses/>. 17 18include(CheckCXXSourceCompiles) 19 20set(CMAKE_REQUIRED_QUIET_COPY "${CMAKE_REQUIRED_QUIET}") 21set(CMAKE_REQUIRED_QUIET ON) 22 23set(TEST_SOURCE 24" 25#include <cstddef> 26#include <type_traits> 27 28int main() 29{ 30#if defined(__SSE2__) && (defined(__i386) || defined(_M_IX86)) && defined(__linux) 31 static_assert(std::alignment_of<std::max_align_t>::value >= 16, \"Unaligned heap objects possible\"); 32#endif 33 34 return 0; 35} 36") 37 38CHECK_CXX_SOURCE_COMPILES("${TEST_SOURCE}" HAVE_ALIGNED_MALLOC) 39 40if(NOT HAVE_ALIGNED_MALLOC) 41 set(HAVE_UNALIGNED_MALLOC 1) 42else() 43 unset(HAVE_ALIGNED_MALLOC) 44endif() 45 46unset(TEST_SOURCE) 47 48set(CMAKE_REQUIRED_QUIET "${CMAKE_REQUIRED_QUIET_COPY}") 49unset(CMAKE_REQUIRED_QUIET_COPY) 50