forked from KimuraRyo/BSDFProcessor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
92 lines (71 loc) · 2.97 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
## =================================================================== ##
## Copyright (C) 2014-2016 Kimura Ryo ##
## ##
## This Source Code Form is subject to the terms of the Mozilla Public ##
## License, v. 2.0. If a copy of the MPL was not distributed with this ##
## file, You can obtain one at http://mozilla.org/MPL/2.0/. ##
## =================================================================== ##
cmake_minimum_required(VERSION 2.8.11)
if(NOT LIBBSDF_DIR)
set(LIBBSDF_DIR ../libbsdf)
add_subdirectory(${LIBBSDF_DIR} LibbsdfBin)
endif()
include_directories(${LIBBSDF_DIR}/include)
project(BSDFProcessor)
set(SOURCE_PATH src)
file(GLOB SOURCES
"${SOURCE_PATH}/*.h"
"${SOURCE_PATH}/*.cpp"
"${SOURCE_PATH}/*.c")
include_directories(${SOURCE_PATH})
# Macro for developers
#add_definitions(-DDEVELOPMENT)
# Enable all warnings
#add_definitions(-Wall)
if(NOT EIGEN3_INCLUDE_DIR)
message(FATAL_ERROR "Please set the environment variable EIGEN3_INCLUDE_DIR to the include directory of your Eigen3 installation.")
endif()
include_directories("${EIGEN3_INCLUDE_DIR}")
set(OpenSceneGraph_MARK_AS_ADVANCED ON)
find_package(OpenSceneGraph 3.4.0 REQUIRED osgDB osgGA osgManipulator osgQt osgText osgUtil osgViewer osgWidget)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
# 32 bit executable
if(CMAKE_SIZEOF_VOID_P MATCHES 4)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
endif(CMAKE_SIZEOF_VOID_P MATCHES 4)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3 -O2")
endif()
find_package(OpenMP QUIET)
if(OPENMP_FOUND)
message("OpenMP found")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
if(APPLE)
set(ICON_FILE ${PROJECT_NAME}.icns)
set(MACOSX_BUNDLE_ICON_FILE ${ICON_FILE})
set_source_files_properties(icon/${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(SOURCES ${SOURCES} icon/${ICON_FILE})
elseif(MSVC)
set(SOURCES ${SOURCES} icon/${PROJECT_NAME}.rc)
endif()
qt5_add_resources(RESOURCE resource/resource.qrc)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32 ${SOURCES} ${RESOURCE})
target_link_libraries(${PROJECT_NAME}
${OPENSCENEGRAPH_LIBRARIES} Qt5::Widgets Qt5::OpenGL ${OPENGL_LIBRARIES}
libbsdf)