This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add processor detection and automated optimal compiler option selection.
- Loading branch information
castano
committed
Aug 21, 2007
1 parent
d6541bb
commit 5f327ce
Showing
3 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
# Assume i586 by default. | ||
SET(NV_SYSTEM_PROCESSOR "i586") | ||
|
||
IF(UNIX) | ||
FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) | ||
IF(CMAKE_UNAME) | ||
EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val) | ||
|
||
IF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown") | ||
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE NV_SYSTEM_PROCESSOR RETURN_VALUE val) | ||
ENDIF("${val}" GREATER 0 OR NV_SYSTEM_PROCESSOR STREQUAL "unknown") | ||
|
||
# processor may have double quote in the name, and that needs to be removed | ||
STRING(REGEX REPLACE "\"" "" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}") | ||
STRING(REGEX REPLACE "/" "_" NV_SYSTEM_PROCESSOR "${NV_SYSTEM_PROCESSOR}") | ||
ENDIF(CMAKE_UNAME) | ||
|
||
# Get extended processor information with: | ||
# `cat /proc/cpuinfo` | ||
|
||
ELSE(UNIX) | ||
IF(WIN32) | ||
SET (NV_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}") | ||
ENDIF(WIN32) | ||
ENDIF(UNIX) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
INCLUDE(${NV_CMAKE_DIR}/DetermineProcessor.cmake) | ||
|
||
# Set optimal options for gcc: | ||
IF(CMAKE_COMPILER_IS_GNUCXX) | ||
|
||
IF(NV_SYSTEM_PROCESSOR STREQUAL "i586") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i586") | ||
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "i586") | ||
|
||
IF(NV_SYSTEM_PROCESSOR STREQUAL "i686") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686") | ||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -mtune=i686 -msse3") | ||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=pentium4") | ||
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "i686") | ||
|
||
IF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=powerpc -maltivec -mabi=altivec -mpowerpc-gfxopt") | ||
|
||
# ibook G4: | ||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=7450 -mtune=7450 -maltivec -mabi=altivec -mpowerpc-gfxopt") | ||
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc") | ||
|
||
ENDIF(CMAKE_COMPILER_IS_GNUCXX) | ||
|
||
|