aboutsummaryrefslogtreecommitdiff
path: root/ports/libyuv/fix-build-type.patch
blob: 179a7f7ea0b174707049f464e9f617c580cfce58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50442cd..fdc82f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,24 +28,32 @@ LIST ( SORT			ly_unittest_sources )
 INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
 
 # this creates the static library (.a)
+if (NOT BUILD_SHARED_LIBS)
 ADD_LIBRARY				( ${ly_lib_static} STATIC ${ly_source_files} )
 SET_TARGET_PROPERTIES( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
-
+else()
 # this creates the shared library (.so)
 ADD_LIBRARY				( ${ly_lib_shared} SHARED ${ly_source_files} )
 SET_TARGET_PROPERTIES	( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
 SET_TARGET_PROPERTIES	( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
-
+endif()
 # this creates the conversion tool
 ADD_EXECUTABLE			( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
-TARGET_LINK_LIBRARIES	( yuvconvert ${ly_lib_static} )
-
+if (BUILD_SHARED_LIBS)
+    TARGET_LINK_LIBRARIES   ( yuvconvert ${ly_lib_shared} )
+else()
+    TARGET_LINK_LIBRARIES   ( yuvconvert ${ly_lib_static} )
+endif()
 
 INCLUDE ( FindJPEG )
 if (JPEG_FOUND)
-  include_directories( ${JPEG_INCLUDE_DIR} )
-  target_link_libraries( ${ly_lib_shared} PUBLIC ${JPEG_LIBRARY} )
-  target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
+  include_directories( ${JPEG_INCLUDE_DIR})
+  if( BUILD_SHARED_LIBS)
+    target_link_libraries(${ly_lib_shared} PUBLIC ${JPEG_LIBRARY})
+  else()
+    target_link_libraries(${ly_lib_static} PUBLIC ${JPEG_LIBRARY})
+  endif()
+  target_link_libraries(yuvconvert ${JPEG_LIBRARY})
   add_definitions( -DHAVE_JPEG )
 endif()
 
@@ -88,11 +96,13 @@ endif()
 
 
 # install the conversion tool, .so, .a, and all the header files
-INSTALL ( TARGETS yuvconvert DESTINATION bin )
+INSTALL ( TARGETS yuvconvert DESTINATION tools )
 INSTALL ( FILES ${ly_include_files} DESTINATION include/libyuv )
-INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
-INSTALL ( TARGETS ${ly_lib_shared} EXPORT libyuv-targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
-
+if (NOT BUILD_SHARED_LIBS)
+    INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
+else()
+    INSTALL ( TARGETS ${ly_lib_shared} EXPORT libyuv-targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
+endif()
 INSTALL( EXPORT libyuv-targets DESTINATION share/cmake/libyuv/ EXPORT_LINK_INTERFACE_LIBRARIES )
 
 # create the .deb and .rpm packages using cpack