Cleanup configuration.

pull/329/head
Ignacio 2 years ago
parent 2ab73d8cd5
commit 09164a5fd3
  1. 3
      CMakeLists.txt
  2. 72
      cmake/DetermineProcessor.cmake
  3. 47
      cmake/OptimalOptions.cmake
  4. 115
      src/CMakeLists.txt

@ -17,9 +17,6 @@ else()
endif()
INCLUDE(${NV_CMAKE_DIR}/OptimalOptions.cmake)
MESSAGE(STATUS "Setting optimal options")
MESSAGE(STATUS " Processor: ${NV_SYSTEM_PROCESSOR}")
MESSAGE(STATUS " Compiler Flags: ${CMAKE_CXX_FLAGS}")
IF(CMAKE_BUILD_TYPE MATCHES "debug")
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Postfix for debug build libraries.")

@ -1,72 +0,0 @@
# 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")
IF(NV_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
SET(NV_SYSTEM_PROCESSOR "powerpc")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
# 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 from /proc/cpuinfo
#~ IF(EXISTS "/proc/cpuinfo")
#~ FILE(READ /proc/cpuinfo PROC_CPUINFO)
#~ SET(VENDOR_ID_RX "vendor_id[ \t]*:[ \t]*([a-zA-Z]+)\n")
#~ STRING(REGEX MATCH "${VENDOR_ID_RX}" VENDOR_ID "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${VENDOR_ID_RX}" "\\1" VENDOR_ID "${VENDOR_ID}")
#~ SET(CPU_FAMILY_RX "cpu family[ \t]*:[ \t]*([0-9]+)")
#~ STRING(REGEX MATCH "${CPU_FAMILY_RX}" CPU_FAMILY "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${CPU_FAMILY_RX}" "\\1" CPU_FAMILY "${CPU_FAMILY}")
#~ SET(MODEL_RX "model[ \t]*:[ \t]*([0-9]+)")
#~ STRING(REGEX MATCH "${MODEL_RX}" MODEL "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${MODEL_RX}" "\\1" MODEL "${MODEL}")
#~ SET(FLAGS_RX "flags[ \t]*:[ \t]*([a-zA-Z0-9 _]+)\n")
#~ STRING(REGEX MATCH "${FLAGS_RX}" FLAGS "${PROC_CPUINFO}")
#~ STRING(REGEX REPLACE "${FLAGS_RX}" "\\1" FLAGS "${FLAGS}")
#~ # Debug output.
#~ IF(LINUX_CPUINFO)
#~ MESSAGE(STATUS "LinuxCPUInfo.cmake:")
#~ MESSAGE(STATUS "VENDOR_ID : ${VENDOR_ID}")
#~ MESSAGE(STATUS "CPU_FAMILY : ${CPU_FAMILY}")
#~ MESSAGE(STATUS "MODEL : ${MODEL}")
#~ MESSAGE(STATUS "FLAGS : ${FLAGS}")
#~ ENDIF(LINUX_CPUINFO)
#~ ENDIF(EXISTS "/proc/cpuinfo")
#~ # Information on how to decode CPU_FAMILY and MODEL:
#~ # http://balusc.xs4all.nl/srv/har-cpu-int-pm.php
ELSE(UNIX)
IF(WIN32)
# It's not OK to trust $ENV{PROCESSOR_ARCHITECTURE}: its value depends on the type of executable being run,
# so a 32-bit cmake (the default binary distribution) will always say "x86" regardless of the actual target.
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
SET (NV_SYSTEM_PROCESSOR "x86_64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET (NV_SYSTEM_PROCESSOR "x86")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(WIN32)
ENDIF(UNIX)

@ -1,56 +1,11 @@
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")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=prescott")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "i686")
IF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=athlon64")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=athlon64 -msse3")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "x86_64")
IF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=powerpc -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
# ibook G4:
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=7450 -mtune=7450 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
# G5
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=G5 -faltivec -maltivec -mabi=altivec -mpowerpc-gfxopt")
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "powerpc")
# IF(DARWIN)
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
# ENDIF(DARWIN)
IF(APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i586 -arch x86_64 -msse3 -mmacosx-version-min=10.5")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i586 -arch x86_64 -msse3 -mmacosx-version-min=10.5")
ENDIF(APPLE)
IF(CMAKE_BUILD_TYPE STREQUAL "debug")
ADD_DEFINITIONS(-D_DEBUG)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "debug")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
ENDIF()
IF(MSVC)
# @@ Some of these might only be available in VC8.
# Code generation flags.
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2 /fp:fast")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2 /fp:fast")

@ -11,46 +11,6 @@ SUBDIRS(nvtt)
SUBDIRS(bc6h)
SUBDIRS(bc7)
# OpenGL
#INCLUDE(FindOpenGL)
#IF(OPENGL_FOUND)
# MESSAGE(STATUS "Looking for OpenGL - found")
#ELSE(OPENGL_FOUND)
# MESSAGE(STATUS "Looking for OpenGL - not found")
#ENDIF(OPENGL_FOUND)
# GLUT
#INCLUDE(FindGLUT)
#IF(GLUT_FOUND)
# MESSAGE(STATUS "Looking for GLUT - found")
#ELSE(GLUT_FOUND)
# MESSAGE(STATUS "Looking for GLUT - not found")
#ENDIF(GLUT_FOUND)
# DirectX
#INCLUDE(${NV_CMAKE_DIR}/FindDirectX.cmake)
#IF(DX10_FOUND)
# MESSAGE(STATUS "Looking for DirectX - found")
#ELSE(DX10_FOUND)
# MESSAGE(STATUS "Looking for DirectX - not found")
#ENDIF(DX10_FOUND)
# GLEW
#INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
#IF(GLEW_FOUND)
# MESSAGE(STATUS "Looking for GLEW - found")
#ELSE(GLEW_FOUND)
# MESSAGE(STATUS "Looking for GLEW - not found")
#ENDIF(GLEW_FOUND)
# Cg
#INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
#IF(CG_FOUND)
# MESSAGE(STATUS "Looking for Cg - found")
#ELSE(CG_FOUND)
# MESSAGE(STATUS "Looking for Cg - not found")
#ENDIF(CG_FOUND)
# CUDA
FIND_PACKAGE(CUDA)
IF(CUDA_FOUND)
@ -66,71 +26,16 @@ ELSE(CUDA_FOUND)
MESSAGE(STATUS "Looking for CUDA - not found")
ENDIF(CUDA_FOUND)
# Maya
#INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
#IF(MAYA_FOUND)
# SET(HAVE_MAYA ${MAYA_FOUND} CACHE BOOL "Set to TRUE if Maya is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for Maya - found")
#ELSE(MAYA_FOUND)
# MESSAGE(STATUS "Looking for Maya - not found")
#ENDIF(MAYA_FOUND)
# FreeImage
#INCLUDE(${NV_CMAKE_DIR}/FindFreeImage.cmake)
#IF(FREEIMAGE_FOUND)
# SET(HAVE_FREEIMAGE ${FREEIMAGE_FOUND} CACHE BOOL "Set to TRUE if FreeImage is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for FreeImage - found")
#ELSE(FREEIMAGE_FOUND)
# MESSAGE(STATUS "Looking for FreeImage - not found")
#ENDIF(FREEIMAGE_FOUND)
# JPEG
#INCLUDE(FindJPEG)
#IF(JPEG_FOUND)
# SET(HAVE_JPEG ${JPEG_FOUND} CACHE BOOL "Set to TRUE if JPEG is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for JPEG - found")
#ELSE(JPEG_FOUND)
# MESSAGE(STATUS "Looking for JPEG - not found")
#ENDIF(JPEG_FOUND)
# PNG
#INCLUDE(FindPNG)
#IF(PNG_FOUND)
# SET(HAVE_PNG ${PNG_FOUND} CACHE BOOL "Set to TRUE if PNG is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for PNG - found")
#ELSE(PNG_FOUND)
# MESSAGE(STATUS "Looking for PNG - not found")
#ENDIF(PNG_FOUND)
# TIFF
#SET(TIFF_NAMES libtiff)
#INCLUDE(FindTIFF)
#IF(TIFF_FOUND)
# SET(HAVE_TIFF ${TIFF_FOUND} CACHE BOOL "Set to TRUE if TIFF is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for TIFF - found")
#ELSE(TIFF_FOUND)
# MESSAGE(STATUS "Looking for TIFF - not found")
#ENDIF(TIFF_FOUND)
# OpenEXR
#INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
#IF(OPENEXR_FOUND)
# SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for OpenEXR - found")
#ELSE(OPENEXR_FOUND)
# MESSAGE(STATUS "Looking for OpenEXR - not found")
#ENDIF(OPENEXR_FOUND)
# OpenMP
INCLUDE(FindOpenMP)
IF(OPENMP_FOUND)
SET(HAVE_OPENMP ${OPENMP_FOUND} CACHE BOOL "Set to TRUE if OpenMP is found, FALSE otherwise")
MESSAGE(STATUS "Looking for OpenMP - found")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ELSE(OPENMP_FOUND)
MESSAGE(STATUS "Looking for OpenMP - not found")
ENDIF(OPENMP_FOUND)
# INCLUDE(FindOpenMP)
# IF(OPENMP_FOUND)
# SET(HAVE_OPENMP ${OPENMP_FOUND} CACHE BOOL "Set to TRUE if OpenMP is found, FALSE otherwise")
# MESSAGE(STATUS "Looking for OpenMP - found")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# ELSE(OPENMP_FOUND)
# MESSAGE(STATUS "Looking for OpenMP - not found")
# ENDIF(OPENMP_FOUND)
# Threads
FIND_PACKAGE(Threads REQUIRED)
@ -149,5 +54,3 @@ CHECK_INCLUDE_FILES("dispatch/dispatch.h" HAVE_DISPATCH_H)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nvconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h)
#INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/nvconfig.h DESTINATION include)

Loading…
Cancel
Save