Skip to content

Commit

Permalink
Merge pull request #1112 from Sean-Der/version-macro
Browse files Browse the repository at this point in the history
Add version macros
  • Loading branch information
paullouisageneau authored Feb 21, 2024
2 parents e87cbee + 3045e73 commit d498c84
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/check-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check version.h values
on:
push:
branches:
- master
pull_request:
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install packages
run: sudo apt update && sudo apt install libssl-dev libsrtp2-dev
- name: submodules
run: git submodule update --init --recursive --depth 1
- name: cmake
run: cmake -B build -DUSE_GNUTLS=0 -DUSE_SYSTEM_SRTP=1 -DWARNINGS_AS_ERRORS=1
- name: check diff
run: |
if ! git diff --exit-code
then
exit 1
fi
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ set(LIBDATACHANNEL_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtcpnackresponder.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/utils.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/plihandler.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/version.h
)

set(LIBDATACHANNEL_IMPL_SOURCES
Expand Down Expand Up @@ -252,6 +253,11 @@ else()
add_library(Usrsctp::Usrsctp ALIAS usrsctp)
endif()

configure_file (
${PROJECT_SOURCE_DIR}/cmake/version.h.in
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/version.h
)

add_library(datachannel SHARED
${LIBDATACHANNEL_SOURCES}
${LIBDATACHANNEL_HEADERS}
Expand Down
9 changes: 9 additions & 0 deletions cmake/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef RTC_VERSION_H
#define RTC_VERSION_H

#define RTC_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define RTC_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define RTC_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define RTC_VERSION "@PROJECT_VERSION@"

#endif
2 changes: 2 additions & 0 deletions include/rtc/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef RTC_C_API
#define RTC_C_API

#include "version.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
9 changes: 9 additions & 0 deletions include/rtc/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef RTC_VERSION_H
#define RTC_VERSION_H

#define RTC_VERSION_MAJOR 0
#define RTC_VERSION_MINOR 20
#define RTC_VERSION_PATCH 1
#define RTC_VERSION "0.20.1"

#endif

0 comments on commit d498c84

Please sign in to comment.