← Back to team overview

kicad-developers team mailing list archive

Re: xpm todo item, libkicad?

 

Richard A Burton wrote:
2008/5/1 Dick Hollenbeck <dick@...>:

I doubt the linkers can choose individual bitmaps from the library this
way. I believe a typical linker can only pull in an entire *.o file
from the library, not a partial. So this is not what I had in mind.
What I had in mind was to put each bitmap into a library separately.
By separately, I mean as an individual *.o file tucked into the library,
one for each bitmap.


Gotcha. In theory that's easy enough, however I've hit a bug in cmake.
I've tested with a release candidate of cmake 2.6 and it works
properly there, but we should probably wait at least until it's out
before pre-reqing it. In case I'm busier at the time I'll get it out
on the mailing list...

bitmaps/CMakeLists.txt:
-------------------------------
add_definitions(-DXPMMAIN)
FILE(GLOB BITMAP_SRCS *.xpm)
SET_SOURCE_FILES_PROPERTIES(${BITMAP_SRCS} PROPERTIES LANGUAGE CXX
COMPILE_FLAGS "-x c++")
add_library(bitmaps ${BITMAP_SRCS})
SET_TARGET_PROPERTIES(bitmaps PROPERTIES LINKER_LANGUAGE CXX)
-------------------------------

Then add bitmaps.a to the appropriate targets.

The only dodgy bit is the "-x c++" which is needed so the compiler
needs to know what to do with .xpm files. There would need to be an
equivalent option for all the other compilers we want to support.

I'll tidy up the bitmaps in the mean time (one dir, all in the header,
no individual includes, etc.)



Cool, but if I understand you right, and you intend to defer putting separately compiled xpm files into the library, then won't the effect of the temporary solution be to link in *all* the bitmaps into all the apps that need any bitmap? Maybe this is not a tragedy, but it may be objectionable by some, even as a temporary phase.


Maybe there's an alternate way of coding the cmake commands so that we can use 2.4, current cmake, to move a solution where the bitmaps are put into a library individually and then linked in one by one as the linker encounters dependencies in the referencing C++ source.

Just a thought.

Dick







References