Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor libprojectM in projectm-sys crate #13

Merged
merged 35 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
72c5a8b
Use git submodule reference to libprojectM
revmischa Mar 10, 2024
69700a8
v4.1.0
revmischa Mar 10, 2024
04341cb
bump
revmischa Mar 10, 2024
3359b15
bump
revmischa Mar 10, 2024
f90e3fb
oops
revmischa Mar 10, 2024
a36a964
oops
revmischa Mar 10, 2024
1820e46
projectm-4.1.2
revmischa Oct 23, 2024
470705c
projectm-4.1.2
revmischa Oct 23, 2024
4399b86
projectm-4.1.2
revmischa Oct 23, 2024
65be551
projectm-4.1.2
revmischa Oct 23, 2024
8805c9e
ignore
revmischa Oct 23, 2024
6c698d6
exclude
revmischa Oct 23, 2024
64f88f7
make package smaller
revmischa Oct 23, 2024
946b74f
version updates
revmischa Oct 23, 2024
a35b603
improve packaging of libprojectM source
revmischa Oct 31, 2024
807bb6d
improve packaging of libprojectM source
revmischa Oct 31, 2024
5d28d57
fix package include files list
revmischa Oct 31, 2024
414bf18
bump versions
revmischa Oct 31, 2024
fdcd0aa
update bindgen
revmischa Oct 31, 2024
4f69094
bump versions
revmischa Oct 31, 2024
bce7df3
build paths
revmischa Oct 31, 2024
ec5881e
rc
revmischa Oct 31, 2024
12579f6
bump versions
revmischa Oct 31, 2024
6c9480a
fmt
revmischa Oct 31, 2024
edea9fb
update submodules when cloning
revmischa Oct 31, 2024
fb8bc84
versions
revmischa Oct 31, 2024
9333b16
merge master
revmischa Oct 31, 2024
5a3c3e8
add vcpkg stuff back
revmischa Oct 31, 2024
d9230fe
restore platform-specific build steps
revmischa Oct 31, 2024
9bf061b
use static linking on windows/emscripten
revmischa Oct 31, 2024
17e567b
vcpkg root
revmischa Oct 31, 2024
8b506ac
bump versions
revmischa Oct 31, 2024
9b624cc
bump versions
revmischa Oct 31, 2024
ab92a6b
rustfmt
revmischa Oct 31, 2024
ca72a3c
bump versions
revmischa Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[submodule "projectm-sys/libprojectM"]
path = projectm-sys/libprojectM
url = https://github.com/projectM-visualizer/projectm.git
[submodule "libprojectM"]
branch = v4.1.0
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "projectm"
version = "2.0.1-alpha"
version = "4.1.0-alpha.1"
edition = "2021"
rust-version = "1.65"
authors = ["AnomieVision <anomievision@gmail.com.com>"]
authors = ["AnomieVision <anomievision@gmail.com.com>", "Mischa Spiegelmock <me@mish.dev>"]
description = "Bindings for ProjectM"
license = " LGPL-3.0-or-later"
repository = "https://github.com/projectM-visualizer/projectm-rs" #https://github.com/anomievision/projectm-rs
Expand All @@ -13,7 +13,7 @@ readme = "README.md"

[dependencies]
libc = "0.2.147"
projectm-sys = { path = "projectm-sys", version = "1.0.8", features = ["playlist"] }
projectm-sys = { path = "projectm-sys", version = "4.1.0-alpha.1", features = ["playlist"] }
rand = "0.8.5"

[features]
Expand Down
10 changes: 5 additions & 5 deletions projectm-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "projectm-sys"
version = "1.0.8"
version = "4.1.0-alpha.1"
edition = "2021"
rust-version = "1.65"
authors = ["AnomieVision <anomievision@gmail.com.com>"]
authors = ["AnomieVision <anomievision@gmail.com.com>", "Mischa Spiegelmock <me@mish.dev>"]
description = "Bindings for ProjectM"
license = "LGPL-3.0-or-later"
repository = "https://github.com/anomievision/projectm-sys"
repository = "https://github.com/projectM-visualizer/projectm-rs"
documentation = "https://docs.rs/projectm-sys/latest"
keywords = ["visualization", "audio", "sound", "projectm"]
categories = ["multimedia", "multimedia::video", "multimedia::audio"]
Expand All @@ -17,9 +17,9 @@ links = "projectm"

[build-dependencies]
cmake = "0.1.50"
bindgen = "0.66.1"
bindgen = "0.69.4"
lazy_static = "1.4.0"

[features]
default = ["playlist"]
playlist = []
playlist = []
57 changes: 35 additions & 22 deletions projectm-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
#[macro_use]
extern crate lazy_static;

use std::{env, path::Path, process::Command};
use lazy_static::lazy_static;
use std::env;
use std::path::PathBuf;
use std::process::{Command, Stdio};

mod build_bindgen;
use crate::build_bindgen::bindgen;

lazy_static! {
static ref PROJECTM_BUILD: String = format!("{}/projectm", env::var("OUT_DIR").unwrap());
fn update_submodules() -> Result<(), Box<dyn std::error::Error>> {
let status = Command::new("git")
.args(["submodule", "update", "--init", "--recursive"])
.stdout(Stdio::inherit()) // Optionally output stdout/stderr to help with debugging
.stderr(Stdio::inherit())
.status()?;

if !status.success() {
return Err(Box::new(std::io::Error::new(
std::io::ErrorKind::Other,
"Submodule update failed",
)));
}

Ok(())
}

fn main() {
if !Path::new(PROJECTM_BUILD.as_str()).exists() {
let _ = Command::new("git")
.args([
"-c",
"advice.detachedHead=false",
"clone",
"--recurse-submodules",
"--depth=1",
"--branch",
"v4.0.0",
"https://github.com/projectM-visualizer/projectm.git",
&PROJECTM_BUILD,
])
.status();
let projectm_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("libprojectM");

// Ensure the submodule is updated and initialized
if !projectm_path.exists() {
println!("cargo:warning=The libprojectM submodule is not checked out. Please run 'git submodule update --init --recursive' and try building again.");
std::process::exit(1);
}

// Attempt to update and initialize submodules recursively
if let Err(e) = update_submodules() {
println!("cargo:warning=Failed to update submodules: {}", e);
std::process::exit(1);
}

// Feature: enable-playlist
Expand All @@ -37,7 +50,7 @@ fn main() {
}

#[cfg(target_os = "windows")]
let dst = cmake::Config::new(PROJECTM_BUILD.as_str())
let dst = cmake::Config::new(&*projectm_path)
.generator("Visual Studio 17 2022")
.define(
"CMAKE_TOOLCHAIN_FILE",
Expand All @@ -55,17 +68,17 @@ fn main() {
.build();

#[cfg(target_os = "linux")]
let dst = cmake::Config::new(PROJECTM_BUILD.as_str())
let dst = cmake::Config::new(&*projectm_path)
.define("ENABLE_PLAYLIST", enable_playlist().as_str())
.build();

#[cfg(target_os = "macos")]
let dst = cmake::Config::new(PROJECTM_BUILD.as_str())
let dst = cmake::Config::new(&*projectm_path)
.define("ENABLE_PLAYLIST", enable_playlist().as_str())
.build();

#[cfg(target_os = "emscripten")]
let dst = cmake::Config::new(PROJECTM_BUILD.as_str())
let dst = cmake::Config::new(&*projectm_path)
.define("ENABLE_PLAYLIST", enable_playlist().as_str())
.define("ENABLE_EMSCRIPTEN", "ON")
.build();
Expand Down
1 change: 1 addition & 0 deletions projectm-sys/libprojectM
Submodule libprojectM added at 50c64d
Loading