vcpkg with ogre-next

Problems building or running the engine, queries about how to use features etc.
User avatar
bishopnator
Gnome
Posts: 348
Joined: Thu Apr 26, 2007 11:43 am
Location: Slovakia / Switzerland
x 16

vcpkg with ogre-next

Post by bishopnator »

Ogre Version: :?: ogre-next 2.3.3
Operating System: :?: windows
Render System: :?: d3d11

Hi, after many years I decided to play with ogre again. Luckily it is already part of vcpkg and I installed the library without any difficulties. I am trying to integrate the library in my current cmake scripts, but it is somehow not working at all. My project uses from vcpkg already some other libraries, like sigc++ and it is as simple as writing following like in the cmake script:
FIND_PACKAGE(sigc++-3 CONFIG REQUIRED)
(and later of course linking)

With ogre-next I have no idea what should I write for FIND_PACKAGE or what is the way of integrating ogre-next into projects outside the sample directory of vcpkg. I tried I thin all combinations of ogre-next, ogre, with different casing of the letters, but none of that worked.

Let's consider, that I have git clone of vcpkg at one place - there I have full sources, compiled and linked libraries. Then with vcpkg.exe export I create the exported version of vcpkg which I copy to my "external dependencies" of my project and I have use the libraries from it (like sigc++3 mentioned above).

How should I add ogre-next with exported vcpkg in my project? Does anybody do that? I hope I don't have to manually copy the files outside the vcpkg.

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5537
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1395

Re: vcpkg with ogre-next

Post by dark_sylinc »

Hi!

I don't know who is maintaining the vcpkg, but AFAIK it isn't us.

I'm afraid I can't help you with that. We have a guide on how to setup external projects.

Inside our repository you will find Samples/2.0/Tutorials/Tutorial00_Basic which is extremely basic and gets you the gists of the basics to get a project running.

While Tutorial01_Initialization and onwards start using the demo code from Samples/2.0/Common to initialize most interfaces in a convenient way, preventing many of the usual problems.

And you'll find EmptyProject in Samples/2.0/Tutorials/EmptyProject which is for you to modify and move out of the repo that you can customize for your projects (which depends on the Common code; the CMake scripts will copy the common into EmptyProject for you).

Cheers

User avatar
bishopnator
Gnome
Posts: 348
Joined: Thu Apr 26, 2007 11:43 am
Location: Slovakia / Switzerland
x 16

Re: vcpkg with ogre-next

Post by bishopnator »

Hi, this is not exactly what I was looking for. I found some references for vcpkg here: https://ogrecave.github.io/ogre/api/1.1 ... otoc_md253 so I thought that it should be easy. Anyway I got it working - at least my project is created and compilable and it seems that all folders to Ogre are setup properly - I will check it later when I get running some simple rendering in my app's window.

For now here are some points which I needed to setup to get it working:
1. it is necessary to install pkgconf and ogre-next through vcpkg:

Code: Select all

vcpkg.exe install pkgconf
vcpkg.exe install ogre-next

2. export the package:

Code: Select all

vcpkg.exe export ogre-next pkgconf --7zip --host-triplet=x64-windows --output-dir=./out --output=my-ogre-vcpkg

3. in your main CMakeLists.txt file add "connection" to vcpkg:

Code: Select all

# configure vcpkg
SET(MyProject_ExtDepDir ...) <--- set the path to project's external dependencies
SET(MyProject_vcpkg_VER my-ogre-vcpkg)
SET(CMAKE_TOOLCHAIN_FILE ${MyProject_ExtDepDir}/vcpkg/${MyProject_vcpkg_VER}/scripts/buildsystems/vcpkg.cmake)
SET(VCPKG_TARGET_TRIPLET x64-windows)

4. setup path for OGRE finder script:

Code: Select all

# OGRE
LIST(PREPEND CMAKE_MODULE_PATH ${MyProject_MAIN_DIR}/cmake)
LIST(PREPEND CMAKE_MODULE_PATH ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/ogre-next)
SET(PKG_CONFIG_EXECUTABLE ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/pkgconf/pkgconf.exe)
SET(OGRE_INC_SEARCH_PATH ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/OGRE-Next)
SET(OGRE_LIB_SEARCH_PATH ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/OGRE-Next ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/OGRE-Next)
SET(OGRE_BIN_SEARCH_PATH ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin)

5. add find for the OGRE and include:

Code: Select all

FIND_PACKAGE(OGRE REQUIRED)
INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIR})

6. add linking with OGRE:

Code: Select all

TARGET_LINK_LIBRARIES(MyProject ${OGRE_LIBRARY})

This at least work for me .. I will se later whether I will get some other problems.

I think the vcpkg is maintained by Microsoft, but I am not sure who maintain specifically ogre and ogre-next within the vcpkg. It is possible that there are external maintainers. Anyway the compilation and installing of ogre through vcpkg is so easy that it will be perfect to get some notes about it to ogre's wiki including the information how to use ogre through it.