Merge pull request 'oodle: Fix linking statically' (#121) from issue/static-linking into master
Reviewed-on: #121
This commit is contained in:
commit
b7b76412a3
15 changed files with 340 additions and 398 deletions
|
@ -8,7 +8,7 @@ RUN set -e; \
|
||||||
cargo new --lib lib/nexusmods; \
|
cargo new --lib lib/nexusmods; \
|
||||||
cargo new --lib lib/sdk; \
|
cargo new --lib lib/sdk; \
|
||||||
cargo new --lib lib/serde_sjson; \
|
cargo new --lib lib/serde_sjson; \
|
||||||
cargo new --lib lib/steamlocate-rs
|
cargo new --lib lib/ansi-parser
|
||||||
|
|
||||||
COPY Cargo.toml Cargo.lock /src/dtmt/
|
COPY Cargo.toml Cargo.lock /src/dtmt/
|
||||||
COPY crates/dtmt/Cargo.toml /src/dtmt/crates/dtmt/
|
COPY crates/dtmt/Cargo.toml /src/dtmt/crates/dtmt/
|
||||||
|
@ -17,7 +17,7 @@ COPY lib/dtmt-shared/Cargo.toml /src/dtmt/lib/dtmt-shared/
|
||||||
COPY lib/nexusmods/Cargo.toml /src/dtmt/lib/nexusmods/
|
COPY lib/nexusmods/Cargo.toml /src/dtmt/lib/nexusmods/
|
||||||
COPY lib/sdk/Cargo.toml /src/dtmt/lib/sdk/
|
COPY lib/sdk/Cargo.toml /src/dtmt/lib/sdk/
|
||||||
COPY lib/serde_sjson/Cargo.toml /src/dtmt/lib/serde_sjson/
|
COPY lib/serde_sjson/Cargo.toml /src/dtmt/lib/serde_sjson/
|
||||||
COPY lib/steamlocate-rs/Cargo.toml /src/dtmt/lib/steamlocate-rs/
|
COPY lib/ansi-parser/Cargo.toml /src/dtmt/lib/ansi-parser/
|
||||||
|
|
||||||
# Crates with build scripts cannot be split that way, but they shouldn't change too often
|
# Crates with build scripts cannot be split that way, but they shouldn't change too often
|
||||||
COPY lib/luajit2-sys /src/dtmt/lib/luajit2-sys
|
COPY lib/luajit2-sys /src/dtmt/lib/luajit2-sys
|
||||||
|
@ -30,6 +30,6 @@ RUN cargo build --release --locked
|
||||||
RUN rm -r crates lib
|
RUN rm -r crates lib
|
||||||
|
|
||||||
COPY . /src/dtmt
|
COPY . /src/dtmt
|
||||||
COPY --from=dtmt-ci-base-linux /src/*.lib /src/dtmt/lib/oodle/
|
COPY --from=dtmt-ci-base-linux /src/*.lib /src/*.so /src/dtmt/lib/oodle/
|
||||||
|
|
||||||
RUN cargo build --release --locked
|
RUN cargo build --release --locked
|
||||||
|
|
|
@ -8,7 +8,7 @@ RUN set -e; \
|
||||||
cargo new --lib lib/nexusmods; \
|
cargo new --lib lib/nexusmods; \
|
||||||
cargo new --lib lib/sdk; \
|
cargo new --lib lib/sdk; \
|
||||||
cargo new --lib lib/serde_sjson; \
|
cargo new --lib lib/serde_sjson; \
|
||||||
cargo new --lib lib/steamlocate-rs
|
cargo new --lib lib/ansi-parser
|
||||||
|
|
||||||
COPY Cargo.toml Cargo.lock /src/dtmt/
|
COPY Cargo.toml Cargo.lock /src/dtmt/
|
||||||
COPY crates/dtmt/Cargo.toml /src/dtmt/crates/dtmt/
|
COPY crates/dtmt/Cargo.toml /src/dtmt/crates/dtmt/
|
||||||
|
@ -17,7 +17,7 @@ COPY lib/dtmt-shared/Cargo.toml /src/dtmt/lib/dtmt-shared/
|
||||||
COPY lib/nexusmods/Cargo.toml /src/dtmt/lib/nexusmods/
|
COPY lib/nexusmods/Cargo.toml /src/dtmt/lib/nexusmods/
|
||||||
COPY lib/sdk/Cargo.toml /src/dtmt/lib/sdk/
|
COPY lib/sdk/Cargo.toml /src/dtmt/lib/sdk/
|
||||||
COPY lib/serde_sjson/Cargo.toml /src/dtmt/lib/serde_sjson/
|
COPY lib/serde_sjson/Cargo.toml /src/dtmt/lib/serde_sjson/
|
||||||
COPY lib/steamlocate-rs/Cargo.toml /src/dtmt/lib/steamlocate-rs/
|
COPY lib/ansi-parser/Cargo.toml /src/dtmt/lib/ansi-parser/
|
||||||
|
|
||||||
# Crates with build scripts cannot be split that way, but they shouldn't change too often
|
# Crates with build scripts cannot be split that way, but they shouldn't change too often
|
||||||
COPY lib/luajit2-sys /src/dtmt/lib/luajit2-sys
|
COPY lib/luajit2-sys /src/dtmt/lib/luajit2-sys
|
||||||
|
|
|
@ -21,4 +21,4 @@ RUN set -eux; \
|
||||||
|
|
||||||
WORKDIR /src/dtmt
|
WORKDIR /src/dtmt
|
||||||
|
|
||||||
COPY liboo2corelinux64.so /src
|
COPY *.so *.a /src/
|
||||||
|
|
|
@ -86,4 +86,4 @@ RUN wine wineboot --init
|
||||||
|
|
||||||
WORKDIR /src/dtmt
|
WORKDIR /src/dtmt
|
||||||
|
|
||||||
COPY oo2core_win32.lib oo2core_win64.lib /src
|
COPY *.lib /src
|
||||||
|
|
|
@ -13,7 +13,7 @@ case "$TARGET" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
linux)
|
linux)
|
||||||
cp /src/*.so ./lib/oodle/
|
cp /src/*.a ./lib/oodle/
|
||||||
cargo build --color always --locked --profile release-lto
|
cargo build --color always --locked --profile release-lto
|
||||||
|
|
||||||
if [ -d "$OUTPUT" ]; then
|
if [ -d "$OUTPUT" ]; then
|
||||||
|
|
|
@ -47,4 +47,5 @@ if sh "$script"; then
|
||||||
notify 'success' "$context" "$desc"
|
notify 'success' "$context" "$desc"
|
||||||
else
|
else
|
||||||
notify 'failure' "$context" "$desc"
|
notify 'failure' "$context" "$desc"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
7
.gitmodules
vendored
7
.gitmodules
vendored
|
@ -1,12 +1,13 @@
|
||||||
[submodule "lib/serde_sjson"]
|
[submodule "lib/serde_sjson"]
|
||||||
path = lib/serde_sjson
|
path = lib/serde_sjson
|
||||||
url = https://git.sclu1034.dev/lucas/serde_sjson.git
|
url = https://git.sclu1034.dev/lucas/serde_sjson.git
|
||||||
[submodule "lib/steamlocate-rs"]
|
|
||||||
path = lib/steamlocate-rs
|
|
||||||
url = https://github.com/sclu1034/steamlocate-rs.git
|
|
||||||
[submodule "lib/luajit2-sys"]
|
[submodule "lib/luajit2-sys"]
|
||||||
path = lib/luajit2-sys
|
path = lib/luajit2-sys
|
||||||
url = https://github.com/sclu1034/luajit2-sys.git
|
url = https://github.com/sclu1034/luajit2-sys.git
|
||||||
[submodule "lib/color-eyre"]
|
[submodule "lib/color-eyre"]
|
||||||
path = lib/color-eyre
|
path = lib/color-eyre
|
||||||
url = https://github.com/sclu1034/color-eyre.git
|
url = https://github.com/sclu1034/color-eyre.git
|
||||||
|
[submodule "lib/ansi-parser"]
|
||||||
|
path = lib/ansi-parser
|
||||||
|
url = https://gitlab.com/lschwiderski/ansi-parser.git
|
||||||
|
branch = "issue/outdated-nom"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
- all: force unix path separators for engine values
|
- all: force unix path separators for engine values
|
||||||
- dtmt: fix extracing files with non-flattened file names
|
- dtmt: fix extracing files with non-flattened file names
|
||||||
|
- oodle: fix static linking
|
||||||
|
|
||||||
== 2023-03-01
|
== 2023-03-01
|
||||||
|
|
||||||
|
|
666
Cargo.lock
generated
666
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -7,11 +7,15 @@ members = [
|
||||||
"lib/oodle",
|
"lib/oodle",
|
||||||
"lib/sdk",
|
"lib/sdk",
|
||||||
"lib/serde_sjson",
|
"lib/serde_sjson",
|
||||||
"lib/steamlocate-rs",
|
]
|
||||||
|
exclude = [
|
||||||
|
"lib/color-eyre",
|
||||||
|
"lib/ansi-parser",
|
||||||
]
|
]
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
color-eyre = { path = "lib/color-eyre" }
|
color-eyre = { path = "lib/color-eyre" }
|
||||||
|
ansi-parser = { path = "lib/ansi-parser" }
|
||||||
|
|
||||||
[profile.dev.package.backtrace]
|
[profile.dev.package.backtrace]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
|
1
lib/ansi-parser
Submodule
1
lib/ansi-parser
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 27beb4bc1ffd2865a432e13f0588b5351ff419bf
|
|
@ -9,7 +9,7 @@ edition = "2021"
|
||||||
ansi_term = "0.12.1"
|
ansi_term = "0.12.1"
|
||||||
color-eyre = "0.6.2"
|
color-eyre = "0.6.2"
|
||||||
serde = "1.0.152"
|
serde = "1.0.152"
|
||||||
steamlocate = { path = "../../lib/steamlocate-rs", version = "*" }
|
steamlocate = "2.0.0-alpha.0"
|
||||||
time = { version = "0.3.19", features = ["formatting", "local-offset", "macros"] }
|
time = { version = "0.3.19", features = ["formatting", "local-offset", "macros"] }
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
tracing-error = "0.2.0"
|
tracing-error = "0.2.0"
|
||||||
|
|
|
@ -71,20 +71,15 @@ pub fn collect_game_info() -> Option<GameInfo> {
|
||||||
|
|
||||||
let found = dir
|
let found = dir
|
||||||
.app(&STEAMAPP_ID)
|
.app(&STEAMAPP_ID)
|
||||||
.and_then(|app| app.vdf.get("LastUpdated").map(|v| (app.path.clone(), v)));
|
.and_then(|app| app.last_updated.map(|v| (app.path.clone(), v)));
|
||||||
|
|
||||||
let Some((path, last_updated)) = found else {
|
let Some((path, last_updated)) = found else {
|
||||||
tracing::debug!("Found Steam, but failed to find game installation");
|
tracing::debug!("Found Steam, but failed to find game installation");
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(last_updated) = last_updated
|
Some(GameInfo {
|
||||||
.as_value()
|
path,
|
||||||
.and_then(|v| v.to::<i64>())
|
last_updated: last_updated.into(),
|
||||||
.and_then(|v| OffsetDateTime::from_unix_timestamp(v).ok()) else {
|
})
|
||||||
tracing::error!("Found Steam game, but couldn't read 'LastUpdate'.");
|
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
Some(GameInfo { path, last_updated })
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,24 +4,20 @@ use std::env;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Tell cargo to look for shared libraries in the specified directory
|
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("No CARGO_MANIFEST_DIR");
|
||||||
if let Ok(manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") {
|
println!("cargo:rustc-link-search=native={}", &manifest_dir);
|
||||||
println!("cargo:rustc-link-search={}", manifest_dir);
|
|
||||||
dbg!(&manifest_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
let lib_name = if std::env::var("CARGO_CFG_WINDOWS").is_ok() {
|
if std::env::var("CARGO_CFG_TARGET_FAMILY") == Ok(String::from("windows")) {
|
||||||
if cfg!(debug_assertions) {
|
let lib_name = if cfg!(debug_assertions) {
|
||||||
"oo2core_win64_debug"
|
"oo2core_win64_debug"
|
||||||
} else {
|
} else {
|
||||||
"oo2core_win64"
|
"oo2core_win64"
|
||||||
}
|
};
|
||||||
|
println!("cargo:rustc-link-lib=static={}", lib_name);
|
||||||
} else {
|
} else {
|
||||||
"oo2corelinux64"
|
println!("cargo:rustc-link-lib=static=oo2corelinux64");
|
||||||
};
|
println!("cargo:rustc-link-lib=stdc++");
|
||||||
|
}
|
||||||
println!("cargo:rustc-link-lib={}", lib_name);
|
|
||||||
dbg!(&lib_name);
|
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=oodle2.h");
|
println!("cargo:rerun-if-changed=oodle2.h");
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 4d6898f632e20ea15d47b0b071daa4f3fa6c9574
|
|
Loading…
Add table
Reference in a new issue