Skip to content

Commit

Permalink
Fixing cmake output path
Browse files Browse the repository at this point in the history
Need to add verification test of this cmake. Sorry for the noise.
  • Loading branch information
thirtytwobits committed Dec 16, 2024
1 parent b5053f5 commit 2d78dbc
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
5 changes: 4 additions & 1 deletion NunavutConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ macro(nunavut_json_array_to_list _json_array _list)

set(_local_list "")

foreach(_index RANGE 0 ${_json_array_length} - 1)
math(EXPR _json_array_stop " ${_json_array_length} - 1")
foreach(_index RANGE 0 ${_json_array_stop})
string(JSON _item ERROR_VARIABLE _json_error GET ${${_json_array}} ${_index})

if(_json_error)
Expand Down Expand Up @@ -359,6 +360,7 @@ function(export_nunavut_manifest)
--target-language ${ARG_LANGUAGE}
--list-inputs
--list-outputs
--outdir ${ARG_OUTPUT_DIR}
${LOCAL_LIST_CONFIGURATION}
--list-format ${LOCAL_JSON_FORMAT}
--dry-run
Expand Down Expand Up @@ -496,6 +498,7 @@ function(discover_inputs_and_outputs)
--target-language ${ARG_LANGUAGE}
--list-inputs
--list-outputs
--outdir ${ARG_OUTPUT_DIR}
${LOCAL_LIST_CONFIGURATION}
--list-format ${LOCAL_JSON_FORMAT}
--dry-run
Expand Down
15 changes: 12 additions & 3 deletions docs/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ endif()
# this we highly recommend such a configuration. See the provided CMakePresets.json in this folder for a convenient way
# to switch between online and offline builds. This file defines presets such that:
#
# cmake -B build -G Ninja --preset Connected
# cmake --preset Connected
#
# will configure the build and go online to synchronize resources where:
#
# cmake -B build -G Ninja --preset Disconnected
# cmake --preset Disconnected
#
# will configure the build to stay offline and use whatever is available under the external folder.
set(LOCAL_EXTERNAL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/external)
Expand All @@ -58,7 +58,7 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/nunavut")
FetchContent_Declare(
Nunavut
GIT_REPOSITORY "https://github.com/OpenCyphal/nunavut"
GIT_TAG "1b1dc839593fc1b76b62b0c07061aad0f4a7c2fc" # <-- Here we've specified a specific git hash. This is
GIT_TAG "b5053f55cb65432294d8c4730d5381b7bfd64a19" # <-- Here we've specified a specific git hash. This is
# the strongest declaration of a fetched dependency.
# Using a hash says we don't care if there are bugs
# that are patched later. We want total build
Expand Down Expand Up @@ -140,3 +140,12 @@ add_executable(ecorp_pi main.c)
# this example uses dynamic resolution of all dsdl resources at configure-time, code generation is deferred to
# build-time.
target_link_libraries(ecorp_pi PUBLIC ${CYPHAL_GENERATED_HEADERS_ECORP})

# Using the provided presets do:
#
# cmake --build --preset BuildDebug
#
# or
#
# cmake --build --preset BuildRelease
#
35 changes: 33 additions & 2 deletions docs/cmake/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@
"name": "config-common",
"hidden": true,
"description": "Common configuration",
"generator": "Ninja",
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/build",
"warnings": {
"deprecated": true,
"uninitialized": true
},
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_CONFIGURATION_TYPES": "Release;Debug",
"CMAKE_CROSS_CONFIGS": "all",
"CMAKE_DEFAULT_BUILD_TYPE": "Release",
"CMAKE_DEFAULT_CONFIGS": "Release",
"CMAKE_PREFIX_PATH": "${sourceDir}/external/nunavut"
}
},
{
Expand Down Expand Up @@ -49,5 +58,27 @@
"config-disconnected"
]
}
],
"buildPresets": [
{
"name": "BuildRelease",
"displayName": "Nunavut cmake integration demo (Release)",
"description": "Builds our silly little demo binary.",
"configurePreset": "Disconnected",
"configuration": "Release",
"targets": [
"ecorp_pi"
]
},
{
"name": "BuildDebug",
"displayName": "Nunavut cmake integration demo (Debug)",
"description": "Builds our silly little demo binary.",
"configurePreset": "Disconnected",
"configuration": "Debug",
"targets": [
"ecorp_pi"
]
}
]
}
}

0 comments on commit 2d78dbc

Please sign in to comment.