From 03b01e46afc909057491acf4fea542611e3012fd Mon Sep 17 00:00:00 2001 From: Yan Pujante Date: Tue, 27 Dec 2022 11:04:50 -0800 Subject: [PATCH] Added edit command (uses RE Edit) - bumped CMake requirements to 3.24 - Uses re-mock 1.3.2 - Uses GoogleTest 1.12.1 - Added a new `DOWNLOAD_URL` option for `re_cmake_fetch_content` to avoid downloading the whole git history --- README.md | 10 +++++++ cmake/RECMakeFetchContent.cmake | 45 ++++++++++++++++++------------ cmake/RECMakeFetchGoogleTest.cmake | 2 +- cmake/RECMakeOptions.cmake | 12 ++++++-- main.cmake | 2 +- re-cmake.py | 2 ++ sdk.cmake | 40 ++++++++++++++++++++++++-- 7 files changed, 88 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 693d72c..159bc3c 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,7 @@ Commands ---- Common commands ---- clean : clean all builds render : runs RE2DRender to generate the GUI (necessary for running in Recon) + edit : runs RE Edit to edit the device (UI) preview : runs RE2DPreview to generate the device preview (useful for shop images) uninstall : deletes the installed RE validate : runs the Recon validate process on the currently installed plugin @@ -246,6 +247,7 @@ Here is a quick rundown of the list of targets and associated commands. Note tha | `common-preview` | `preview` | Generates a 2D preview of the device front, back, folded front and folded back (generated at full 5x resolution (3770x345*u), useful for shop images) | | `common-uninstall` | `uninstall` | Uninstalls the plugin from its default location (for example you can run: `./re.sh uninstall install`) | | `common-clean` | `clean` | Cleans any previous build (forces a rebuild of everything on next build) | +| `common-edit` | `edit` | Runs [RE Edit](https://pongasoft.com/re-edit/) for this device | | `common-validate` | `validate` | Runs Recon validation on the currently installed plugin. It does **not** install the plugin prior. | | `jbox-l45-deployment-install` | `local45` | Builds the (sandboxed) plugin with the jbox toolchain (`local45 Deployment`), generates the GUI and installs the plugin in its default location (ready to be used in Recon) | | `jbox-l45-testing-install` | `-t local45` | Builds the (sandboxed) plugin with the jbox toolchain (`local45 Testing`), generates the GUI and installs the plugin in its default location (ready to be used in Recon) | @@ -318,6 +320,14 @@ It is strongly recommended checking the [re-blank-plugin](https://github.com/pon Release notes ------------- +#### 1.5.0 - 2023/01/02 + +- Added `edit` command (which uses [RE Edit](https://pongasoft.com/re-edit/)) +- Bumped CMake minimum version to 3.24 +- Uses re-mock 1.3.2 +- Uses GoogleTest 1.12.1 +- Added a new `DOWNLOAD_URL` option for `re_cmake_fetch_content` to avoid downloading the whole git history + #### 1.4.4 - 2022/10/29 - Uses re-mock 1.2.0 (better error reporting / bug fixes) diff --git a/cmake/RECMakeFetchContent.cmake b/cmake/RECMakeFetchContent.cmake index 5b602a2..c898fa1 100644 --- a/cmake/RECMakeFetchContent.cmake +++ b/cmake/RECMakeFetchContent.cmake @@ -14,12 +14,12 @@ # # @author Yan Pujante -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.24) include(FetchContent) function(re_cmake_fetch_content) - set(oneValueArgs NAME GIT_REPO GIT_TAG ROOT_DIR) + set(oneValueArgs NAME GIT_REPO GIT_TAG DOWNLOAD_URL ROOT_DIR) cmake_parse_arguments( "ARG" # prefix @@ -35,17 +35,18 @@ function(re_cmake_fetch_content) macro(set_default_value name default_value) if(NOT ${name}) - set(${name} ${default_value}) + set(${name} "${default_value}") endif() endmacro() set_default_value(ARG_ROOT_DIR "${${ARG_NAME}_ROOT_DIR}") + set_default_value(ARG_DOWNLOAD_URL "${${ARG_NAME}_DOWNLOAD_URL}") set_default_value(ARG_GIT_REPO "${${ARG_NAME}_GIT_REPO}") set_default_value(ARG_GIT_TAG "${${ARG_NAME}_GIT_TAG}") set_default_value(ARG_GIT_TAG "master") - if(NOT ARG_ROOT_DIR AND NOT ARG_GIT_REPO) - message(FATAL_ERROR "fetch_content requires either ROOT_DIR argument/${ARG_NAME}_ROOT_DIR variable or GIT_REPO/${ARG_NAME}_GIT_REPO to be defined") + if(NOT ARG_ROOT_DIR AND NOT ARG_GIT_REPO AND NOT ARG_DOWNLOAD_URL) + message(FATAL_ERROR "fetch_content requires either ROOT_DIR argument/${ARG_NAME}_ROOT_DIR variable or GIT_REPO/${ARG_NAME}_GIT_REPO or DOWNLOAD_URL/${ARG_NAME}_DOWNLOAD_URL to be defined ") endif() string(TOUPPER "${ARG_NAME}" UPPERCASE_NAME) @@ -53,18 +54,26 @@ function(re_cmake_fetch_content) # if root dir is defined, fetch content will not use git set(FETCHCONTENT_SOURCE_DIR_${UPPERCASE_NAME} ${ARG_ROOT_DIR}) - FetchContent_Declare(${ARG_NAME} - GIT_REPOSITORY ${ARG_GIT_REPO} - GIT_TAG ${ARG_GIT_TAG} - GIT_CONFIG advice.detachedHead=false - GIT_SHALLOW true - SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-src" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - ) + if(ARG_DOWNLOAD_URL) + FetchContent_Declare( ${ARG_NAME} + URL "${ARG_DOWNLOAD_URL}" + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" + DOWNLOAD_EXTRACT_TIMESTAMP true + ) + set(FETCH_SOURCE "${ARG_DOWNLOAD_URL}") + else() + FetchContent_Declare(${ARG_NAME} + GIT_REPOSITORY ${ARG_GIT_REPO} + GIT_TAG ${ARG_GIT_TAG} + GIT_CONFIG advice.detachedHead=false + GIT_SHALLOW true + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_NAME}-build" + ) + set(FETCH_SOURCE "${ARG_GIT_REPO}/tree/${ARG_GIT_TAG}") + endif() + FetchContent_GetProperties(${ARG_NAME}) @@ -72,7 +81,7 @@ function(re_cmake_fetch_content) if(FETCHCONTENT_SOURCE_DIR_${UPPERCASE_NAME}) message(STATUS "Using ${ARG_NAME} from local ${FETCHCONTENT_SOURCE_DIR_${UPPERCASE_NAME}}") else() - message(STATUS "Fetching ${ARG_NAME} ${ARG_GIT_REPO}/tree/${ARG_GIT_TAG}") + message(STATUS "Fetching ${ARG_NAME} from ${FETCH_SOURCE}") endif() FetchContent_Populate(${ARG_NAME}) diff --git a/cmake/RECMakeFetchGoogleTest.cmake b/cmake/RECMakeFetchGoogleTest.cmake index 7b51176..c357d1d 100644 --- a/cmake/RECMakeFetchGoogleTest.cmake +++ b/cmake/RECMakeFetchGoogleTest.cmake @@ -14,7 +14,7 @@ # # @author Yan Pujante -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.24) include("${CMAKE_CURRENT_LIST_DIR}/RECMakeFetchContent.cmake") diff --git a/cmake/RECMakeOptions.cmake b/cmake/RECMakeOptions.cmake index 330a515..e08d8a8 100644 --- a/cmake/RECMakeOptions.cmake +++ b/cmake/RECMakeOptions.cmake @@ -50,9 +50,13 @@ set(googletest_GIT_REPO "https://github.com/google/googletest" CACHE STRING "goo #------------------------------------------------------------------------ # The git tag for googletest -# release-1.11.0 => e2239ee6043f73722e7aa812a459f54a28552929 #------------------------------------------------------------------------ -set(googletest_GIT_TAG "e2239ee6043f73722e7aa812a459f54a28552929" CACHE STRING "googletest git tag") +set(googletest_GIT_TAG "release-1.12.1" CACHE STRING "googletest git tag") + +#------------------------------------------------------------------------ +# The download URL for googletest +#------------------------------------------------------------------------ +set(googletest_DOWNLOAD_URL "${googletest_GIT_REPO}/archive/refs/tags/${googletest_GIT_TAG}.zip" CACHE STRING "googletest download url" FORCE) #------------------------------------------------------------------------ # Option for invoking RE2DRender for hi res build @@ -66,9 +70,11 @@ set(RE_CMAKE_RE_2D_RENDER_HI_RES_OPTION "hi-res-only" CACHE STRING "Option for i #------------------------------------------------------------------------ set(re-logging_GIT_REPO "https://github.com/pongasoft/re-logging" CACHE STRING "re-logging git repository url") set(re-logging_GIT_TAG "v1.0.1" CACHE STRING "re-logging git tag") +set(re-logging_DOWNLOAD_URL "${re-logging_GIT_REPO}/archive/refs/tags/${re-logging_GIT_TAG}.zip" CACHE STRING "re-logging download url" FORCE) #------------------------------------------------------------------------ # Git repo/tag for re-mock #------------------------------------------------------------------------ set(re-mock_GIT_REPO "https://github.com/pongasoft/re-mock" CACHE STRING "re-mock git repository url") -set(re-mock_GIT_TAG "v1.2.0" CACHE STRING "re-mock git tag") +set(re-mock_GIT_TAG "v1.3.2" CACHE STRING "re-mock git tag") +set(re-mock_DOWNLOAD_URL "${re-mock_GIT_REPO}/archive/refs/tags/${re-mock_GIT_TAG}.zip" CACHE STRING "re-mock download url" FORCE) diff --git a/main.cmake b/main.cmake index 316b3c4..f74a696 100644 --- a/main.cmake +++ b/main.cmake @@ -14,7 +14,7 @@ # # @author Yan Pujante -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.24) set(re-cmake_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}") diff --git a/re-cmake.py b/re-cmake.py index 3bc1920..66820de 100755 --- a/re-cmake.py +++ b/re-cmake.py @@ -47,6 +47,7 @@ clean : clean all builds render : runs RE2DRender to generate the GUI (necessary for running in Recon) preview : runs RE2DPreview to generate the device preview (useful for shop images) + edit : runs RE Edit to edit the device (UI) uninstall : deletes the installed RE validate : runs the Recon validate process on the currently installed plugin @@ -115,6 +116,7 @@ def clear_recon_graphics_cache(): 'clean': 'common-clean', 'render': f'common-render-{gui_type}', 'preview': 'common-preview', + 'edit': 'common-edit', 'uninstall': 'common-uninstall', 'validate': 'common-validate', diff --git a/sdk.cmake b/sdk.cmake index 9a35f50..5b89833 100755 --- a/sdk.cmake +++ b/sdk.cmake @@ -14,7 +14,7 @@ # # @author Yan Pujante -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.24) # Making sure we are on macOS and Win10 if(NOT (APPLE OR WIN32)) @@ -56,7 +56,8 @@ function(add_re_plugin) # Argument parsing / default values ############################################# set(options ENABLE_DEBUG_LOGGING) - set(oneValueArgs RE_SDK_VERSION RE_SDK_ROOT RE_2D_RENDER_ROOT RE_2D_PREVIEW_ROOT INFO_LUA MOTHERBOARD_DEF_LUA REALTIME_CONTROLLER_LUA DISPLAY_LUA RESOURCES_DIR PYTHON3_EXECUTABLE RE_RECON_EXECUTABLE) + set(oneValueArgs RE_SDK_VERSION RE_SDK_ROOT RE_2D_RENDER_ROOT RE_2D_PREVIEW_ROOT INFO_LUA MOTHERBOARD_DEF_LUA REALTIME_CONTROLLER_LUA DISPLAY_LUA + RESOURCES_DIR PYTHON3_EXECUTABLE RE_RECON_EXECUTABLE RE_EDIT_EXECUTABLE) set(multiValueArgs BUILD_SOURCES RENDER_2D_SOURCES INCLUDE_DIRECTORIES COMPILE_DEFINITIONS COMPILE_OPTIONS JBOX_COMPILE_DEFINITIONS JBOX_COMPILE_OPTIONS NATIVE_BUILD_SOURCES NATIVE_BUILD_LIBS NATIVE_COMPILE_DEFINITIONS NATIVE_COMPILE_OPTIONS NATIVE_LINK_OPTIONS @@ -218,6 +219,9 @@ function(add_re_plugin) # Add validation targets internal_add_validation() + # Add edit target + internal_add_edit() + # Copy the convenient script wrapper(s) if(APPLE) configure_file(${BUILD45_SRC_DIR}/re.sh.in ${CMAKE_BINARY_DIR}/re.sh @ONLY) @@ -619,3 +623,35 @@ function(internal_add_validation) ) endif() endfunction() + +########################################################## +# Internal function to add edit targets +########################################################## +function(internal_add_edit) + # Determine RE Edit executable + if(ARG_RE_EDIT_EXECUTABLE) + set(RE_EDIT_EXECUTABLE "${ARG_RE_EDIT_EXECUTABLE}") + else() + find_program( + RE_EDIT_EXECUTABLE + NAMES "RE Edit" + PATHS "/Applications" "c:/Program Files/pongasoft" + ) + endif() + + if("${RE_EDIT_EXECUTABLE}" STREQUAL "RE_EDIT_EXECUTABLE-NOTFOUND") + add_custom_target(common-edit + COMMAND ${CMAKE_COMMAND} -E echo "'edit' cannot run because RE Edit executable was not found in its default location. To fix this issue you can either install/move RE Edit from https://pongasoft.com/re-edit/ into its default location or provide its location via RE_EDIT_EXECUTABLE argument." + ) + else() + message(VERBOSE "RE_EDIT_EXECUTABLE=${RE_EDIT_EXECUTABLE}") + + ############################################# + # common-edit target runs edit without any dependency + ############################################# + add_custom_target(common-edit + COMMAND "${RE_EDIT_EXECUTABLE}" "\"${CMAKE_CURRENT_LIST_DIR}/info.lua\"" + ) + + endif() +endfunction()