Skip to content

Commit

Permalink
Generate re_cmake_build.h with info about build
Browse files Browse the repository at this point in the history
  • Loading branch information
ypujante committed Sep 12, 2021
1 parent 8ea6f9d commit ed8c89e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Requirements
Quick Starting guide
--------------------

For the sake of keeping this project lean, it does not include any example but you should check [re-blank-plugin](https://github.com/pongasoft/re-blank-plugin) which is the official example project for this framework.
For the sake of keeping this project lean, it does not include any example, but you should check [re-blank-plugin](https://github.com/pongasoft/re-blank-plugin) which is the official example project for this framework.

> #### Tip
> If you want to easily create a blank plugin check the [Rack Extension - Quick Start](https://pongasoft.com/re-quickstart/index.html) tool.
Expand Down Expand Up @@ -286,6 +286,10 @@ It is strongly recommended to check the [re-blank-plugin](https://github.com/pon

Release notes
-------------
#### 1.3.4 - 2021/09/12

- Generates a new `re_cmake_build.h` file which can be included in the code to get access to information from the build itself (particularly useful for testing).

#### 1.3.3 - 2021/07/11

- Use `gtest_discover_tests` to minimize CMake invocation when building tests
Expand Down
31 changes: 31 additions & 0 deletions re_cmake_build.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2021 pongasoft
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* @author Yan Pujante
*/

#pragma once
#ifndef __Pongasoft_re_cmake_build_h__
#define __Pongasoft_re_cmake_build_h__

#define RE_CMAKE_PROJECT_NAME "@CMAKE_PROJECT_NAME@"
#define RE_CMAKE_PROJECT_DIR R"(@PROJECT_DIR_NATIVE_PATH@)"
#define RE_CMAKE_SDK_VERSION "@ARG_RE_SDK_VERSION@"
#define RE_CMAKE_SDK_ROOT R"(@RE_SDK_ROOT_NATIVE_PATH@)"
#define RE_CMAKE_FULL_PRODUCT_ID "@RE_FULL_PRODUCT_ID@"
#define RE_CMAKE_MOTHERBOARD_DEF_LUA R"(@MOTHERBOARD_DEF_LUA_NATIVE_PATH@)"
#define RE_CMAKE_REALTIME_CONTROLLER_LUA R"(@REALTIME_CONTROLLER_LUA_NATIVE_PATH@)"

#endif // __Pongasoft_re_cmake_build_h__
11 changes: 10 additions & 1 deletion sdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ endif()

set(RE_CMAKE_MAJOR_VERSION 1)
set(RE_CMAKE_MINOR_VERSION 3)
set(RE_CMAKE_PATCH_VERSION 3)
set(RE_CMAKE_PATCH_VERSION 4)

# Capturing this outside function call due to scope...
set(BUILD45_SRC_DIR ${CMAKE_CURRENT_LIST_DIR})
Expand Down Expand Up @@ -156,6 +156,15 @@ function(add_re_plugin)
list(APPEND ARG_NATIVE_COMPILE_DEFINITIONS "DEBUG=1")
endif()

# Generate the re_cmake_build.h file
set(GENERATED_FILES_DIR "${CMAKE_BINARY_DIR}/generated")
file(TO_NATIVE_PATH "${CMAKE_CURRENT_LIST_DIR}" PROJECT_DIR_NATIVE_PATH)
file(TO_NATIVE_PATH "${ARG_MOTHERBOARD_DEF_LUA}" MOTHERBOARD_DEF_LUA_NATIVE_PATH)
file(TO_NATIVE_PATH "${ARG_REALTIME_CONTROLLER_LUA}" REALTIME_CONTROLLER_LUA_NATIVE_PATH)
file(TO_NATIVE_PATH "${ARG_RE_SDK_ROOT}" RE_SDK_ROOT_NATIVE_PATH)
configure_file("${BUILD45_SRC_DIR}/re_cmake_build.h.in" "${GENERATED_FILES_DIR}/re_cmake_build.h")
list(APPEND ARG_INCLUDE_DIRECTORIES "${GENERATED_FILES_DIR}")

# Create the native build targets
internal_add_native_build()

Expand Down

0 comments on commit ed8c89e

Please sign in to comment.