-
-
Notifications
You must be signed in to change notification settings - Fork 902
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
103 lines (85 loc) · 3.73 KB
/
CMakeLists.txt
File metadata and controls
103 lines (85 loc) · 3.73 KB
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
93
94
95
96
97
98
99
100
101
102
103
################################################################################
# #
# This file is part of IfcOpenShell. #
# #
# IfcOpenShell is free software: you can redistribute it and/or modify #
# it under the terms of the Lesser GNU General Public License as published by #
# the Free Software Foundation, either version 3.0 of the License, or #
# (at your option) any later version. #
# #
# IfcOpenShell is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# Lesser GNU General Public License for more details. #
# #
# You should have received a copy of the Lesser GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################
message("Running CMakeLists.txt in /src/qtviewer")
# Specify the Qt version and components to use
set(QT_VERSION 6 CACHE STRING "Qt version")
set(QT_COMPONENTS
Core
Gui
OpenGL
OpenGLWidgets
Widgets
CACHE STRING
"Qt components"
)
find_package(Qt${QT_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED PATHS ${QT_DIR})
if(Qt${QT_VERSION}_FOUND)
message(STATUS "Found Qt Version: ${Qt${QT_VERSION}_VERSION}")
endif()
message(STATUS "OSG_DIR: ${OSG_DIR}")
set(OSG_COMPONENTS osgDB osgGA osgUtil osgViewer CACHE STRING "OSG components")
# Do not add "PATHS <path>" in find_package for OpenSceneGraph CMake config to work
# on appleSiliconMacOS + Homebrew
find_package(OpenSceneGraph COMPONENTS ${OSG_COMPONENTS} REQUIRED)
if(OPENSCENEGRAPH_FOUND)
message(STATUS "Found OpenSceneGraph Version: ${OPENSCENEGRAPH_VERSION}")
endif()
set(targetName "QtViewer")
# Scan for .qrc files and add to build process
set(CMAKE_AUTORCC ON)
set(RESOURCE_FILES resources/qt_resources.qrc resources/qt_res.rc)
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
# generated by CMake. This variable contains the .icns file name,
# without the path.
set(MACOSX_BUNDLE_ICON_FILE ifcosLogo.icns)
# The following tells CMake where to find and install the file itself.
set(app_icon_macos "resources/ifcosLogo.icns")
set_source_files_properties(${app_icon_macos} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable(
${targetName}
MessageLogger.h
IfcViewerWidget.h
IfcViewerWidget.cpp
ParseIfcFile.h
ParseIfcFile.cpp
MainWindow.h
MainWindow.cpp
main.cpp
${RESOURCE_FILES}
${app_icon_macos}
)
set_target_properties(
${targetName}
PROPERTIES AUTOMOC On WIN32_EXECUTABLE ON MACOSX_BUNDLE ON RESOURCE "${RESOURCE_FILES}"
)
target_link_libraries(
${targetName}
${IFCOPENSHELL_LIBRARIES}
${OpenCASCADE_LIBRARIES}
${OPENSCENEGRAPH_LIBRARIES}
Qt${QT_VERSION}::Core
Qt${QT_VERSION}::Gui
Qt${QT_VERSION}::OpenGL
Qt${QT_VERSION}::OpenGLWidgets
Qt${QT_VERSION}::Widgets
)
target_include_directories(${targetName} PUBLIC ${QT_DIR}/include ${OPENSCENEGRAPH_INCLUDE_DIRS})
get_target_property(targetIncludeDirs ${targetName} INCLUDE_DIRECTORIES)
message(STATUS "target_include_directories: ${targetIncludeDirs}")
install(TARGETS ${targetName})