Skip to content

Commit

Permalink
Add version macros
Browse files Browse the repository at this point in the history
Add version.h with the following values. This values are managed/updated
via CMake

```
#pragma once

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

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Fri Feb 16 10:25:47 2024 -0500
#
# On branch version-macro
# Changes to be committed:
#	modified:   CMakeLists.txt
#	new file:   cmake/version.h.in
#	modified:   include/rtc/rtc.h
#	new file:   include/rtc/version.h
#
# Untracked files:
#	install/
#
  • Loading branch information
Sean-Der committed Feb 16, 2024
1 parent e87cbee commit 9175e26
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
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
${PROJECT_BINARY_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_INSTALL_INCLUDEDIR}/rtc/version.h
)

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

#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@"
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
1 change: 1 addition & 0 deletions include/rtc/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 9175e26

Please sign in to comment.