Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ set(QT_VERSION "6.5.2" CACHE STRING "Qt target version, defaults to 6.5.2")

# For AboutBox, but also validates that the version is valid
string(TIMESTAMP CURRENT_YEAR "%Y")
string(REGEX MATCH "^([0-9]+)"
QT_VERSION_MAJOR ${QT_VERSION})
string(REGEX MATCH "^([0-9]+\\.[0-9]+)"
QT_VERSION_MAJOR_MINOR ${QT_VERSION})
if(NOT QT_VERSION_MAJOR_MINOR)
Expand All @@ -544,7 +546,7 @@ message(STATUS "QT_INSTALL_DIR=${QT_INSTALL_DIR}")

find_package(Qt6 ${QT_VERSION} COMPONENTS CoreTools GuiTools WidgetsTools QmlTools WebEngineCoreTools REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

find_package(Qt6 ${QT_VERSION} COMPONENTS Core Core5Compat Gui Widgets Sql Svg Network Xml Concurrent PrintSupport Quick QuickWidgets Qml WebChannel Positioning WebEngineCore WebEngineWidgets Charts REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)
find_package(Qt6 ${QT_VERSION} COMPONENTS Core Core5Compat Gui Widgets Sql Svg Network Xml Concurrent OpenGL OpenGLWidgets Positioning PrintSupport Quick QuickWidgets Qml WebChannel WebEngineCore WebEngineWidgets REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

find_package(Qt6LinguistTools ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

Expand All @@ -563,7 +565,6 @@ find_file(qweb_resources_200 NAMES qtwebengine_resources_200p.pak PATHS "${QT_IN
# QT_WEB_LIBS are linked by OS App and openstudio_lib but not by openstudio_modeleditor.so or openstudio_modeleditor
list(APPEND QT_WEB_LIBS Qt6::WebEngineCore)
list(APPEND QT_WEB_LIBS Qt6::WebEngineWidgets)
list(APPEND QT_WEB_LIBS Qt6::Charts)
set_target_properties(${QT_WEB_LIBS} PROPERTIES INTERFACE_LINK_LIBRARIES "")

if(NOT APPLE)
Expand Down Expand Up @@ -658,10 +659,43 @@ if(UNIX)
list(APPEND QT_INCLUDES ${Qt6XcbQpa_INCLUDE_DIRS})
endif()

set(CMAKE_AUTOMOC OFF)

####################### JKQTPlotter ######################
# Make JKQTPlotter available after finding Qt
include(FetchContent)

# Build it statically
set(OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)

set(JKQtPlotter_BUILD_EXAMPLES OFF)
set(JKQtPlotter_BUILD_LIB_JKQTFASTPLOTTER OFF)

# Force finding the same Qt
find_package(QT NAMES Qt6 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGl REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH)

FetchContent_Declare(JKQTPlotter${QT_VERSION_MAJOR}
GIT_REPOSITORY https://github.com/jkriege2/JKQtPlotter.git
# GIT_TAG v5.0.0 # This is unreleased, but FetchContent support was added after v4.0.3
)

FetchContent_MakeAvailable(JKQTPlotter${QT_VERSION_MAJOR})

if (MSVC)
target_compile_definitions(JKQTPlotter${QT_VERSION_MAJOR} PRIVATE
_USE_MATH_DEFINES # To enable M_PI, M_E,..
DNOMINMAX # To Prevent Errors with min() and max()
_CRT_NO_VA_START_VALIDATION # To fix error: C2338: va_start argument must not have reference type and must not be parenthesized
)
target_compile_options(JKQTPlotter${QT_VERSION_MAJOR} PRIVATE /EHsc /wd4018)
endif()

set(BUILD_SHARED_LIBS ${OLD_BUILD_SHARED_LIBS})

##########################################################

set(CMAKE_AUTOMOC OFF)

# Get the OpenStudio Coalition Measures repo
FetchContent_Declare(
openstudio-coalition-measures
GIT_REPOSITORY https://github.com/openstudiocoalition/openstudio-coalition-measures.git
Expand Down
2 changes: 0 additions & 2 deletions src/openstudio_app/AboutBox.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
<p>OpenStudio is a cross-platform tool to support whole building energy and daylight modeling using <a href='http://apps1.eere.energy.gov/buildings/energyplus/'>EnergyPlus</a> and <a href='http://www.radiance-online.org/'>Radiance</a>.</p> \
<p>OpenStudio uses the following QT modules (version ${QT_VERSION}) that are dynamically linked using GNU Lesser General Public License (LGPL): \
<font size='2'>Qt6Core, Qt6Core5Compat Qt6Widgets, Qt6Network, Qt6Concurrent, Qt6PrintSupport, Qt6Gui, Qt6Quick, Qt6QuickWidgets, Qt6Qml, Qt6QmlModels, Qt6WebChannel, Qt6Positioning, Qt6WebEngine, Qt6WebEngineWidgets, QtWebEngineCore, Qt6DBus, Qt6Xml, Qt6Svg, Qt6OpenGL, Qt6OpenGLWidgets</font> </p> \
<p>And these Qt modules that are dynamically linked using GNU General Public License (GPL): \
<font size='2'>Qt6Charts</font> </p> \
<p> For information on QT, please refer to <a href='${QT_DOC_LINK}'>QT</a></p> \
<p> A copy of the GPL 3.0 and LGPL 3.0 are included in the root path of your installation directory.</p>"
#endif // OPENSTUDIOAPP_ABOUTBOX
2 changes: 2 additions & 0 deletions src/openstudio_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,9 @@ set(${target_name}_depends
openstudio::openstudiolib
${QT_LIBS}
${QT_WEB_LIBS}
JKQTPlotter${QT_VERSION_MAJOR}::JKQTPlotter${QT_VERSION_MAJOR}
)

if(WIN32)
list(APPEND ${target_name}_depends qtwinmigrate)
endif()
Expand Down
Loading
Loading