Skip to content

Commit d498c84

Browse files
Merge pull request #1112 from Sean-Der/version-macro
Add version macros
2 parents e87cbee + 3045e73 commit d498c84

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

.github/workflows/check-version.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check version.h values
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
check-version:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: install packages
13+
run: sudo apt update && sudo apt install libssl-dev libsrtp2-dev
14+
- name: submodules
15+
run: git submodule update --init --recursive --depth 1
16+
- name: cmake
17+
run: cmake -B build -DUSE_GNUTLS=0 -DUSE_SYSTEM_SRTP=1 -DWARNINGS_AS_ERRORS=1
18+
- name: check diff
19+
run: |
20+
if ! git diff --exit-code
21+
then
22+
exit 1
23+
fi
24+

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ set(LIBDATACHANNEL_HEADERS
118118
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtcpnackresponder.hpp
119119
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/utils.hpp
120120
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/plihandler.hpp
121+
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/version.h
121122
)
122123

123124
set(LIBDATACHANNEL_IMPL_SOURCES
@@ -252,6 +253,11 @@ else()
252253
add_library(Usrsctp::Usrsctp ALIAS usrsctp)
253254
endif()
254255

256+
configure_file (
257+
${PROJECT_SOURCE_DIR}/cmake/version.h.in
258+
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/version.h
259+
)
260+
255261
add_library(datachannel SHARED
256262
${LIBDATACHANNEL_SOURCES}
257263
${LIBDATACHANNEL_HEADERS}

cmake/version.h.in

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef RTC_VERSION_H
2+
#define RTC_VERSION_H
3+
4+
#define RTC_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
5+
#define RTC_VERSION_MINOR @PROJECT_VERSION_MINOR@
6+
#define RTC_VERSION_PATCH @PROJECT_VERSION_PATCH@
7+
#define RTC_VERSION "@PROJECT_VERSION@"
8+
9+
#endif

include/rtc/rtc.h

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef RTC_C_API
1010
#define RTC_C_API
1111

12+
#include "version.h"
13+
1214
#ifdef __cplusplus
1315
extern "C" {
1416
#endif

include/rtc/version.h

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef RTC_VERSION_H
2+
#define RTC_VERSION_H
3+
4+
#define RTC_VERSION_MAJOR 0
5+
#define RTC_VERSION_MINOR 20
6+
#define RTC_VERSION_PATCH 1
7+
#define RTC_VERSION "0.20.1"
8+
9+
#endif

0 commit comments

Comments
 (0)