diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/libFLAC/CMakeLists.txt | 25 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b3c9fcf5..bde3647b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.11) option(ENABLE_64_BIT_WORDS "Set FLAC__BYTES_PER_WORD to 8 (4 is the default)" OFF) option(WITH_XMMS "Build XMMS plugin" OFF) +option(BUILD_UTILS "Build utils" OFF) add_subdirectory("libFLAC") if(BUILD_CXXLIBS) @@ -17,7 +18,7 @@ if(BUILD_PROGRAMS) add_subdirectory("flac") add_subdirectory("metaflac") endif() -if(BUILD_CXXLIBS) +if(BUILD_UTILS) add_subdirectory(utils/flacdiff) if(WIN32) add_subdirectory(utils/flactimer) diff --git a/src/libFLAC/CMakeLists.txt b/src/libFLAC/CMakeLists.txt index cb5b2a63..44a3519d 100644 --- a/src/libFLAC/CMakeLists.txt +++ b/src/libFLAC/CMakeLists.txt @@ -1,7 +1,3 @@ -if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86(_64)?|(AMD|amd)64|i[346]86") - option(WITH_AVX "Enable AVX, AVX2 optimizations" ON) -endif() - option(WITH_ASM "Use any assembly optimization routines" ON) check_include_file("cpuid.h" HAVE_CPUID_H) @@ -10,14 +6,17 @@ check_include_file("sys/param.h" HAVE_SYS_PARAM_H) set(CMAKE_REQUIRED_LIBRARIES m) check_function_exists(lround HAVE_LROUND) -if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86_64|(AMD|amd)64") - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(IA32 TRUE) - endif() - add_definitions(-DFLAC__CPU_X86_64 -DFLAC__ALIGN_MALLOC_DATA) -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "([xX]|i[346])86") - set(IA32 TRUE) - add_definitions(-DFLAC__CPU_IA32 -DFLAC__ALIGN_MALLOC_DATA) +include(CheckCSourceCompiles) +include(CheckCPUArch) + +check_cpu_arch_x64(FLAC__CPU_X86_64) +if(NOT FLAC__CPU_X86_64) + check_cpu_arch_x86(FLAC__CPU_IA32) +endif() + +if(FLAC__CPU_X86_64 OR FLAC__CPU_IA32) + set(FLAC__ALIGN_MALLOC_DATA 1) + option(WITH_AVX "Enable AVX, AVX2 optimizations" ON) endif() include(CheckLanguage) @@ -31,7 +30,7 @@ if(NOT WITH_ASM) add_definitions(-DFLAC__NO_ASM) endif() -if(IA32) +if(FLAC__CPU_IA32) if(WITH_ASM AND CMAKE_ASM_NASM_COMPILER) add_subdirectory(ia32) endif() |