Added some initial configuration flags in CMake for gcc/clang

metadata
Edgar Velazquez-Armendariz 2013-02-26 17:43:51 -05:00
parent f514bc4a53
commit dc0fa6a26b
3 changed files with 39 additions and 23 deletions

View File

@ -47,12 +47,14 @@ else()
message(STATUS "mitsuba ${MTS_VERSION} (${MTS_DATE})") message(STATUS "mitsuba ${MTS_VERSION} (${MTS_DATE})")
endif() endif()
# Setup the build options
include (MitsubaBuildOptions)
# Find the external libraries and setup the paths # Find the external libraries and setup the paths
include (MitsubaExternal) include (MitsubaExternal)
# Setup the build options, include paths and compile definitions # Main mitsuba include directory
include (MitsubaBuildOptions) include_directories("include")
# ===== Prerequisite resources ===== # ===== Prerequisite resources =====

View File

@ -6,15 +6,17 @@ if (NOT DEFINED MTS_VERSION)
message(FATAL_ERROR "This file has to be included from the main build file.") message(FATAL_ERROR "This file has to be included from the main build file.")
endif() endif()
# Image format definitions # Default initial compiler flags which may be modified by advanced users
if (PNG_FOUND) if (MTS_CMAKE_INIT)
add_definitions(-DMTS_HAS_LIBPNG=1) set(MTS_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif() if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
if (JPEG_FOUND) set(MTS_CXX_FLAGS "-fvisibility=hidden -pipe -march=nocona -mfpmath=sse -ffast-math -Wall -Winvalid-pch")
add_definitions(-DMTS_HAS_LIBJPEG=1) endif()
endif() if (MTS_CXX_FLAGS)
if (OPENEXR_FOUND) set(CMAKE_CXX_FLAGS "${MTS_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" CACHE
add_definitions(-DMTS_HAS_OPENEXR=1) STRING "Flags used by the compiler during all build types." FORCE)
set(MTS_CXX_FLAGS)
endif()
endif() endif()
# Top level configuration definitions # Top level configuration definitions
@ -107,15 +109,7 @@ endif()
if (WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8) if (WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DWIN64) add_definitions(-DWIN64)
endif() endif()
if (MSVC AND MTS_SSE AND NOT CMAKE_CL_64)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
# Main mitsuba include directory set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
include_directories("include")
# Includes for the common libraries
include_directories(${Boost_INCLUDE_DIRS} ${Eigen_INCLUDE_DIR})
# If we are using the system OpenEXR, add its headers which half.h requires
if (OPENEXR_FOUND)
include_directories(${ILMBASE_INCLUDE_DIRS})
endif() endif()

View File

@ -244,3 +244,23 @@ CMAKE_DEPENDENT_OPTION(BUILD_PYTHON "Build the Python bindings." ON
if (PYTHONLIBS_FOUND AND mts_boost_PYTHON_FOUND) if (PYTHONLIBS_FOUND AND mts_boost_PYTHON_FOUND)
set (PYTHON_FOUND TRUE) set (PYTHON_FOUND TRUE)
endif () endif ()
# Includes for the common libraries
include_directories(${Boost_INCLUDE_DIRS} ${Eigen_INCLUDE_DIR})
# If we are using the system OpenEXR, add its headers which half.h requires
if (OPENEXR_FOUND)
include_directories(${ILMBASE_INCLUDE_DIRS})
endif()
# Image format definitions
if (PNG_FOUND)
add_definitions(-DMTS_HAS_LIBPNG=1)
endif()
if (JPEG_FOUND)
add_definitions(-DMTS_HAS_LIBJPEG=1)
endif()
if (OPENEXR_FOUND)
add_definitions(-DMTS_HAS_OPENEXR=1)
endif()