From ed8c89e743d10eed90de3bfd443661838273d76d Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Sun, 12 Sep 2021 09:25:59 -0700 Subject: [PATCH] Generate re_cmake_build.h with info about build --- README.md | 6 +++++- re_cmake_build.h.in | 31 +++++++++++++++++++++++++++++++ sdk.cmake | 11 ++++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 re_cmake_build.h.in diff --git a/README.md b/README.md index 5d76f5f..2769bba 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 diff --git a/re_cmake_build.h.in b/re_cmake_build.h.in new file mode 100644 index 0000000..c271f76 --- /dev/null +++ b/re_cmake_build.h.in @@ -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__ \ No newline at end of file diff --git a/sdk.cmake b/sdk.cmake index f7bb145..3ec6a5e 100755 --- a/sdk.cmake +++ b/sdk.cmake @@ -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}) @@ -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()