Adding jpeg library to C++ Qt Creator Project in ubuntu? - wrapper

I want to create a wrapper class for existing jpeg library. I have created the project in Qt creator ? Can anyone tell me how to link libjpeg8 in Qt Creator?

Just add
LIBS += -L/usr/lib -ljpeg8
in your .pro file

Related

QMake build static library using dlls

I have a Qt project which is a library.
Currently it works great but it is a dll and I want it to be a static library.
To do so I added "CONFIG += static" in my .pro file (I also tried "CONFIG += staticlib"). After doing so my library compiles well but it needs to be statically linked to libraries which were DLLs before.
Is there a way to compile a static library using dlls with QMake ? ?

How can I include Leptonica library in Tesseract Library cmakelists.cmake

I'm building Tesseract OCR for OpenCV for Raspberry Pi using VisualGDB and Visual Studio 2017.
I was able to build Leptonica library.
It is located here:
D:\Projects\tesseract\leptonica
The include files are located here D:\Projects\tesseract\leptonica\src
And the built .so library files are located here D:\Projects\tesseract\leptonica\build
I'm trying to add Leptonica Cmake files to Tesseract CMakelists.cmake
I'm reading the cmake tutorial found at https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/How-to-create-a-ProjectConfig.cmake-file
Unfortunately, its not a good tutorial but just an example, it doesn't explain the minimum lines I need to add another library.
Using the example, I tried adding
add_subdirectory(leptonica)
export(TARGETS leptonica FILE "${PROJECT_BINARY_DIR}/leptonica/build/LeptonicaConfig.cmake")
include(${CMAKE_CURRENT_SOURCE_DIR}/leptonica/build/LeptonicaConfig.cmake)
include_directories(${Leptonica_INCLUDE_DIRS})
target_link_libraries(tesseract ${Leptonica_LIBRARIES})
I'm getting errors:
A required package was not found
configure_file problem configuring file
What do I do to include the leptonica library in the tesseract CmakeLists so I can build Tesseract Ocr?
Also, it was asking for FindLeptonica.cmake do I need to create this file? What do I put in it?
Thanks

Creating a findable shared library with cmake

I am rewriting libraries from hand-written Makefiles to using cmake. I am getting stuck at the point where I need to library library A from library B.
I can find the libraries using find_package, but when they are being linked cmake complains about not having a rule for building the .so file because it is looking for it in the build directory instead of the installed directory.
This is explained if I look at the /usr/lib/cmake/library/libraryConfigVersion.cmake file, which contains this hardcoded path. This file was created with the following steps:
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/libraryConfigVersion.cmake"
VERSION ${LIBRARY_VERSION}
COMPATIBILITY AnyNewerVersion
)
export(EXPORT libraryTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/library/libraryConfigVersion.cmake"
NAMESPACE library::
)
(i have replaced my library name with 'library'). How can I get cmake to write the correct path so that I can easily link against my library from other cmake projects?
Command export actually exports build tree. This is explicitely written in the documentation.
For export install tree, use install(TARGETS ... EXPORT) plus install(EXPORT). Both flows are described in documentation for install command.
See also CMake tutorial Exporting and Importing Targets.

Compile protobuf with xCode 5

I want to use protobuf(https://code.google.com/p/protobuf/) in my project
Did you successfully compile protobuf with xCode 5, Please help to share your experience?
Thanks.
You can add support for Google Protocol Buffers to an Xcode 5 project using Cocoapods by adding the following line to your Podfile.
pod 'GoogleProtobuf', '~> 2.5.0'
This will place the C++ version of the protobuf code into a Pod for your project. It will also add the protoc compiler in the folder Pods/GoogleProtobuf/bin/protoc within your project.
You can create a custom build rule in your project that automatically converts the .proto files into .ph.{h,cc} files. Here is how I did that:
Setup a build rule to "Process Source files with names matching: *.proto Using Custom Script". The script should include the following:
cd ${INPUT_FILE_DIR}
${SRCROOT}/Pods/GoogleProtobuf/bin/protoc --proto_path=${INPUT_FILE_DIR} ${INPUT_FILE_PATH} --cpp_out=${INPUT_FILE_DIR}/cpp
Set the output files to include the following:
$(INPUT_FILE_DIR)/cpp/$(INPUT_FILE_BASE).pb.h
$(INPUT_FILE_DIR)/cpp/$(INPUT_FILE_BASE).pb.cc
Any .proto files you include in your project will now automatically be converted to C++ and then compiled as part of your build.
If you don't mind building Google Protobuf yourself then a good alternative to using Cocoapods is to run the bash script here.
https://gist.github.com/BennettSmith/7150245
This script will produce a proper build of Google Protobuf that supports the i386, armv7, armv7s, arm64 and x86_64 architectures. It will produce a static library that is universal. It will also produce the protoc compiler for use on OS X.

Using iOS Static Libraries without adding .a Files

We can use iOS Static Libraries without adding header files into the project.
But i want to use the Static Libraries without adding .a files into the project
Finally, I found the solution
Path of the static library should be added in ->target->build settings-> Other Linker Flags
eg.)
/Source/iPhoneApp/libs/Connection/build/Debug-iphonesimulator/libConnection.a /Source/iPhoneApp/libs/SocialNetwork/build/Debug-iphonesimulator/libSocialNetwork.a
If you built the library, you can use dependencies to add the library project to your app project without the hassle of configuring stuff.
To do so, just drag the .xcodeproj file from your library to the app project, go to the app target properties, and add a dependency on that library, just as you'd add a public framework such as MapKit.