How to make lib files available to user in package recipe? - c++

I'm creating a conan package for OpenCV but am at a loss on what to put in package_info. Building OpenCV places .lib and .dll files in the paths x64\vc15\lib and x64\vc15\bin. This means that once I install the package and try to link I get linker errors as Visual C++ cannot find the files.
What is the correct way of making these files available to Visual Studio? Should I add code to the package method to move the bin and lib directories out of x64 and into package_folder or should I add code to package_info to indicate the path to those directories via self.cpp_info.libdirs?

Related

How to compile/build/link - the XLNT library?

I downloaded the xlnt library for working with Excel - https://github.com/tfussell/xlnt. Can you please tell me what to do with it further? Honestly, I still can’t understand how among all the files there are in the downloaded archive, and there are 100 of them .hpp and .cpp files, what should I do with them?
1)As far as I understand, they need to be processed by the Cmake program and it seems that the output should appear .lib file, but I absolutely can’t understand how to do it or maybe something else
2)Or how can they be directly processed by Visual Studio 2017?
PS:When I launch Smack, I select the Source folder, the Cmake generates many incomprehensible files, but among them there is not one file with the .lib extension.
Help me please.
With CMake you can obtain the visual studio 2017 project files
and then compile the xlnt library.
Unzip the archive file
Within the xlnt folder, create a new directory and call it build
Launche CMake (GUI)
Browse for the source code folder
Browse for the build folder xlnt/build
With the Configure button select the tool (IDE/compiler) that you want to use
Pressing the Generate button, CMake will generate (inside the build folder)
the visual studio 2017 project files you need to compile the xlnt library
Building the solution, VS 2017 produces the xlnt.lib, xlnt.exp and xlnt.dll files.
The source path you see in the CMake screenshot is incorrect. You must specify the path that contains the "top level" CMakeLists.txt file.
The correct directory is: C:/Users/Zver/source/repos/XLNT Library/xlnt-master.
The CMakeLists.txt file in the above directory tells CMake all necessary subdirectories.
At this point you will see the static compilation option of the library appear.
If you use the MinGW/GCC compiler you must prevent the path from containing empty spaces.
Then you need to rename the directory from "XLNT Library" to "XLNTLibrary". At this point the path would become:
C:/Users/Zver/source/repos/XLNTLibrary/xlnt-master.

Setting up Aquila for my c++ Project in Visual studio 2012

I want to use Aquila DSP to compute MFCC features in my project and trying to make it work.I followed this tutorial but after mingw32-make install on the source code pulled from Aquila's git repo, it generates only libAquila.a in lib folder. I tried changing my project's include and library dependencies using these generated files after install. Also tried adding FindAquila.cmake and tried building my project with cmake for VS 2012, still no luck. Keep getting "aquila/global.h" no such file or directory when I try to include "aquila/global.h".
I also tried building Aquila with cmake for VS 2012 and able to compile it and it generates .lib files as well, but not sure how to proceed with that.
If anyone knows how to make it work, it will be great help.
So, I made it work with Visual studio 2013. Now what I am doing is I am building Aquila with both Mingw and with VisualStudio. Mingw gives required include files and visual studio build gives required .lib files. I am building Aquila in VS 2013 with configuration type static lib (project properties >> General >> Configuration type) for both debug and release configuration and then I build the project.
For Mingw, first I use cmake GUI with mingw cmakefiles configuration and then run mingw32-make install in the build directory, which will put the include, lib and share files in the installation directory( usually C:\\Programme files\\Aquila.
Now I create a Folder Aquila and put include and share from above path and create a new folder lib with two subfolder debug and release. Here I put two .lib files in each folder (aquila.lib and Ooura_fft.lib) (debug libs in debug and release libs in release folder, they will be VS build folder). Once this is done, in my project setting, I add Additional include directories under C++ >> general, Addiotnal library path under linker >> general and names of libraries under linker >> input for both bebug and release configuration. After doing all these things, now the library works with my project.

Is it a Must to use both pthreadVC2.lib and pthreadVC2.dll in visual studio 2013?

I download pthread-w32-2-9-1-release.zip, unzip it and use Prebuild/include lib and dll with VisualStudio2013.
I set up a VC++ empty project "helloc" with main.c, then write a simple example with pthread_create pthread_join functions.
This is my configure:
Properties->C/C++->General->Additional Include Directories, add "F:\pthread_win32\include"
Properties->Linker->General->Additional Library Directories, add "F:\pthread_win32\lib\x86"
Properties->Linker->Input->Additional Dependencies, add "pthreadVC2.lib"
And it's successfully build, but when I click "Local Windows Debugger", the console break with "helloc.exe error because cannot find pthreadVC2.dll".
Then I copied pthreadVC2.dll to helloc/Debug/, same directory with helloc.exe, finally it's working.
But I don't know why the pthreadVC2.lib and pthreadVC2.dll are both required by helloc.exe. Is it a must that both lib and dll being used in VisualStudio ?
If only one of them (pthreadVC2.lib pthreadVC2.dll) is enough to support helloc.exe, how can I specify which one (dll or lib) I want to use in VisualStudio with helloc.exe ?
And I don't want to put all pthread libs and dlls into "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC", I want to know how to configure manually.
AFAICT, the pre-built library is just an import library for the DLL. (Allowing you to link against the DLL, hence required)
If you want to link statically, you'll have to rebuild the library yourself. See the README file for more information.

Box2D with cmake won't build a .lib file?

I am trying to use cmake to build the box2d library for visual studio 2012. This is what I have in cmake:
The Box2D/Box2D directory has all of the source files in it and the Box2D/Build directory is where I want to put all of the library things. I selected the visual studio 11 compiler and it compiled and generated without errors. However in the build folder I can't find any .lib file. This is what generates in the build folder:
I went through all of these directories but not one had any box2d.lib file in them. I don't know what I'm doing wrong. Help please?
Cmake only generates the build files so you can build it with the tool you choose in cmake - Visual Studio in your case. It only generated the Visual Studio project files. You have to open those files to build your library.
I fixed it! I built some projects in Project.sln and some .lib files were generated. I was thinking cmake was supposed to do that for you.

Troubles linking the libnoise library to a project in Visual Studio 2010

I am still fairly new to C++ and even newer to Visual Studio. I am attempting to link the perlin noise library 'libnoise' (found here) to my visual studio 2010 project, I have searched online for many many hours to no avail, this has been a road block for a few days now.
What are the steps needed to link this library?
The files that are downloaded are a bin folder (contains the .dll and .lib) and a include (headers I believe)
thank you in advance and please correct any mistakes I have made with asking this question.
You'll need to:
1. Add the header directory to Additional Include Directories (PROJECT->Properties->Configuration Properties->C/C++->General->Additional Include Directories, on drop down select <Edit...>)
2. Add the .lib directory to Additional Library Directories (PROJECT->Properties->Configuration Properties->Linker->General->Additional Library Directories, same above)
3. Add the .lib names you need to Additional Dependencies (PROJECT->Properties->Configuration Properties->Linker->Input->Additional Dependencies, same above)
4. After building your project, copy the .dll to your project's build directory, usually at your solution's Debug directory ("Solution Path"/Debug) or you would encounter *.dll is missing error. You should find "yourapp".exe file there as well.
Good Luck.
Edit: more can be found at http://en.wikibooks.org/wiki/C%2B%2B_Programming/Compiler/Linker/Libraries/Configuring_Visual_Studio
You can use nuget.
Open package manager console and type : Install-Package libnoise