Skip to content

Commit

Permalink
version: add generated define for version
Browse files Browse the repository at this point in the history
For memory footprint reason it can be useful for applications
to use defines during the build pre-processing step.

Add a generated version_def.h file that will be accessible in the
the install directory ./build/bin/usr/local/include/openamp/.

Application will be able to use the version.h or the version_def.h
depending on its need.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
  • Loading branch information
arnopo committed Apr 26, 2021
1 parent 52c4b75 commit 7088ba5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/CMakeLists.txt
Expand Up @@ -17,6 +17,9 @@ endif (WITH_PROXY)

set (OPENAMP_LIB open_amp)

configure_file(version.h.in ${PROJECT_BINARY_DIR}/include/generated/openamp/version_def.h)
collect (PROJECT_INC_DIRS " ${PROJECT_BINARY_DIR}/include/generated/openamp")

if (NOT CMAKE_INSTALL_LIBDIR)
set (CMAKE_INSTALL_LIBDIR "lib")
endif (NOT CMAKE_INSTALL_LIBDIR)
Expand Down Expand Up @@ -62,5 +65,6 @@ else (WITH_ZEPHYR)
endif (WITH_ZEPHYR)

install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/openamp" DESTINATION include)
install (DIRECTORY "${PROJECT_BINARY_DIR}/include/generated/openamp" DESTINATION include)

# vim: expandtab:ts=2:sw=2:smartindent
22 changes: 22 additions & 0 deletions lib/version.h.in
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2021, STMicroelectronics.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/*
* @file version_def.h
* @brief generated version definition for OpenAMP library.
*/

#ifndef __OPENAMP_VERSION_DEF__H__
#define __OPENAMP_VERSION_DEF__H__

/* @templates@ values come from cmake/option.cmake */

#define OPENAMP_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define OPENAMP_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define OPENAMP_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define OPENAMP_VERSION "@PROJECT_VERSION@"

#endif /* __OPENAMP_VERSION_DEF__H__ */

0 comments on commit 7088ba5

Please sign in to comment.