Skip to content

Commit 0b069a3

Browse files
committed
Platform link flags
1 parent 43de579 commit 0b069a3

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ readme = "README.md"
1313

1414
[dependencies]
1515
libc = "0.2"
16-
#projectm-sys = { path = "projectm-sys", version = "1.0.9-rc.1", features = ["playlist"] }
16+
#projectm-sys = { path = "projectm-sys", version = "1", features = ["playlist", "static"] }
1717
projectm-sys = { version = "1.2.1" }
1818
rand = "0.8"
1919

projectm-sys/.cargo/config.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
[target.wasm32-unknown-emscripten]
2-
linker = ".cargo/linker-emscripten"
3-
4-
[target.x86_64-unknown-linux-gnu]
5-
rustflags = "-C link-arg=-lGL -C link-arg=-lstdc++ -C link-arg=-lgomp"
2+
linker = ".cargo/linker-emscripten"

projectm-sys/build.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,29 @@ fn main() {
182182
}
183183
}
184184

185+
// Platform-specific link flags for C++ and OpenGL
186+
#[cfg(target_os = "macos")]
187+
{
188+
println!("cargo:rustc-link-lib=c++");
189+
println!("cargo:rustc-link-lib=framework=OpenGL");
190+
}
191+
#[cfg(target_os = "linux")]
192+
{
193+
// On Linux, link stdc++ and GL.
194+
println!("cargo:rustc-link-lib=stdc++");
195+
println!("cargo:rustc-link-lib=GL");
196+
println!("cargo:rustc-link-lib=gomp");
197+
}
198+
#[cfg(target_os = "windows")]
199+
{
200+
println!("cargo:rustc-link-lib=opengl32");
201+
}
202+
#[cfg(target_os = "emscripten")]
203+
{
204+
// Emscripten typically handles GL calls differently, so you might skip or rely on the
205+
// emscripten compiler for linking.
206+
}
207+
185208
// Generate Rust bindings using bindgen
186209
bindgen();
187210
}

0 commit comments

Comments
 (0)