feat: Added devcontainers
This commit is contained in:
26
.devcontainer/devcontainer.json
Normal file
26
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
|
||||||
|
{
|
||||||
|
"name": "Existing Dockerfile",
|
||||||
|
"build": {
|
||||||
|
// Sets the run context to one level up instead of the .devcontainer folder.
|
||||||
|
"context": "..",
|
||||||
|
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
||||||
|
"dockerfile": "../Dockerfile"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
// "features": {},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Uncomment the next line to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "cat /etc/os-release",
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
// "customizations": {},
|
||||||
|
|
||||||
|
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "devcontainer"
|
||||||
|
}
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
"displayName": "Default Config",
|
"displayName": "Default Config",
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"binaryDir": "${sourceDir}/build",
|
"binaryDir": "${sourceDir}/build",
|
||||||
"toolchainFile": "cmake/toolchain.cmake",
|
"toolchainFile": "cmake/toolchain.cmake"
|
||||||
"cacheVariables": {
|
|
||||||
"Python3_EXECUTABLE": "/home/didas/src/SAT/incp-test/.venv/bin/python"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"buildPresets": [
|
"buildPresets": [
|
||||||
|
|||||||
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
FROM dockerhub.dsi.tecnico.ulisboa.pt/nanosatlab/istsat-2/incp:develop
|
||||||
|
|
||||||
|
RUN apk update
|
||||||
|
|
||||||
|
# Install friendlier shell
|
||||||
|
RUN apk add fish
|
||||||
|
|
||||||
|
# Install compilers toolchain
|
||||||
|
RUN apk add git cmake ninja openocd gdb-multiarch build-base wget ca-certificates
|
||||||
|
ENV ARM_GCC_VERSION=15.2.rel1
|
||||||
|
ENV ARM_GCC_URL=https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GCC_VERSION}/binrel/arm-gnu-toolchain-${ARM_GCC_VERSION}-x86_64-arm-none-eabi.tar.xz
|
||||||
|
|
||||||
|
RUN mkdir -p /opt && \
|
||||||
|
wget -O /tmp/arm-gcc.tar.xz ${ARM_GCC_URL} && \
|
||||||
|
tar -xf /tmp/arm-gcc.tar.xz -C /opt && \
|
||||||
|
rm /tmp/arm-gcc.tar.xz
|
||||||
|
|
||||||
|
ENV PATH="/opt/arm-gnu-toolchain-${ARM_GCC_VERSION}-x86_64-arm-none-eabi/bin:${PATH}"
|
||||||
@@ -1,18 +1,12 @@
|
|||||||
FetchContent_Declare(
|
set(INCP_SCHEMA ${CMAKE_CURRENT_LIST_DIR}/../incp/schema.yml)
|
||||||
pyincp
|
|
||||||
GIT_REPOSITORY git@repo.dsi.tecnico.ulisboa.pt:nanosatlab/istsat-2/incp.git
|
|
||||||
GIT_TAG develop
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(pyincp)
|
|
||||||
|
|
||||||
find_program(ASN1SCC NAMES asn1scc)
|
|
||||||
|
|
||||||
set(INCP_SCHEMA ${CMAKE_CURRENT_LIST_DIR}/../incp/schema.yml) # Can also be a directory or list of files
|
|
||||||
set(INCP_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
set(INCP_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
set(INCP_APP_TARGET ${EXECUTABLE})
|
||||||
|
|
||||||
set(ASN1_OUTPUT ${INCP_OUTPUT_DIR}/gen.asn1)
|
# External dependencies
|
||||||
|
find_program(ASN1SCC NAMES asn1scc)
|
||||||
|
find_program(PYINCP NAMES pyincp)
|
||||||
|
|
||||||
|
# Auxiliar variables
|
||||||
set(ASN1_OUTPUT ${INCP_OUTPUT_DIR}/gen.asn1)
|
set(ASN1_OUTPUT ${INCP_OUTPUT_DIR}/gen.asn1)
|
||||||
set(ASN1SCC_SOURCES
|
set(ASN1SCC_SOURCES
|
||||||
${INCP_OUTPUT_DIR}/gen.c
|
${INCP_OUTPUT_DIR}/gen.c
|
||||||
@@ -37,9 +31,7 @@ set(INCP_SOURCES
|
|||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${ASN1_OUTPUT}
|
OUTPUT ${ASN1_OUTPUT}
|
||||||
COMMAND
|
COMMAND
|
||||||
${CMAKE_COMMAND} -E env
|
${PYINCP} codegen --asn1 ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
||||||
PYTHONPATH=${pyincp_SOURCE_DIR}
|
|
||||||
${INCP_GEN_COMMAND} --asn1 ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
|
||||||
MAIN_DEPENDENCY ${INCP_SCHEMA}
|
MAIN_DEPENDENCY ${INCP_SCHEMA}
|
||||||
COMMENT "INCP: Generating ASN1 definition"
|
COMMENT "INCP: Generating ASN1 definition"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
@@ -63,20 +55,29 @@ add_custom_command(
|
|||||||
${WRAPPER_SOURCE}
|
${WRAPPER_SOURCE}
|
||||||
${WRAPPER_HEADER}
|
${WRAPPER_HEADER}
|
||||||
COMMAND
|
COMMAND
|
||||||
${CMAKE_COMMAND} -E env
|
${PYINCP} codegen --c ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
||||||
PYTHONPATH=${pyincp_SOURCE_DIR}
|
|
||||||
${INCP_GEN_COMMAND} --c ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
|
||||||
MAIN_DEPENDENCY ${INCP_SCHEMA}
|
MAIN_DEPENDENCY ${INCP_SCHEMA}
|
||||||
COMMENT "INCP: Generating C wrapper"
|
COMMENT "INCP: Generating C wrapper"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
# Integrate generated artifacts with the project's build
|
# Custom target helps force ordering of code generation
|
||||||
target_sources(${EXECUTABLE} PRIVATE
|
add_custom_target(generate_incp
|
||||||
${ASN1SCC_SOURCES}
|
DEPENDS
|
||||||
${WRAPPER_SOURCE}
|
${WRAPPER_SOURCE}
|
||||||
|
${WRAPPER_HEADER}
|
||||||
|
${ASN1SCC_SOURCES}
|
||||||
|
${ASN1SCC_HEADERS}
|
||||||
|
)
|
||||||
|
add_dependencies(${INCP_APP_TARGET} generate_incp)
|
||||||
|
|
||||||
|
# Add generated sources tp the project build
|
||||||
|
target_sources(${INCP_APP_TARGET} PRIVATE
|
||||||
|
${INCP_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${EXECUTABLE} PRIVATE
|
# Add include paths
|
||||||
|
target_include_directories(${INCP_APP_TARGET} PRIVATE
|
||||||
${INCP_OUTPUT_DIR}
|
${INCP_OUTPUT_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user