-
Notifications
You must be signed in to change notification settings - Fork 173
/
HOWTO-BuildWindowsNativeCode.txt
310 lines (220 loc) · 9.34 KB
/
HOWTO-BuildWindowsNativeCode.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
------------------
---- Overview ----
------------------
This document details how to setup the build environment for SageTV Open
Source, using Visual Studio 2015 and MSYS2/MINGW, for the purpose
of building Windows "native" (non-Java) code. It assumes a Windows
computer with no previous installation of the tools listed below.
Installation requires a number of system reboots, so be prepared
and do not skip the reboots.
The process involves the following steps:
1. Install JDK (32 & 64 bit)
2. Install GitHub Desktop (optional)
3. Install DirectX SDK
4. Install Visual Studio 2015
5. Install MSYS2 & required packages
6. Build SageTV Windows native code in MinGW
7. Build SageTV Windows native code in Visual Studio
=====================================================================
1. Install JDK
=====================================================================
Info:
In deciding between installing the 32-bit vs. 64-bit
version of JDK, consider that prior to SageOpenSource, SageTv
was originally built using the 32-bit version of Java.
To avoid unforseen issues it may be wise to start with a 32-bit
JDK installation for initial development.
Steps:
------
A) Download the Java Development Kits (Windows x86 and Windows x64).
Available here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
B) Install the Java Development Kits.
Note the folders that they're installed to.
C) Create the following Environment Variables:
SAGEDEVJDK
It's value should be the path to where JDK was installed, i.e.,
something like:
C:\Program Files (x86)\Java\jdk1.8.0_60
Do NOT quote the path, even though it may contain embedded spaces.
SAGEDEVJDK64
It's value should be the path to where JDK was installed, i.e.,
something like:
C:\Program Files\Java\jdk1.8.0_60
Do NOT quote the path, even though it may contain embedded spaces.
JAVA_HOME
It's value should be the path to where JDK was installed, i.e.,
something like:
C:\Program Files\Java\jdk1.8.0_60
Do NOT quote the path, even though it may contain embedded spaces.
=====================================================================
2. Install GitHub Desktop
=====================================================================
Info:
-----
GitHub Desktop is used to access the Sage source-code repository.
Use of GitHub Desktop is optional. It's also possible to download
source code via the web interface, at:
https://github.com/google/sagetv
GitHub Desktop can be downloaded from:
https://desktop.github.com/
=====================================================================
3. Install "DirectX SDK June 2010" edition
=====================================================================
Info:
-----
"DirectX SDK June 2010" provides needed libraries to build Sage
Microsoft has announced that this is it's final release.
Steps:
-----
A) Download Microsoft's "DirectX SDK June 2010" edition.
It can be found at:
http://www.microsoft.com/en-us/download/details.aspx?id=6812
B) Run the installer
--> At installation, choose to include "Direct X symbol files"
(if this step is missed, re-run the installer again and
check this option)
The installer automatically adds DXSDK_DIR to the **System**
environment variables. On a 64-bit OS, DXSDK_DIR points to:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)
C) Verify DXSDK_DIR env. variable is set (in System env. vars.)
=====================================================================
4. Install VS2015 (aka vs14)
=====================================================================
Visual Studio 2015 provides an IDE for working native code. It also
included necessary libraries and compile tools.
A) Download from:
https://www.visualstudio.com/products/visual-studio-community-vs
B) Save the file (vs_community.exe)
C) Launch the downloaded file (runs the installer)
Visual Studio Community 2015 window opens:
Accept the default installation location
e.g. C:\Program Files (x86)\Microsoft Visual Studio 14.0
"Choose the type of installation"
select "Custom"
Click "Next" button
At the Select Features window,
Select the following features **in addition** to the defaults:
Programming Languages
Select "Visual C++"
This automatically selects:
Common Tools for Visual C++ 2015
Microsoft Foundation Classes for C++ <<-- Must have y!!!
Windows XP Support for C++
Common Tools
Select "Git for Windows"
Select "GitHub Extension for Visual Studio"
Click "Next" button
Click "Install" button
(the installer runs... can take almost an hour)
Wait for "Setup Completed"
Click "Restart Now" button
Note: You can re-run the installer again later to add or change
the installation options.
=====================================================================
5. Install MSYS2 & required packages
=====================================================================
MSYS2 is a software building platform that provides a Unix-like command
line and tools. Details here: https://github.com/msys2/msys2/wiki
Download it here:
https://www.msys2.org
Select the x64_64 version if your OS is 64-bit and you want to build
64-bit code.
Follow the installation instructions on the msys2.org page.
Once it's installed, there will be 3 shortcuts in your start menu under
"MSYS2 64bit": MSYS2 MSYS, MSYS2 MinGW 32-bit and MSYS2 MinGW 64-bit.
Run the MSYS one to install support the following packages using 'pacman':
pacman -S msys/make
pacman -S msys/autoconf
pacman -S msys/automake1.15
pacman -S msys/automake-wrapper
pacman -S msys/libtool
pacman -S mingw32/mingw-w64-i686-gcc
pacman -S mingw64/mingw-w64-x86_64-gcc
pacman -S mingw32/mingw-w64-i686-yasm
pacman -S mingw64/mingw-w64-x86_64-yasm
pacman -S mingw32/mingw-w64-i686-freetype
pacman -S mingw64/mingw-w64-x86_64-freetype
pacman -S mingw32/mingw-w64-i686-harfbuzz
pacman -S mingw64/mingw-w64-x86_64-harfbuzz
pacman -S mingw32/mingw-w64-i686-libpng
pacman -S mingw64/mingw-w64-x86_64-libpng
pacman -S mingw32/mingw-w64-i686-graphite2
pacman -S mingw64/mingw-w64-x86_64-graphite2
pacman -S mingw32/mingw-w64-i686-zlib
pacman -S mingw64/mingw-w64-x86_64-zlib
Using 'pacman -Ss <pattern>' will list available packages matching the
pattern. Use 'pacman -Q' to list all installed packges.
MSYS2 MSYS is only used to configure the 32/64 bit MinGW enviroments.
Close it after the packages are installed.
=====================================================================
6. Build SageTV Windows native code in MinGW
=====================================================================
Run either MSYS2 MinGW 32-bit or MSYS2 MinGW 64-bit.
Use the 32-bit or 64-bit MinGW version to build 32-bit or 64-bit SageTV.
Prerequisites:
-----
- Packages listed above are installed.
- You're in the proper shell (MINGW32 or MINGW64 after the prompt).
- SAGEDEVJDK, SAGEDEVJDK64 & JAVA_HOME environment variables are set.
Confirm by typing 'env'.
Steps:
-----
A. Navigate to the sagetv/buildwin directory. The C drive is mounted as
'/c' so you can do something like 'cd /c/projects/sagetv/buildwin'.
B. run ./buildwin.sh
This builds the following support DLL's and places them in buildwin/Win32 or
buildwin/x64:
- swscale.dll
- ImageLoader.dll
- Pushreader.dll
- FreetypeFontJNI.dll
- Mpeg2Transcoder.dll
It also builds third_party/SageTV-LGPL/Pushreader/(Win32|x64)/Pushreader.lib
which is referenced in the Visual Studio StrmDeMux project.
=====================================================================
7. Build SageTV Windows native code in Visual Studio
=====================================================================
We're finally ready to build VS2015 Windows "native" (non-Java) code.
Prerequisites:
-----
- JDK installed.
- DirectX SDK & Visual Studio installed and configured
- Environment variables set:
DXSDK_DIR
SAGEDEVJDK
SAGEDEVJDK64
JAVA_HOME
Steps:
-----
A) Verify that the above environment variables have been set.
Visual Studio needs them all to build the Solution.
- Open a Command Prompt window.
- Type "set".
- Verify the variables listed above.
B) Use Git to get a local copy of the repository onto your computer.
C) After cloning the repository, use Windows Explorer to open
up a window to your local copy where the sources are stored.
D) Locate the SageWorkspace.sln file. It will be in:
<your_local_GitHub_path>\sagetv\native
Double-click on the SageWorkspace.sln file to launch Studio and
load all the child Projects.
The first time Studio is launched to access the Solution, you
might encounter a series of questions about source control.
Answer them.
E) Build the Solution:
- On the Studio menu bar, ensure "Release" and "Win32" or "x64" is chosen.
- In the Solution Explorer sub-window, highlight SageWorkspace.
- Right-click SageLauncher, select "Build"
The resultant files will be in native\Build\Release\Win32 or x64
Common build failures:
-----------------------
* "RC1015: cannot open include file 'afxres.h' "
Re-run the VS2015 installer and verify that MS Foundation Classes
were installed.
* "can't find jvm.lib"
This occurs if SAGEDEVJDK is missing or incorrect
* "fatal error C1083: Cannot open include file: 'D3dX9.h' "
This occurs if DXSDK_DIR is missing or incorrect
* "cannot find tools.jar."
This occurs if JAVA_HOME is missing or incorrect.