Skip to content

Commit 2cd62f1

Browse files
committed
Use FEATURE_TG define
1 parent 6778284 commit 2cd62f1

File tree

5 files changed

+36
-45
lines changed

5 files changed

+36
-45
lines changed

rlottie-sys/build.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,13 @@ fn main() {
55
.probe("rlottie")
66
.expect("Unable to find rlottie");
77

8-
let header = if cfg!(feature = "tg") {
9-
println!("cargo:rerun-if-changed=wrapper_tg.hpp");
10-
println!("cargo:rerun-if-changed=wrapper_tg.cpp");
11-
"wrapper_tg.hpp"
12-
} else {
13-
println!("cargo:rerun-if-changed=wrapper.h");
14-
"wrapper.h"
15-
};
8+
println!("cargo:rerun-if-changed=wrapper.hpp");
9+
println!("cargo:rerun-if-changed=wrapper.cpp");
1610

1711
let bindings = bindgen::Builder::default()
1812
.rustfmt_bindings(false)
19-
.header(header)
20-
.clang_arg("-I.")
21-
.clang_arg("-std=c++17")
22-
.clang_arg("-x")
23-
.clang_arg("c++")
13+
.header("wrapper.hpp")
14+
.clang_arg("-DFEATURE_TG")
2415
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
2516
.newtype_enum(".*")
2617
.size_t_is_usize(true)
@@ -35,6 +26,7 @@ fn main() {
3526

3627
cc::Build::new()
3728
.cpp(true)
38-
.file("wrapper_tg.cpp")
29+
.define("FEATURE_TG", None)
30+
.file("wrapper.cpp")
3931
.compile("lib_my_lib.a");
4032
}

rlottie-sys/wrapper_tg.cpp renamed to rlottie-sys/wrapper.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#include "wrapper_tg.hpp"
1+
#include "wrapper.hpp"
2+
3+
#ifdef FEATURE_TG
24

35
#include "rlottie.h"
46

57
using rlottie::Animation;
68
using rlottie::Surface;
7-
// using rlottie::Lottie_Animation_S;
8-
// using rlottie::FitzModifier;
99

1010
struct Lottie_Animation_S {
1111
std::unique_ptr<Animation> mAnimation;
@@ -21,4 +21,6 @@ LOT_EXPORT Lottie_Animation* lottie_animation_from_data_tg(const char* data, con
2121
} else {
2222
return nullptr;
2323
}
24-
}
24+
}
25+
26+
#endif

rlottie-sys/wrapper.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

rlottie-sys/wrapper.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <rlottie_capi.h>
2+
3+
#ifdef FEATURE_TG
4+
5+
#ifdef __cplusplus
6+
extern "C" {
7+
#endif
8+
9+
enum class FitzModifier {
10+
None,
11+
Type12,
12+
Type3,
13+
Type4,
14+
Type5,
15+
Type6
16+
};
17+
18+
LOT_EXPORT Lottie_Animation* lottie_animation_from_data_tg(const char* data, const char* key, const char* resource_path, FitzModifier fitz_modifier);
19+
20+
#ifdef __cplusplus
21+
}
22+
#endif
23+
24+
#endif

rlottie-sys/wrapper_tg.hpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)