Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import osgQt into project via vcpkg + cmake? #57

Open
Dizww opened this issue Aug 11, 2022 · 1 comment
Open

How to import osgQt into project via vcpkg + cmake? #57

Dizww opened this issue Aug 11, 2022 · 1 comment

Comments

@Dizww
Copy link

Dizww commented Aug 11, 2022

I try to use vcpkg + cmake to import osgQt to my project.
To Reproduce
First use vcpkg to install osgQt
vcpkg install osgQt:x64-windows
then wirte the following information into CMakeLists.txt

find_package(OpenSceneGraph REQUIRED 
        COMPONENTS osg osgDB osgUtil osgViewer  osgQt
)
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
add_executable(myproject ${source})
target_link_libraries(myproject PRIVATE ${OPENSCENEGRAPH_LIBRARIES})

Failure logs

set VCPKG_ROOT:
set VCPKG_TARGET_TRIPLET: x64-windows
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- Build directory: D:/myproject/build
-- Build type : Release
-- Could NOT find osgQt (missing: OSGQT_LIBRARY)
CMake Error at D:/Program/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenSceneGraph (missing: OSGQT_FOUND) (found version
  "3.6.5")
Call Stack (most recent call first):
  D:/Program/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  D:/Program/CMake/share/cmake-3.22/Modules/FindOpenSceneGraph.cmake:226 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  D:/package/vcpkg/scripts/buildsystems/vcpkg.cmake:824 (_find_package)
  src/CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!

so, is there any way to import osgQt into the project via vcpkg + cmake?

@toszyrt
Copy link

toszyrt commented Sep 6, 2022

edit this file C:\Program Files\CMake\share\cmake-3.23\Modules\FindosgQt.cmake
like

include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH   (OSGQT osgQOpenGL/osgQOpenGLWidget)
OSG_FIND_LIBRARY(OSGQT osgQOpenGL)

include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgQt DEFAULT_MSG
    OSGQT_LIBRARY OSGQT_INCLUDE_DIR)

then

find_package(OpenSceneGraph 3.6.5
    REQUIRED COMPONENTS
        osg
        osgUtil
        osgGA
        osgViewer
        osgQt # https://blog.csdn.net/yao_yu_126/article/details/119410640
)
target_link_libraries(${target_name}
    PRIVATE
        ${OPENSCENEGRAPH_LIBRARIES} # 必须大写 我惊呆了
)

ref: https://blog.csdn.net/yao_yu_126/article/details/119410640

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants