Skip to content

Commit

Permalink
Added edit command (uses RE Edit)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ypujante committed Jan 2, 2023
1 parent 19476f0 commit 03b01e4
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 25 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) |
Expand Down Expand Up @@ -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)
Expand Down
45 changes: 27 additions & 18 deletions cmake/RECMakeFetchContent.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,44 +35,53 @@ 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)

# 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})

if(NOT ${ARG_NAME}_POPULATED)
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})
Expand Down
2 changes: 1 addition & 1 deletion cmake/RECMakeFetchGoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
12 changes: 9 additions & 3 deletions cmake/RECMakeOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
2 changes: 1 addition & 1 deletion main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
2 changes: 2 additions & 0 deletions re-cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',

Expand Down
40 changes: 38 additions & 2 deletions sdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()

0 comments on commit 03b01e4

Please sign in to comment.