Thu, 08/15/2024 - 20:22
Forums:
Hello. I have downloaded and installed openCascade 7.7, the pre compiled release for windows. I did the full installation. Now I'm trying to use it in a Qt creator project so I started a new Qt App project and configured the CMakeList.txt like this:
cmake_minimum_required(VERSION 3.16)
project(killoverlap VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
set(CMAKE_PREFIX_PATH
"C:/OpenCASCADE-7.7.0-vc14-64/opencascade-7.7.0/cmake"
"C:/OpenCASCADE-7.7.0-vc14-64/qt5.11.2-vc14-64/lib"
)
find_package(OpenCASCADE REQUIRED)
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(killoverlap
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET killoverlap APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(killoverlap SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(killoverlap
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(killoverlap PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
${OpenCASCADE_LIBRARIES}
)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.killoverlap)
endif()
set_target_properties(killoverlap PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
include(GNUInstallDirs)
install(TARGETS killoverlap
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(killoverlap)
endif()
Unfortunately when I try to build the Release an compiling error is shown:
14:12:57: Running steps for project killoverlap...
14:12:57: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/Users/Ezequiel/Documents/qt/killoverlap/build/Desktop_Qt_6_7_2_MinGW_64_bit-Release --target all
ninja: error: 'C:/occt-3rdparty/Windows-64-VC141/angle-gles2-2.1.0-46ad513f4e5b-vc14-64/lib/libEGL.lib', needed by 'killoverlap.exe', missing and no known rule to make it
14:12:58: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1.
Error while building/deploying project killoverlap (kit: Desktop Qt 6.7.2 MinGW 64-bit)
When executing step "Build"
14:12:58: Elapsed time: 00:00.
That's why I added the line
"C:/OpenCASCADE-7.7.0-vc14-64/qt5.11.2-vc14-64/lib"
to the cmake_prefix_path. But even with that libEGL.lib file there. it seems the project can't find it as it looks somewhere else.
Does anybody know what am I doing wrong?
Thanks!
Sat, 08/24/2024 - 11:06
Hello, you are doing everything correct. It is a old OCCT bug with CMake.
There a few options to fix:
- Modify CMake Configuration inside your installations
- link OCCT manually without CMake
- rebuild OCCT locally.
That and other CMake bugs are target for 7.9. version. We plan to reorginize CMake to be valid on the most scenarios.
Best regards, Dmitrii.
Tue, 09/17/2024 - 20:15
Hi,
Could you elaborate please? I'm trying to compile an app with cmake without any success with "No rule to make target '/usr/lib/TKernel.lib'" error.
What should I change in cmake configuration inside my installation?
Wed, 09/18/2024 - 14:08
Not important anymore. Ditched cmake and get working setup with manually listing libraries to link.