How does one compile libqt4 OR wkhtmtltopdf for Solaris? - webkit

Anyone have REALLY specific and accurate information about which libraries I need in order to compile both libqt and wkhtmltopdf in Solaris?

Related

Conan recipe dependencies

I am starting to learn conan and I have a doubt. Lets say I have a library that depends on boost and on cgal. Cgal it self depends also on boost.
If I have a recipe for cgal, how would I indicate that I want to use the same boost version that I am using on the library?
You need to check first which version cgal is using and set the same specific version in your new recipe.
If you use a different version, Conan will warning you, but you can force it using the override argument. So you will be able to use different versions.
Of course, if you want to use the same version and be sure that it will not change after some while, you can use the package revision too. So you will use the exactly same version for every new build.
Why Conan can not detect the version dynamically? Well, it's the chicken-egg question. To detect the requirements and generate the graph-lock, first, Conan need to know what you need as requirement in you recipe. On the other hand, you want to know the graph-lock before saying what you need, to detect the correct Boost version. Thus, you won't be able to know which Boost version is being used by cgal, before to set your own requirements and Conan be able to generate the dependence tree.

Portable whole-archive linking in CMake

If you want to link a static library into an shared library or executable while keeping all the symbols visible (e.g. so you can dlopen it later to find them), a non-portable way to do this on Linux/BSD is to use the flag -Wl,--whole-archive. On macOS, the equivalent flag is -Wl,-force_load,<library>; on Windows it's apparently /WHOLEARCHIVE.
Is there a portable way to do this in CMake?
I know I can add linker flags with target_link_libraries. I can detect the OS. However, since the macOS version of this includes the library name in the same string as the flag (no spaces), I think this messes with CMake's usual handling of link targets and so on. The more compatible I try to make this, the more I have to bend over backwards to make it happen.
And this is without even getting into more unusual compilers like Intel, PGI, Cray, IBM, etc. Those may not be compilers that people commonly deal with, but in some domains it's basically unavoidable to need to deal with these.
Are there any better options?
flink.cmake will help you.
target_force_link_libraries(<target>
<PRIVATE|PUBLIC|INTERFACE> <item>...
[<PRIVATE|PUBLIC|INTERFACE> <item>...]...
)

How to get cmake to find size of type in third-party header mpi.h?

I am working on a free-software project which involves high performance computing and the MPI library.
In my code, I need to know the size of the MPI_Offset type, which is defined in mpi.h.
Normally such projects would be build using autotools and this problem would be easily solved. But for my sins, I am working with a CMake build and I can't find any way to perform this simple task. But there must be a way to do - it is commonly done on autotools projects, so I assume it is also possible in CMake.
When I use:
check_type_size("MPI_Offset" SIZEOF_MPI_OFFSET)
It fails, because mpi.h is not included in the generated C code.
Is there a way to tell check_type_size() to include mpi.h?
This is done via CMAKE_EXTRA_INCLUDE_FILES:
INCLUDE (CheckTypeSize)
find_package(MPI)
include_directories(SYSTEM ${MPI_INCLUDE_PATH})
SET(CMAKE_EXTRA_INCLUDE_FILES "mpi.h")
check_type_size("MPI_Offset" SIZEOF_MPI_OFFSET)
SET(CMAKE_EXTRA_INCLUDE_FILES)
It may be more common to write platform checks with autotools, so here is some more information on how to write platform checks with CMake.
On a personal note, while CMake is certainly not the most pleasant exercise, for me autotools is reserved for the capital sins. It is really hard to me to defend CMake, but in this instance, it is even documented. Naturally, setting a separate "variable" that you even have to reset after the fact, instead of just passing it as a parameter, is clearly conforming to the surprising "design principles" of CMake.

Compile a compiler as an external project and use it?

I have to build a slightly patched version of GCC for a project and than compile the rest of the project with it. I am wondering what is the best way to do this. I am currently using ExternalProject_Add to build the compiler as a dependency for other binaries, but I don't know how to change the compiler for a part of the project.
Your best bet is probably to structure things as a superbuild. A top level project would have two subprojects built using ExternalProject_Add. The compiler would be the first subproject and the second would be your actual project which could then make use of the compiler by making your real subproject depend on the compiler subproject.
A second alternative is discussed here where your actual project remains as the top level project, but the compiler is built as a sub-build invoked via external_process(). I've used this approach for real world situations and while it does work, I'd personally still go with the superbuild approach if I had the choice since it's a bit cleaner and perhaps better understood by other developers.
Lastly, consider whether something like hunter might be able to take care of building your compiler for you. Depending on what/how you need to patch GCC, this may or may not be the most attractive approach.
I would use two CMake projects, one building your compiler, the other building your actual project with your built compiler. The CMake compiler is such an essential part of CMake, that changing is asking for trouble.
If you prefer having everything in one project, you can call your actual project with add_custom_command and call for a sub-folder. As a user this would be more surprising, but could lead to a better integration.

g++ does it make sense to add optimization flag when compiling static library

Or does it just make more sense to leave the optimization until you use the library, or is it when you link the library you are already past the point where the compiler can optimize the library?
Code optimization happens primarily at compile time. So if you want your static library optimized, you need to do that when you build your library.
There are some optimizations that can happen at link time (although I'm not sure if the GNU linker implements them). But they are additional optimizations, so even if you wanted to use them, you would still want to compile time optimization.
If you want the code in the library optimised, you have to provide the optimisation flags when you compile the library, not when you link with it.