File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,12 @@ fn main() {
8484 {
8585 builder = builder. clang_arg ( "-DENABLE_HARDSUBX" ) ;
8686
87- // Add FFmpeg include paths for Mac
87+ // Check FFMPEG_INCLUDE_DIR environment variable (works on all platforms)
88+ if let Ok ( ffmpeg_include) = env:: var ( "FFMPEG_INCLUDE_DIR" ) {
89+ builder = builder. clang_arg ( format ! ( "-I{}" , ffmpeg_include) ) ;
90+ }
91+
92+ // Add FFmpeg include paths for Mac (Homebrew)
8893 if cfg ! ( target_os = "macos" ) {
8994 // Try common Homebrew paths
9095 if std:: path:: Path :: new ( "/opt/homebrew/include" ) . exists ( ) {
@@ -110,10 +115,14 @@ fn main() {
110115 }
111116 }
112117 }
118+ }
113119
114- // Also check environment variable
115- if let Ok ( ffmpeg_include) = env:: var ( "FFMPEG_INCLUDE_DIR" ) {
116- builder = builder. clang_arg ( format ! ( "-I{}" , ffmpeg_include) ) ;
120+ // On Linux, try pkg-config to find FFmpeg include paths
121+ if cfg ! ( target_os = "linux" ) {
122+ if let Ok ( lib) = pkg_config:: Config :: new ( ) . probe ( "libavcodec" ) {
123+ for path in lib. include_paths {
124+ builder = builder. clang_arg ( format ! ( "-I{}" , path. display( ) ) ) ;
125+ }
117126 }
118127 }
119128 }
You can’t perform that action at this time.
0 commit comments