Skip to content

Commit b777e86

Browse files
committed
Build GStreamer in Windows CI
1 parent 0a97263 commit b777e86

File tree

7 files changed

+31
-30
lines changed

7 files changed

+31
-30
lines changed

.github/build_windows.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
22
mkdir build
33
cd build
44
cmd.exe /c cmake -G "NMake Makefiles" ..
5-
cmake -G "NMake Makefiles" -DBUILD_TEST=TRUE ..
5+
cmake -G "NMake Makefiles" -DBUILD_TEST=TRUE -DBUILD_GSTREAMER_PLUGIN=TRUE ..
66
nmake

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ matrix:
107107
- name: "Windows MSVC"
108108
os: windows
109109
script:
110-
- choco install nasm strawberryperl
110+
- choco install nasm strawberryperl gstreamer
111+
- choco install gstreamer-devel --version=1.16.2 # gstreamer-devel has not been approved yet. Version number must be explicit to install
111112
- unset CC CC_FOR_BUILD CXX CXX_FOR_BUILD # We want to use MSVC
112113
- export "PATH=/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/Strawberry/c/bin:/c/Program Files/NASM:`pwd`/open-source/local/lib:`pwd`/open-source/local/bin:$PATH"
113114
- .github/build_windows.bat

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ link_directories(${LOG4CPLUS_LIBRARY_DIRS})
127127
find_library(Jsmn REQUIRED)
128128
set(OPEN_SRC_INCLUDE_DIRS ${OPEN_SRC_INCLUDE_DIRS} ${JSMN_INCLUDE_DIRS})
129129

130+
if (WIN32)
131+
set(PKG_CONFIG_EXECUTABLE "C:\\gstreamer\\1.0\\x86_64\\bin\\pkg-config.exe")
132+
endif()
133+
130134
############# Enable Sanitizers ############
131135
if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU|Clang")
132136
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
@@ -176,7 +180,6 @@ include_directories(${KINESIS_VIDEO_PRODUCER_CPP_SRC}/src/JNI/include)
176180
include_directories(${KINESIS_VIDEO_PRODUCER_C_SRC}/src/include)
177181

178182
if (WIN32)
179-
SET(JSMN_LIBRARY "../../open-source/local/lib/jsmn")
180183
SET(Log4cplus "log4cplus::log4cplus")
181184
endif()
182185

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To download run the following command:
3434
`git clone --recursive https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git`
3535

3636
Note: If you miss running git clone with --recursive, run `git submodule update --init` in the amazon-kinesis-video-streams-producer-sdk-cpp/open-source directory
37-
You will also need to install `pkg-config` and `CMake` and a build enviroment. If you are build the GStreamer plugin you will also need to install it locally.
37+
You will also need to install `pkg-config` and `CMake` and a build enviroment. If you are building the GStreamer plugin you will also need GStreamer and GStreamer (Development Libraries).
3838

3939
Refer to the [FAQ](#FAQ) for platform specific instructions.
4040

@@ -43,6 +43,8 @@ Create a build directory in the newly checked out repository, and execute CMake
4343

4444
`mkdir -p amazon-kinesis-video-streams-producer-sdk-cpp/build; cd amazon-kinesis-video-streams-producer-sdk-cpp/build; cmake .. `
4545

46+
If you are building on Windows you need to generate `NMake Makefiles`, you should run `cmake .. -G "NMake Makefiles"`
47+
4648
GStreamer and JNI is NOT built by default, if you wish to build both you MUST execute `cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_JNI=TRUE`
4749

4850
By default we download all the libraries from GitHub and build them locally, so should require nothing to be installed ahead of time.
@@ -74,16 +76,28 @@ To build the library run make in the build directory you executed CMake.
7476
make
7577
```
7678

79+
On Windows you should run `nmake` instead of `make`
80+
7781
In your build directory you will now have shared objects for all the targets you have selected
7882

7983
## Run
8084
### GStreamer Plugin (kvssink)
8185

8286
#### Loading Element
83-
The GStreamer plugin will be in your `build` directory, to load this plugin it will need to be in your `GST_PLUGIN_PATH`. Do this you can run
87+
The GStreamer plugin is located in your `build` directory.
88+
89+
To load this plugin set the following environment variables. This should be run from the root of the repo, NOT the `build` directory.
8490

8591
```
8692
export GST_PLUGIN_PATH=`pwd`/build
93+
export LD_LIBRARY_PATH=`pwd`/open-source/local/lib
94+
```
95+
96+
The equivalent for Windows is
97+
98+
```
99+
set GST_PLUGIN_PATH=%CD%\build
100+
set PATH=%PATH%;%CD%\open-source\local\bin;%CD%\open-source\local\lib
87101
```
88102

89103
Now if you execute `gst-inspect-1.0 kvssink` you should get information on the plugin like
@@ -107,7 +121,7 @@ Plugin Details:
107121
Origin URL http://gstreamer.net
108122
```
109123

110-
If the build failed, or `GST_PLUGIN_PATH` is not proprely set you will get output like
124+
If the build failed, or `GST_PLUGIN_PATH` is not properly set you will get output like
111125

112126
```text
113127
No such element or plugin 'kvssink'

docs/macos.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ $ export AWS_SECRET_ACCESS_KEY=YourSecretAccessKey
88
```
99
optionally, set `AWS_SESSION_TOKEN` if integrating with temporary token and `AWS_DEFAULT_REGION` for the region other than `us-west-2`
1010

11-
----
12-
##### Setting the environment variables for library path
13-
* Export the **LD_LIBRARY_PATH**=`<full path to your sdk cpp directory`>/open-source/local/lib. For example, if you have downloaded the CPP SDK in `/opt/awssdk` directory then you can set
14-
the LD_LIBRARY_PATH as below:
15-
```
16-
export LD_LIBRARY_PATH=/opt/awssdk/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib:$LD_LIBRARY_PATH
17-
```
18-
* Set the path for the producer **SDK GStreamer plugin** so that GStreamer can locate it.
19-
```
20-
$ export GST_PLUGIN_PATH=<YourSdkFolderPath>/build:$GST_PLUGIN_PATH
21-
```
22-
2311
###### Discovering available devices.
2412
Run the `gst-device-monitor-1.0` command to identify available media devices in your system. An example output as follows:
2513
```
@@ -203,16 +191,7 @@ The addFileLoggerPlatformCallbacksProvider API takes five parameters.
203191
#### Troubleshooting:
204192

205193
##### Library not found error when running the sample application
206-
If any error similar to the following shows that the library path is not properly set:
207-
```
208-
liblog4cplus-1.2.so.5: cannot open shared object file: No such file or directory
209-
```
210-
To resolve this issue, export the LD_LIBRARY_PATH=`<full path to your sdk cpp directory`>/open-source/local/lib. If you have downloaded the CPP SDK in `/opt/awssdk` directory then you can set
211-
the LD_LIBRARY_PATH as below:
212-
213-
```
214-
export LD_LIBRARY_PATH=/opt/awssdk/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib:$LD_LIBRARY_PATH
215-
```
194+
Make sure you have set `GST_PLUGIN_PATH` and `LD_LIBRARY_PATH` in the `Loading Element` section of the main README.md
216195

217196
##### Build fails with "crypto/include/internal/cryptlib.h:13:11: fatal error: 'stdlib.h`"
218197
run `export MACOSX_DEPLOYMENT_TARGET=10.14`
@@ -229,7 +208,6 @@ The projects depend on the following open source components. Running `CMake` wil
229208
* automake 1.15.1 (GNU License)
230209
* flex 2.5.35 Apple(flex-31)
231210
* libtool (Apple Inc. version cctools-898)
232-
* jsoncpp - [License](https://github.com/open-source-parsers/jsoncpp/blob/master/LICENSE)
233211

234212
###### Unit test dependencies
235213
* [googletest](https://github.com/google/googletest)

docs/windows.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#### Installing GStreamer
2+
Install GStreamer and GStreamer development from https://gstreamer.freedesktop.org/download/
3+
4+
Make sure when install that you do a full install, the standard install is missing important elements like `x264enc`
5+
16
##### Discovering available devices:
27

38
Run the command `gst-device-monitor-1.0` to discover available devices. A sample output of the command looks like following:

tst/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ target_link_libraries(${PROJECT_NAME}
2222
${GTEST_LIBNAME})
2323
add_test(${PROJECT_NAME} ${PROJECT_NAME})
2424

25-
if(BUILD_GSTREAMER_PLUGIN)
25+
if(BUILD_GSTREAMER_PLUGIN AND NOT WIN32)
2626
pkg_check_modules(GST_CHECK REQUIRED gstreamer-check-1.0)
2727

2828
file(GLOB GST_PLUGIN_TEST_SOURCES gstreamer/*.cpp)

0 commit comments

Comments
 (0)