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.
Wed, 04/30/2025 - 17:03
hello,
could you teach me how to get working setup with manually listing libraries to link. Should I use ".pro" file?
Thanks.
Wed, 04/30/2025 - 23:07
Heres a copy of my .pro file. It's a bit hard-coded/scrappy in places, but quite frankly it does fine for development. I'm using AssImp, Eigen and TBB which you may not need.
QT += core gui opengl openglwidgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets DEFINES += _DEBUG TARGET = myApp TEMPLATE = app win32-g++ { message("windows") ASSIMP_INC_PATH = "C:\sandbox\assimp\include" ASSIMP_INC_PATH += "C:\sandbox\assimp\build\include" ASSIMP_LIB_PATH = "C:\sandbox\assimp\build\lib" ASSIMP_LIB_PATH2 = "C:\sandbox\assimp\build\contrib\zlib" EIGEN_INC_PATH = "C:\sandbox\eigen-3.4.0" OCC_INC_PATH = "C:\sandbox\OCCT-7_9_0\buildtbb\inc" OCC_LIB_PATH = "C:\sandbox\OCCT-7_9_0\buildtbb\win64\gcc\lib" CAS_INC_DIR = $$OCC_INC_PATH CAS_LIB_DIR = $$OCC_LIB_PATH } unix { message("Linux") ASSIMP_INC_PATH = "/home/mmaher/sandbox/assimp/include" ASSIMP_INC_PATH += "/home/mmaher/sandbox/assimp/build/include" ASSIMP_LIB_PATH = "/home/mmaher/sandbox/assimp/build/lib" ASSIMP_LIB_PATH2 = "/home/mmaher/sandbox/assimp/build/contrib/zlib" OCC_INC_PATH = "/home/mmaher/sandbox/OCCT-7_9_0/build/include/opencascade" OCC_LIB_PATH = "/home/mmaher/sandbox/OCCT-7_9_0/build/lin64/gcc/libd" } OCC_LIBS = \ # -lTKDEIGES -lTKDESTL -lTKDEVRML -lTKDESTEP -lTKDEOBJ \ -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim \ -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF -lTKXCAF \ -lTKDE -lTKBinXCAF -lTKRWMesh -lTKDEGLTF \ -lTKBRep -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d -lTKXSBase \ -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl ASSIMP_LIBS = -lassimp -lzlibstatic TBB_LIBS = -ltbb12 -ltbbmalloc # major, minor VERSION = 1.0 DEFINES += VERSION_STRING=\\\"$${VERSION}\\\" BINARYPATH = $$PWD/binaries/ DESTDIR = $$BINARYPATH/$$DESTINATION_PATH BUILDPATH = $$PWD/build/ OBJECTS_DIR = $$BUILDPATH/$$DESTINATION_PATH/.obj MOC_DIR = $$BUILDPATH/$$DESTINATION_PATH/.moc RCC_DIR = $$BUILDPATH/$$DESTINATION_PATH/.qrc UI_DIR = $$BUILDPATH/$$DESTINATION_PATH/.ui # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++17 CONFIG(release, debug|release) { DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_DEBUG msvc{ QMAKE_CFLAGS = /O2 QMAKE_CXXFLAGS = /O2 } else{ QMAKE_CFLAGS -= -O2 QMAKE_CFLAGS -= -O1 QMAKE_CXXFLAGS -= -O2 QMAKE_CXXFLAGS -= -O1 QMAKE_CFLAGS = -m64 -O3 QMAKE_LFLAGS = -m64 -O3 QMAKE_CXXFLAGS = -m64 -O3 } } HEADERS += \ src/Engine/PhysicsEngine.h \ src/Engine/meshconstraint.h \ src/Engine/physicsIntersectBox.h \ src/Engine/physicsMesh.h \ src/Engine/sceneconfiguration.h \ src/Engine/tbbTasks.h \ src/Helpers/filesystem.h \ src/Helpers/globals.h \ src/Visuals/CutShape.h \ src/Visuals/File2D.h \ src/Visuals/Line2d.h \ src/Visuals/canvas.h \ src/Visuals/mainWindow.h \ src/Visuals/manequin.h \ src/Visuals/occview.h \ src/Visuals/occviewenums.h \ src/Visuals/occwindow.h \ src/Visuals/selectowner.h \ src/Visuals/settings.h \ src/Visuals/stitchline.h \ src/Visuals/stretchline.h SOURCES += \ src/Engine/PhysicsEngine.cpp \ src/Engine/meshconstraint.cpp \ src/Engine/physicsIntersectBox.cpp \ src/Engine/physicsMesh.cpp \ src/Engine/sceneconfiguration.cpp \ src/Engine/tbbTasks.cpp \ src/Helpers/filesystem.cpp \ src/Visuals/CutShape.cpp \ src/Visuals/File2D.cpp \ src/Visuals/Line2d.cpp \ src/Visuals/canvas.cpp \ src/Visuals/canvas_bendmode.cpp \ src/Visuals/canvas_editmode.cpp \ src/Visuals/canvas_selectmode.cpp \ src/Visuals/canvas_stitchmode.cpp \ src/Visuals/main.cpp \ src/Visuals/mainWindow.cpp \ src/Visuals/manequin.cpp \ src/Visuals/occview.cpp \ src/Visuals/occwindow.cpp \ src/Visuals/selectowner.cpp \ src/Visuals/settings.cpp \ src/Visuals/stitchline.cpp \ src/Visuals/stretchline.cpp RESOURCES += \ res/icons.qrc win32 { DEFINES += WNT } INCLUDEPATH += $${OCC_INC_PATH} $${EIGEN_INC_PATH} $${ASSIMP_INC_PATH} LIBS += -L$${OCC_LIB_PATH} -L$${ASSIMP_LIB_PATH} -L$${ASSIMP_LIB_PATH2} LIBS += $${OCC_LIBS} $${ASSIMP_LIBS} $${TBB_LIBS}