Using Ogre library locally for a project - c++

what I would like to do is to have an application (I am currently working off the sample framework app) and include any ogre library files with it, as opposed to have it installed for the whole system. This way I can easily port the application onto other computers once built.
I am on Mac OS 10.9. I built Ogre by first running the CMake app to configure the Xcode project, then opening the created Xcode project and building the Install and SampleBrowser congifurations. A directory sdk/lib was created in the Ogre directory. This contains directories debug, OGRE and pkgconfig. The OGRE directory has all the samples .dylib files. What I do not see is the main ogre library file.
The contents of the file lib/pkgconfig/Ogre.pc suggest that there should be a library file called OgreMain in the lib directory:
Libs: -L${libdir} -lOgreMain -lpthread
As far as I understand it, I need this library file to be a part of my project. I could then link the sdk/include for all the Ogre's header files. I am confused about how to make this work. Could anyone please help?

Sounds like this is Ogre 1.8. In that case the libraries and frameworks need to be installed in your application bundle. Inside MyApp.app/Contents you will need folders named Components, Plugins and Frameworks. Ogre.framework goes in frameworks, component dylibs go into Components, plugin dylibs go in Plugins.

I actually found a great tutorial that worked straight away for me here: http://will.thimbleby.net/ogre3d-tutorial/
This is for Ogre 1.8, the only difference when using Ogre1.9 is that you don't use RenderSystem_GL.dylib but RenderSystem_GL.framework (found at the same place as Ogre.framework) and you deal with it in the same manner in terms of your project setup as with Ogre.framework.

Related

Add a library to CMake macOS bundle

How can I add a libary to a macos bundle, such that it ends up in the bundle as well? The library in question is part of the project, which has two targets: a library and a
bootstrapper executable. If I make the boostrapper executable a Macos Bundle the app bundle is built and works fine but however the library is not put into the bundle. How can I achieve this? It is a rather general question but you can see the current state here.

QT missing dll after deploy

I've copied all of the dlls from QT that were required, and my application works fine on my Windows server machine.
However when trying to run it on a Windows 7 box i get the following message:
This application failed to start because it could not find or load he
Qt platform plugin "windows".
Reinstallning the application may fix this problem.
Any ideas what I'm missing here?
I'd scratched my head over this some time ago. It turned out that this was caused not by missing qwindows.dll, but rather one of libEGL.dll or libGLESv2.dll. This was tricky, because dependency walker does not show those libs as direct dependencies.
If you want to test on your dev machine, whether your app has all required libs, fire up console issue SET PATH=, cd to your app directory and run it.
This is complete list of dlls that my app is using (Qt 5.2 / QtQuick app only, rest is C++). QtQuick is nice but the size of Qt dependencies is a bit scary:
icu*.dll - depending on whether you've compiled with ICU
libEGL.dll
libGLESv2.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Network.dll
Qt5Qml.dll
Qt5Quick.dll
Qt5Widgets.dll
Widely used solution is put all necessary libraris in the folder of application.
What are libraries application need?
Run application and see error message:
The program can't start because <Library name> is missing from your computer.
Try reinstalling the program to fix this problem
Library set is depended from Qt version. Run several times application and each time copy required lib you found what is neeeded for application.
In my case (Qt 5.2.1) there are
icudt51.dll,
icuin51.dll,
icuuc51.dll,
libgcc_s_dw2-1.dll,
libstdc++-6.dll,
libwinpthread-1.dll,
Qt5Core.dll,
Qt5Gui.dll,
Qt5Widgets.dll.
All libs you can found in your Qt install folder. But don't use libraries from Tools\QtCreator folder, because QtCreator has another version of these libraries!
In case of error:
This application failed to start because it could not find or load he Qt platform plugin windows. Reinstallning the application may fix this problem.
You should create folder platforms and copy qwindows.dll into it.
If you still got error you should create qt.conf file in application's folder with content:
[Paths]
Plugins=plugins
This solution is described in https://qt-project.org/forums/viewthread/37265
More information about qt.conf you can find at http://qt-project.org/doc/qt-5/qt-conf.html
In latest versions of Qt you can find deploy tool (since 5.2). This tool find necessary libraries for application and copy into application folder. You can run it something like this:
call c:\Qt\QtX.Y.Z\X.Y.Z\mingw48_32\bin\qtenv2.bat
cd /d "c:\path\to\your\application\folder"
windeployqt.exe your_application.exe
Generally it works well. But I notice that some libraries are not copied, but you can found by method is descibed at beggining of post. More useful information you can find at
http://qt-project.org/doc/qt-5/windows-deployment.html
In rare cases yo can got this error if some library is missing but not appear in error message above. Example: Qt 5.1.1: Application failed to start because platform plugin "windows" is missing
I wasn't in this situation, so I can't tell more.

How do I compile libnoise on Mac OS X Mountain Lio

I am new to the Mac OS X environment when it comes to compiling linux based libraries. Whenever I used a library i just downloaded the .framework file, added it to my /Library/Frameworks and included it in my XCODE project, and all was fine.
Now I am stuck with libnoise. I want to use it on my project and I have no idea how to generate the .framework file/directory.
Can you help me please?
If you have libnoise, most likely it contains some sort of a Makefile or a configure script.
By running the
./configure
make all
you will get the library file (libnoise.a) for your platform, the OSX10.8.
Framework is essentially a folder with specific layout and a .plist file. To generate such a folder automatically, you may create an expty Xcode project of the type Framework and add the libnoise.a you've just created as a linker's input.
There is a detailed instruction on how to create the Framework from static libraries (.a files): http://www.blackdogfoundry.com/blog/creating-a-library-to-be-shared-between-ios-and-mac-os-x/
You might be missing the header files in you framework, but then can be also added to the Xcode project from libnoise sources.
This SO answer may be of use also: Difference between framework and static library in xcode4, and how to call them
Apple's documentation is also good: https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html
I'm not entirely sure if this is what was meant by "with a different fork and cmake"
but I got libnoise to run in my mac using this git repo.
https://github.com/qknight/libnoise

How do I reference a dylib?

I have an application written in platform-independent C++ which has been primarily developed on Windows. I'm now trying to get it up and running on a Mac but I seem to be lost in how to link to the Mac version of a third-party library I'm using. I added the library's include and lib folders to header and library search paths respectively and it compiles/links but upon running dies with the following:
dyld: Library not loaded: #executable_path/../Frameworks/libsfml-system-d.2.dylib
Referenced from: /Users/jdoe/Library/Developer/Xcode/DerivedData/Foobar-fonhiddwdwvgqygcegiffqkontxi/Build/Products/Debug/Foobar.app/Contents/MacOS/Foobar
Reason: image not found
I can get it to run by putting the dylibs in /usr/lib but I don't think this is a good idea for distribution. How can I include the dylib inside my app bundle?
Add a copy-files build phase that copies the dylib into the Frameworks folder inside the app bundle. (When you Get Info on a copy files build phase, Frameworks is one of the destination choices.)

Building and Using a DYLIB in Xcode

I'm trying to build a .dylib in Xcode. Currently the .dylib builds, but when I drag the .dylib into another project and try to #import one of the headers (Seeker.h) in the .dylib, I get this error:
*: No such file or directory
Seeker.h: No such file or directory
The project is available as an Xcode project here.
I can confirm the header is indeed in a path alongside the .dylib once built, but as for what to do with it I have no idea. My only experience with .dylib files is frameworks built into Mac OS X, like libsqlite3.dylib, which works perfectly. All the tutorials I can find on .dylib files does not cover how to use them with Xcode in a sensible manner; all of them rely either on complex scripts or machine-dependent configuration which will not work for us.
So basically I need a start-to-finish step-by-step process that successfully builds the .dylib and successfully includes it in another Xcode project in a way that's not dependent on changing build settings for different users. In other words, a way that just works and that will work when we distribute both projects to members of our team.
Dylibs don't carry headers: they're brainless executable files. Built-in libraries have their headers in known locations, like /usr/include, which makes them globally available. What you're looking for is probably a framework.
Frameworks are packages that contain a dynamic library and header files, so once you link with the framework you can import the headers it has. It can also carry other resources such as images and sounds.
I suggest you read the Framework Programming Guide for more informations.
You are not able to create static library .dylib from Xcode because they are using OS, but you are able to create a dynamic framework with .dylib inside
[iOS static vs dynamic library]
[Create dynamic framework]