Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #228 from coldtobi/master
rbdoom3: Option to set CPU_ID and to specify CPU Features to be used.
  • Loading branch information
RobertBeckebans committed Jun 24, 2015
2 parents 8a8deb6 + 9212ed4 commit 9d4c468
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
16 changes: 15 additions & 1 deletion neo/CMakeLists.txt
Expand Up @@ -39,6 +39,12 @@ 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 which will be embedded into the binary.")

set(CPU_OPTIMIZATION "-mmmx -msse -msse2" CACHE STRING "Which CPU specific optimitations should be used beside the compiler's default?")

option(USE_INTRINSICS "Compile using intrinsics (e.g mmx, sse, msse2)" ON)

if(UNIX)
set(OPENAL TRUE)
endif()
Expand All @@ -64,7 +70,15 @@ 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 (USE_INTRINSICS)
add_definitions(-DUSE_INTRINSICS)
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.
Expand Down
4 changes: 4 additions & 0 deletions neo/idlib/sys/sys_defines.h
Expand Up @@ -104,10 +104,14 @@ If you have questions concerning this license or the applicable additional terms

#elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__GNUC__) || defined(__clang__)

#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__)
Expand Down
2 changes: 0 additions & 2 deletions neo/idlib/sys/sys_intrinsics.h
Expand Up @@ -29,8 +29,6 @@ If you have questions concerning this license or the applicable additional terms
#ifndef __SYS_INTRIINSICS_H__
#define __SYS_INTRIINSICS_H__

#define USE_INTRINSICS

#if defined(USE_INTRINSICS)
#include <emmintrin.h>
#endif
Expand Down

0 comments on commit 9d4c468

Please sign in to comment.