Workaround cmake's random library order in external_ffmpeg
This commit is contained in:
		
							parent
							
								
									b8b517a5e0
								
							
						
					
					
						commit
						2e1d9c80d9
					
				
					 1 changed files with 55 additions and 36 deletions
				
			
		
							
								
								
									
										65
									
								
								external/ffmpeg/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										65
									
								
								external/ffmpeg/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							|  | @ -24,17 +24,21 @@ if (DESKTOP_APP_USE_PACKAGED) | ||||||
|         PkgConfig::SWSCALE |         PkgConfig::SWSCALE | ||||||
|         PkgConfig::SWRESAMPLE |         PkgConfig::SWRESAMPLE | ||||||
|     ) |     ) | ||||||
| else() | 
 | ||||||
|     if (LINUX) |     return() | ||||||
|         target_link_static_libraries(external_ffmpeg | endif() | ||||||
|         INTERFACE | 
 | ||||||
|             avformat | set(ffmpeg_lib_list) | ||||||
|             avcodec | 
 | ||||||
|             swresample | if (LINUX) | ||||||
|             swscale |     list(APPEND ffmpeg_lib_list | ||||||
|             avutil |         -lavformat | ||||||
|  |         -lavcodec | ||||||
|  |         -lswresample | ||||||
|  |         -lswscale | ||||||
|  |         -lavutil | ||||||
|     ) |     ) | ||||||
|     else() | else() | ||||||
|     set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) |     set(ffmpeg_lib_loc ${libs_loc}/ffmpeg) | ||||||
| 
 | 
 | ||||||
|     target_include_directories(external_ffmpeg SYSTEM |     target_include_directories(external_ffmpeg SYSTEM | ||||||
|  | @ -42,27 +46,42 @@ else() | ||||||
|         ${ffmpeg_lib_loc} |         ${ffmpeg_lib_loc} | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|         target_link_libraries(external_ffmpeg |     list(APPEND ffmpeg_lib_list | ||||||
|         INTERFACE |  | ||||||
|         ${ffmpeg_lib_loc}/libavformat/libavformat.a |         ${ffmpeg_lib_loc}/libavformat/libavformat.a | ||||||
|         ${ffmpeg_lib_loc}/libavcodec/libavcodec.a |         ${ffmpeg_lib_loc}/libavcodec/libavcodec.a | ||||||
|         ${ffmpeg_lib_loc}/libswresample/libswresample.a |         ${ffmpeg_lib_loc}/libswresample/libswresample.a | ||||||
|         ${ffmpeg_lib_loc}/libswscale/libswscale.a |         ${ffmpeg_lib_loc}/libswscale/libswscale.a | ||||||
|         ${ffmpeg_lib_loc}/libavutil/libavutil.a |         ${ffmpeg_lib_loc}/libavutil/libavutil.a | ||||||
|     ) |     ) | ||||||
|     endif() | endif() | ||||||
| 
 | 
 | ||||||
|  | list(APPEND ffmpeg_lib_list | ||||||
|  |     $<TARGET_FILE:desktop-app::external_opus> | ||||||
|  |     $<TARGET_FILE:desktop-app::external_vpx> | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | if (APPLE) | ||||||
|  |     list(APPEND ffmpeg_lib_list bz2) | ||||||
|  | elseif (LINUX) | ||||||
|  |     list(APPEND ffmpeg_lib_list -llzma) | ||||||
|  | endif() | ||||||
|  | 
 | ||||||
|  | # Workaround cmake's random order on Linux... | ||||||
|  | if (LINUX) | ||||||
|  |     list(JOIN ffmpeg_lib_list , ffmpeg_lib_link) | ||||||
|     target_link_libraries(external_ffmpeg |     target_link_libraries(external_ffmpeg | ||||||
|     INTERFACE |     INTERFACE | ||||||
|         $<LINK_ONLY:desktop-app::external_opus> |         -Wl,--push-state,-Bstatic,${ffmpeg_lib_link},--pop-state | ||||||
|         $<TARGET_FILE:desktop-app::external_opus> |     ) | ||||||
|         $<LINK_ONLY:desktop-app::external_vpx> | else() | ||||||
|         $<TARGET_FILE:desktop-app::external_vpx> |     target_link_libraries(external_ffmpeg | ||||||
|  |     INTERFACE | ||||||
|  |         ${ffmpeg_lib_list} | ||||||
|     ) |     ) | ||||||
| 
 |  | ||||||
|     if (APPLE) |  | ||||||
|         target_link_libraries(external_ffmpeg INTERFACE bz2) |  | ||||||
|     elseif (LINUX) |  | ||||||
|         target_link_static_libraries(external_ffmpeg INTERFACE lzma) |  | ||||||
|     endif() |  | ||||||
| endif() | endif() | ||||||
|  | 
 | ||||||
|  | target_link_libraries(external_ffmpeg | ||||||
|  | INTERFACE | ||||||
|  |     $<LINK_ONLY:desktop-app::external_opus> | ||||||
|  |     $<LINK_ONLY:desktop-app::external_vpx> | ||||||
|  | ) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Ilya Fedin
						Ilya Fedin