2
0
Эх сурвалжийг харах

Get p3pnmimagetypes to build (and link to p3framework) under CMake.

Sam Edwards 12 жил өмнө
parent
commit
f1e218d267

+ 1 - 1
panda/src/framework/CMakeLists.txt

@@ -11,7 +11,7 @@ set(P3FRAMEWORK_SOURCES
 )
 
 
-set(P3FRAMEWORK_LINK_TARGETS p3char p3pgui p3recorder p3collide) #p3recorder p3collide p3pnmimagetypes
+set(P3FRAMEWORK_LINK_TARGETS p3char p3pgui p3recorder p3collide p3pnmimagetypes)
 if(LINK_ALL_STATIC)
   # If we're statically linking, we need to explicitly link with
   # at least one of the available renderers.

+ 23 - 1
panda/src/pnmimagetypes/CMakeLists.txt

@@ -26,7 +26,29 @@ set(P3PNMIMAGETYPES_SOURCES
   pnmFileTypeTGA.cxx
 )
 
+# We aggregate the PNMIMAGETYPES libraries depending on which image formats are
+# compiled in.
+unset(PNMIMAGETYPES_LINK_LIBRARIES)
+
+if(HAVE_JPEG)
+  set(PNMIMAGETYPES_LINK_LIBRARIES
+    ${PNMIMAGETYPES_LINK_LIBRARIES}
+    ${JPEG_LIBRARIES})
+endif()
+
+if(HAVE_TIFF)
+  set(PNMIMAGETYPES_LINK_LIBRARIES
+    ${PNMIMAGETYPES_LINK_LIBRARIES}
+    ${TIFF_LIBRARIES})
+endif()
+
+if(HAVE_PNG)
+  set(PNMIMAGETYPES_LINK_LIBRARIES
+    ${PNMIMAGETYPES_LINK_LIBRARIES}
+    ${PNG_LIBRARIES})
+endif()
+
 composite_sources(p3pnmimagetypes P3PNMIMAGETYPES_SOURCES)
 add_library(p3pnmimagetypes ${P3PNMIMAGETYPES_HEADERS} ${P3PNMIMAGETYPES_SOURCES})
-target_link_libraries(p3pnmimagetypes p3pnmimage)
+target_link_libraries(p3pnmimagetypes p3pnmimage ${PNMIMAGETYPES_LINK_LIBRARIES})
 target_interrogate(p3pnmimagetypes ALL)