2019-06-22 22:39:53 +08:00
|
|
|
# set minimum required CMake-Version
|
2019-11-18 22:59:06 +08:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2019-06-22 22:39:53 +08:00
|
|
|
|
|
|
|
# set Project name
|
|
|
|
set(EXAMPLE_NAME simpletest)
|
|
|
|
set(EXENAME jkqtptest_${EXAMPLE_NAME})
|
|
|
|
project(${EXAMPLE_NAME} LANGUAGES CXX)
|
|
|
|
|
|
|
|
# some basic configurations
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2019-11-18 22:59:06 +08:00
|
|
|
#set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
2019-06-22 22:39:53 +08:00
|
|
|
|
|
|
|
# Configure project for usage of Qt5
|
2022-04-19 05:10:05 +08:00
|
|
|
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGl REQUIRED)
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets PrintSupport Svg Xml OpenGL REQUIRED)
|
|
|
|
|
2019-06-22 22:39:53 +08:00
|
|
|
|
|
|
|
# include JKQTPlotter
|
2019-11-18 22:59:06 +08:00
|
|
|
find_package(JKQTPlotterLib REQUIRED)
|
2019-06-22 22:39:53 +08:00
|
|
|
|
|
|
|
# For Visual Studio, we need to set some additional compiler options
|
|
|
|
if(MSVC)
|
|
|
|
add_compile_options(/EHsc)
|
|
|
|
# To enable M_PI, M_E,...
|
|
|
|
add_definitions(/D_USE_MATH_DEFINES)
|
|
|
|
# To Prevent Errors with min() and max()
|
|
|
|
add_definitions(/DNOMINMAX)
|
|
|
|
# To fix error: C2338: va_start argument must not
|
|
|
|
# have reference type and must not be parenthesized
|
|
|
|
add_definitions(/D_CRT_NO_VA_START_VALIDATION)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# add the example executable
|
|
|
|
add_executable(${EXENAME} WIN32 simpletest.cpp)
|
2022-04-19 05:10:05 +08:00
|
|
|
# ... link against Qt5/6 and JKQTPlotterLib
|
2019-06-22 22:39:53 +08:00
|
|
|
# (you could use JKQTPlotterSharedLib if you don't want to link againast the
|
|
|
|
# static version, but against the shared/DLL version).
|
2022-04-19 05:10:05 +08:00
|
|
|
target_link_libraries(${EXENAME} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Xml JKQTPlotterLib)
|
2019-11-18 22:59:06 +08:00
|
|
|
|
|
|
|
# Installation
|
|
|
|
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
|
|
|
|
#Installation of Qt DLLs on Windows
|
2022-04-18 20:24:39 +08:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/jkqtplotter_deployqt.cmake)
|
2019-11-18 22:59:06 +08:00
|
|
|
jkqtplotter_deployqt(${EXENAME})
|