Make the CPUSTRING and additional from default optimizations configureable

This commit is contained in:
Tobias Frost 2015-06-19 15:50:17 +02:00
parent a7c6f4973b
commit 90d79158ee
3 changed files with 17 additions and 1 deletions

View file

@ -36,6 +36,10 @@ option(USE_SYSTEM_LIBJPEG
option(USE_SYSTEM_LIBGLEW
"Use the system libglew instead of the bundled one" OFF)
set(CPU_TYPE "" CACHE STRING "When set, passes this string as CPU-ID and disables CPU specific optimizatin which are not default for the compiler")
set(CPU_OPTIMIZATION "-mmmx -msse -msse2" CACHE STRING "Which CPU specific optimitations should be used beside the compiler's default?")
if(UNIX)
set(OPENAL TRUE)
endif()
@ -61,7 +65,12 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
#add_definitions(-Wall)
add_definitions(-Werror=format-security)
add_definitions(-Werror=format)
add_definitions(-mmmx -msse -msse2)
if(CPU_TYPE)
add_definitions(-DCPUSTRING="${CPU_TYPE}")
endif()
if (CPU_OPTIMIZATION)
add_definitions(${CPU_OPTIMIZATION})
endif()
if(WIN32)
# require msvcr70.dll or newer for _aligned_malloc etc
# I think it is from Visual C++ .NET 2002, so it should be available on any remotely modern system.

View file

@ -104,10 +104,14 @@ If you have questions concerning this license or the applicable additional terms
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
#ifndef CPUSTRING
#if defined(__i386__)
#define CPUSTRING "x86"
#elif defined(__x86_64__)
#define CPUSTRING "x86_86"
#else
#error unknown CPU
#endif
#endif
#if defined(__FreeBSD__)

View file

@ -29,7 +29,10 @@ If you have questions concerning this license or the applicable additional terms
#ifndef __SYS_INTRIINSICS_H__
#define __SYS_INTRIINSICS_H__
#if defined(__x86_64__)
// Enable this only on amd64
#define USE_INTRINSICS
#endif
#if defined(USE_INTRINSICS)
#include <emmintrin.h>