# The name of our project is "GRAY". CMakeLists files in this project can # refer to the root source directory of the project as ${GRAY_SOURCE_DIR} and # to the root binary directory of the project as ${GRAY_BINARY_DIR}. cmake_minimum_required (VERSION 2.6 FATAL_ERROR) if(DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type") else(DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose build type") endif(DEFINED CMAKE_BUILD_TYPE) project (GRAY) option(GRAY_ENABLE_GNURBS "Enable gnurbs integration" OFF) option(GRAY_ENABLE_OPENGL "Enable OpenGL integration" ON) option(GRAY_ENABLE_OPENMP "Enable OpenMP integration" ON) option(GRAY_ENABLE_FLTK "Enable Fltk integration" ON) option(GRAY_BUILD_SHARED "Build shared library" OFF) option(GRAY_BUILD_EXEC "Build test executable" ON) option(GRAY_ENABLE_PLY "Enable ply file format" ON) option(GRAY_ENABLE_PHOTONMAP "Enable photon mapping" ON) if(GRAY_ENABLE_OPENMP) find_package(OpenMP) if (OPENMP_FOUND) ADD_DEFINITIONS(-DGRAY_HAVE_OMP) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif(OPENMP_FOUND) endif(GRAY_ENABLE_OPENMP) if(GRAY_ENABLE_OPENGL) IF(NOT TARGET nutil-dynamic AND NOT TARGET nutil-static AND NOT INSIDE_CADXFEM_TREE) add_subdirectory(nutil) endif() IF(NOT TARGET nutil-dynamic AND NOT TARGET nutil-static AND NOT INSIDE_CADXFEM_TREE) add_subdirectory(nutil) endif() include_directories(. ${NUTIL_INCLUDE_DIRECTORIES} ${NUTIL_EXTERNAL_INCLUDES}) ADD_DEFINITIONS(-DGRAY_HAVE_OGL) if(GRAY_ENABLE_FLTK) ADD_DEFINITIONS(-DGRAY_HAVE_FLTK) endif (GRAY_ENABLE_FLTK) endif (GRAY_ENABLE_OPENGL) if(GRAY_ENABLE_GNURBS) include_directories(gnurbs/api) add_subdirectory(gnurbs) include_directories(${GNURBS_EXTERNAL_INCLUDES}) set(LIBS ${LIBS} gnurbs-dynamic ${GNURBS_EXTERNAL_LIBRARIES}) include_directories(gnurbs-interface) set(GRAY_SOURCE ${GRAY_SOURCE} gnurbs-interface/gnurbs-interface.cc) ADD_DEFINITIONS(-DGRAY_HAVE_GNURBS) endif(GRAY_ENABLE_GNURBS) set(GRAY_SOURCE ${GRAY_SOURCE} framebuffer.cc models.cc meshmodel.cc ray.cc scene.cc materials.cc camera.cc QuasiMonteCarlo.cc BoundingBox.cc BVTree.cc Texture.cpp) if (GRAY_ENABLE_PHOTONMAP) set(GRAY_SOURCE ${GRAY_SOURCE} photonMap.cc) ADD_DEFINITIONS(-D GRAY_HAVE_PHOTONMAP) endif (GRAY_ENABLE_PHOTONMAP) if (GRAY_ENABLE_OPENGL) set(GRAY_SOURCE ${GRAY_SOURCE} glu_gray.cc) if (GRAY_ENABLE_FLTK) set(GRAY_SOURCE ${GRAY_SOURCE} glframebuffer.cc ) endif (GRAY_ENABLE_FLTK) endif (GRAY_ENABLE_OPENGL) if (GRAY_ENABLE_PLY) set(GRAY_SOURCE ${GRAY_SOURCE} ply/plyfile.c) include_directories(ply) ADD_DEFINITIONS(-DGRAY_HAVE_PLY) endif (GRAY_ENABLE_PLY) if (GRAY_BUILD_SHARED) add_library(gray SHARED ${GRAY_SOURCE}) target_link_libraries (gray ${LIBS} ) endif (GRAY_BUILD_SHARED) if (GRAY_BUILD_EXEC) if (GRAY_ENABLE_OPENGL) if (GRAY_ENABLE_FLTK) if (GRAY_BUILD_SHARED) add_executable (glgray main.cc ) target_link_libraries (glgray ${LIBS} gray ${NUTIL_DYNAMIC_LIBRARIES} ${NUTIL_EXTERNAL_LIBRARIES}) else(GRAY_BUILD_SHARED) add_executable (glgray ${GRAY_SOURCE} main.cc ) # ${GRAY_SOURCE} target_link_libraries (glgray ${LIBS} ${CMAKE_DL_LIBS} ${NUTIL_DYNAMIC_LIBRARIES} )#${NUTIL_EXTERNAL_LIBRARIES} ) nutil-dynamic endif (GRAY_BUILD_SHARED) endif (GRAY_ENABLE_FLTK) endif (GRAY_ENABLE_OPENGL) endif (GRAY_BUILD_EXEC)