Untitled
unknown
plain_text
a year ago
1.5 kB
8
Indexable
cmake_minimum_required(VERSION 3.16)
project(Prototype VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Specify VTK path if not automatically detected
set(CMAKE_PREFIX_PATH "/opt/homebrew/Cellar/vtk/9.3.1_2")
# Find Qt libraries
find_package(Qt6 6.5 REQUIRED COMPONENTS Quick)
# Find VTK libraries
find_package(VTK REQUIRED COMPONENTS
RenderingCore
RenderingOpenGL2
GUISupportQt
RenderingGL2PSOpenGL2
)
# Include VTK directories
include(${VTK_USE_FILE})
# Set up the project for Qt
qt_standard_project_setup(REQUIRES 6.5)
# Add the executable
qt_add_executable(appPrototype
main.cpp
VtkWidget.h
VtkWidget.cpp
)
# Add the QML module
qt_add_qml_module(appPrototype
URI Prototype
VERSION 1.0
QML_FILES Main.qml
)
# Set bundle properties
set_target_properties(appPrototype PROPERTIES
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
# Link against Qt and VTK libraries
target_link_libraries(appPrototype PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Quick
Qt6::Qml
Qt6::QuickControls2
${VTK_LIBRARIES}
)
# Add VTK include directories
target_include_directories(appPrototype PRIVATE ${VTK_INCLUDE_DIRS})
# Install settings
include(GNUInstallDirs)
install(TARGETS appPrototype
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
Editor is loading...
Leave a Comment