1pub use cc;
5
6use std::{env, path::PathBuf};
7
8pub fn version() -> String {
9 "1.6.0-641".to_owned()
10}
11
12pub fn includes() -> Vec<PathBuf> {
13 let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
14 vec![
15 root.join("Bento4/Source/C++/Core"),
16 root.join("Bento4/Source/C++/Codecs"),
17 root.join("Bento4/Source/C++/Crypto"),
18 root.join("Bento4/Source/C++/MetaData"),
19 ]
20}
21
22pub fn build() {
23 let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
24 println!(
25 "cargo:rerun-if-changed={}",
26 root.join("Bento4").to_string_lossy()
27 );
28
29 cc::Build::new()
30 .cpp(true)
31 .warnings(false)
32 .extra_warnings(false)
33 .includes(includes())
34 .files([
35 root.join("Bento4/Source/C++/Codecs/Ap4Ac3Parser.cpp"),
36 root.join("Bento4/Source/C++/Codecs/Ap4Ac4Parser.cpp"),
37 root.join("Bento4/Source/C++/Codecs/Ap4AdtsParser.cpp"),
38 root.join("Bento4/Source/C++/Codecs/Ap4AvcParser.cpp"),
39 root.join("Bento4/Source/C++/Codecs/Ap4BitStream.cpp"),
40 root.join("Bento4/Source/C++/Codecs/Ap4Eac3Parser.cpp"),
41 root.join("Bento4/Source/C++/Codecs/Ap4HevcParser.cpp"),
42 root.join("Bento4/Source/C++/Codecs/Ap4Mp4AudioInfo.cpp"),
43 root.join("Bento4/Source/C++/Codecs/Ap4NalParser.cpp"),
44 ])
45 .files([
46 root.join("Bento4/Source/C++/Core/Ap4.cpp"),
47 root.join("Bento4/Source/C++/Core/Ap48bdlAtom.cpp"),
48 root.join("Bento4/Source/C++/Core/Ap4Ac4Utils.cpp"),
49 root.join("Bento4/Source/C++/Core/Ap4AinfAtom.cpp"),
50 root.join("Bento4/Source/C++/Core/Ap4Atom.cpp"),
51 root.join("Bento4/Source/C++/Core/Ap4AtomFactory.cpp"),
52 root.join("Bento4/Source/C++/Core/Ap4AtomSampleTable.cpp"),
53 root.join("Bento4/Source/C++/Core/Ap4Av1cAtom.cpp"),
54 root.join("Bento4/Source/C++/Core/Ap4AvccAtom.cpp"),
55 root.join("Bento4/Source/C++/Core/Ap4BlocAtom.cpp"),
56 root.join("Bento4/Source/C++/Core/Ap4ByteStream.cpp"),
57 root.join("Bento4/Source/C++/Core/Ap4Co64Atom.cpp"),
58 root.join("Bento4/Source/C++/Core/Ap4Command.cpp"),
59 root.join("Bento4/Source/C++/Core/Ap4CommandFactory.cpp"),
60 root.join("Bento4/Source/C++/Core/Ap4CommonEncryption.cpp"),
61 root.join("Bento4/Source/C++/Core/Ap4ContainerAtom.cpp"),
62 root.join("Bento4/Source/C++/Core/Ap4CttsAtom.cpp"),
63 root.join("Bento4/Source/C++/Core/Ap4Dac3Atom.cpp"),
64 root.join("Bento4/Source/C++/Core/Ap4Dac4Atom.cpp"),
65 root.join("Bento4/Source/C++/Core/Ap4DataBuffer.cpp"),
66 root.join("Bento4/Source/C++/Core/Ap4Debug.cpp"),
67 root.join("Bento4/Source/C++/Core/Ap4Dec3Atom.cpp"),
68 root.join("Bento4/Source/C++/Core/Ap4DecoderConfigDescriptor.cpp"),
69 root.join("Bento4/Source/C++/Core/Ap4DecoderSpecificInfoDescriptor.cpp"),
70 root.join("Bento4/Source/C++/Core/Ap4Descriptor.cpp"),
71 root.join("Bento4/Source/C++/Core/Ap4DescriptorFactory.cpp"),
72 root.join("Bento4/Source/C++/Core/Ap4DrefAtom.cpp"),
73 root.join("Bento4/Source/C++/Core/Ap4DvccAtom.cpp"),
74 root.join("Bento4/Source/C++/Core/Ap4ElstAtom.cpp"),
75 root.join("Bento4/Source/C++/Core/Ap4EsDescriptor.cpp"),
76 root.join("Bento4/Source/C++/Core/Ap4EsdsAtom.cpp"),
77 root.join("Bento4/Source/C++/Core/Ap4Expandable.cpp"),
78 root.join("Bento4/Source/C++/Core/Ap4File.cpp"),
79 root.join("Bento4/Source/C++/Core/Ap4FileCopier.cpp"),
80 root.join("Bento4/Source/C++/Core/Ap4FileWriter.cpp"),
81 root.join("Bento4/Source/C++/Core/Ap4FragmentSampleTable.cpp"),
82 root.join("Bento4/Source/C++/Core/Ap4FrmaAtom.cpp"),
83 root.join("Bento4/Source/C++/Core/Ap4FtypAtom.cpp"),
84 root.join("Bento4/Source/C++/Core/Ap4GrpiAtom.cpp"),
85 root.join("Bento4/Source/C++/Core/Ap4HdlrAtom.cpp"),
86 root.join("Bento4/Source/C++/Core/Ap4HintTrackReader.cpp"),
87 root.join("Bento4/Source/C++/Core/Ap4HmhdAtom.cpp"),
88 root.join("Bento4/Source/C++/Core/Ap4HvccAtom.cpp"),
89 root.join("Bento4/Source/C++/Core/Ap4IkmsAtom.cpp"),
90 root.join("Bento4/Source/C++/Core/Ap4IodsAtom.cpp"),
91 root.join("Bento4/Source/C++/Core/Ap4Ipmp.cpp"),
92 root.join("Bento4/Source/C++/Core/Ap4IproAtom.cpp"),
93 root.join("Bento4/Source/C++/Core/Ap4IsfmAtom.cpp"),
94 root.join("Bento4/Source/C++/Core/Ap4IsltAtom.cpp"),
95 root.join("Bento4/Source/C++/Core/Ap4IsmaCryp.cpp"),
96 root.join("Bento4/Source/C++/Core/Ap4LinearReader.cpp"),
97 root.join("Bento4/Source/C++/Core/Ap4Marlin.cpp"),
98 root.join("Bento4/Source/C++/Core/Ap4MdhdAtom.cpp"),
99 root.join("Bento4/Source/C++/Core/Ap4MehdAtom.cpp"),
100 root.join("Bento4/Source/C++/Core/Ap4MfhdAtom.cpp"),
101 root.join("Bento4/Source/C++/Core/Ap4MfroAtom.cpp"),
102 root.join("Bento4/Source/C++/Core/Ap4MoovAtom.cpp"),
103 root.join("Bento4/Source/C++/Core/Ap4Movie.cpp"),
104 root.join("Bento4/Source/C++/Core/Ap4MovieFragment.cpp"),
105 root.join("Bento4/Source/C++/Core/Ap4Mpeg2Ts.cpp"),
106 root.join("Bento4/Source/C++/Core/Ap4MvhdAtom.cpp"),
107 root.join("Bento4/Source/C++/Core/Ap4NmhdAtom.cpp"),
108 root.join("Bento4/Source/C++/Core/Ap4ObjectDescriptor.cpp"),
109 root.join("Bento4/Source/C++/Core/Ap4OdafAtom.cpp"),
110 root.join("Bento4/Source/C++/Core/Ap4OddaAtom.cpp"),
111 root.join("Bento4/Source/C++/Core/Ap4OdheAtom.cpp"),
112 root.join("Bento4/Source/C++/Core/Ap4OhdrAtom.cpp"),
113 root.join("Bento4/Source/C++/Core/Ap4OmaDcf.cpp"),
114 root.join("Bento4/Source/C++/Core/Ap4PdinAtom.cpp"),
115 root.join("Bento4/Source/C++/Core/Ap4Piff.cpp"),
116 root.join("Bento4/Source/C++/Core/Ap4Processor.cpp"),
117 root.join("Bento4/Source/C++/Core/Ap4Protection.cpp"),
118 root.join("Bento4/Source/C++/Core/Ap4PsshAtom.cpp"),
119 root.join("Bento4/Source/C++/Core/Ap4Results.cpp"),
120 root.join("Bento4/Source/C++/Core/Ap4RtpAtom.cpp"),
121 root.join("Bento4/Source/C++/Core/Ap4RtpHint.cpp"),
122 root.join("Bento4/Source/C++/Core/Ap4SaioAtom.cpp"),
123 root.join("Bento4/Source/C++/Core/Ap4SaizAtom.cpp"),
124 root.join("Bento4/Source/C++/Core/Ap4Sample.cpp"),
125 root.join("Bento4/Source/C++/Core/Ap4SampleDescription.cpp"),
126 root.join("Bento4/Source/C++/Core/Ap4SampleEntry.cpp"),
127 root.join("Bento4/Source/C++/Core/Ap4SampleSource.cpp"),
128 root.join("Bento4/Source/C++/Core/Ap4SampleTable.cpp"),
129 root.join("Bento4/Source/C++/Core/Ap4SbgpAtom.cpp"),
130 root.join("Bento4/Source/C++/Core/Ap4SchmAtom.cpp"),
131 root.join("Bento4/Source/C++/Core/Ap4SdpAtom.cpp"),
132 root.join("Bento4/Source/C++/Core/Ap4SegmentBuilder.cpp"),
133 root.join("Bento4/Source/C++/Core/Ap4SencAtom.cpp"),
134 root.join("Bento4/Source/C++/Core/Ap4SgpdAtom.cpp"),
135 root.join("Bento4/Source/C++/Core/Ap4SidxAtom.cpp"),
136 root.join("Bento4/Source/C++/Core/Ap4SLConfigDescriptor.cpp"),
137 root.join("Bento4/Source/C++/Core/Ap4SmhdAtom.cpp"),
138 root.join("Bento4/Source/C++/Core/Ap4StcoAtom.cpp"),
139 root.join("Bento4/Source/C++/Core/Ap4SthdAtom.cpp"),
140 root.join("Bento4/Source/C++/Core/Ap4String.cpp"),
141 root.join("Bento4/Source/C++/Core/Ap4StscAtom.cpp"),
142 root.join("Bento4/Source/C++/Core/Ap4StsdAtom.cpp"),
143 root.join("Bento4/Source/C++/Core/Ap4StssAtom.cpp"),
144 root.join("Bento4/Source/C++/Core/Ap4StszAtom.cpp"),
145 root.join("Bento4/Source/C++/Core/Ap4SttsAtom.cpp"),
146 root.join("Bento4/Source/C++/Core/Ap4Stz2Atom.cpp"),
147 root.join("Bento4/Source/C++/Core/Ap4SyntheticSampleTable.cpp"),
148 root.join("Bento4/Source/C++/Core/Ap4TencAtom.cpp"),
149 root.join("Bento4/Source/C++/Core/Ap4TfdtAtom.cpp"),
150 root.join("Bento4/Source/C++/Core/Ap4TfhdAtom.cpp"),
151 root.join("Bento4/Source/C++/Core/Ap4TfraAtom.cpp"),
152 root.join("Bento4/Source/C++/Core/Ap4TimsAtom.cpp"),
153 root.join("Bento4/Source/C++/Core/Ap4TkhdAtom.cpp"),
154 root.join("Bento4/Source/C++/Core/Ap4Track.cpp"),
155 root.join("Bento4/Source/C++/Core/Ap4TrakAtom.cpp"),
156 root.join("Bento4/Source/C++/Core/Ap4TrefTypeAtom.cpp"),
157 root.join("Bento4/Source/C++/Core/Ap4TrexAtom.cpp"),
158 root.join("Bento4/Source/C++/Core/Ap4TrunAtom.cpp"),
159 root.join("Bento4/Source/C++/Core/Ap4UrlAtom.cpp"),
160 root.join("Bento4/Source/C++/Core/Ap4Utils.cpp"),
161 root.join("Bento4/Source/C++/Core/Ap4UuidAtom.cpp"),
162 root.join("Bento4/Source/C++/Core/Ap4VmhdAtom.cpp"),
163 root.join("Bento4/Source/C++/Core/Ap4VpccAtom.cpp"),
164 ])
165 .files([
166 root.join("Bento4/Source/C++/Crypto/Ap4AesBlockCipher.cpp"),
167 root.join("Bento4/Source/C++/Crypto/Ap4Hmac.cpp"),
168 root.join("Bento4/Source/C++/Crypto/Ap4KeyWrap.cpp"),
169 root.join("Bento4/Source/C++/Crypto/Ap4StreamCipher.cpp"),
170 ])
171 .file(root.join("Bento4/Source/C++/MetaData/Ap4MetaData.cpp"))
172 .file(root.join("Bento4/Source/C++/System/StdC/Ap4StdCFileByteStream.cpp"))
173 .file(
174 if env::var("CARGO_CFG_TARGET_OS")
175 .expect("CARGO_CFG_TARGET_OS env variable not set by cargo?")
176 == "windows"
177 {
178 root.join("Bento4/Source/C++/System/Win32/Ap4Win32Random.cpp")
179 } else {
180 root.join("Bento4/Source/C++/System/Posix/Ap4PosixRandom.cpp")
181 },
182 )
183 .out_dir(
184 env::var("OUT_DIR")
185 .map(|x| PathBuf::from(x).join("bento4"))
186 .expect("OUT_DIR env variable not set by cargo?"),
187 )
188 .compile("ap4");
189}