feat: Added devcontainers
This commit is contained in:
@@ -1,18 +1,12 @@
|
||||
FetchContent_Declare(
|
||||
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_SCHEMA ${CMAKE_CURRENT_LIST_DIR}/../incp/schema.yml)
|
||||
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(ASN1SCC_SOURCES
|
||||
${INCP_OUTPUT_DIR}/gen.c
|
||||
@@ -37,9 +31,7 @@ set(INCP_SOURCES
|
||||
add_custom_command(
|
||||
OUTPUT ${ASN1_OUTPUT}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E env
|
||||
PYTHONPATH=${pyincp_SOURCE_DIR}
|
||||
${INCP_GEN_COMMAND} --asn1 ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
||||
${PYINCP} codegen --asn1 ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
||||
MAIN_DEPENDENCY ${INCP_SCHEMA}
|
||||
COMMENT "INCP: Generating ASN1 definition"
|
||||
VERBATIM
|
||||
@@ -63,20 +55,29 @@ add_custom_command(
|
||||
${WRAPPER_SOURCE}
|
||||
${WRAPPER_HEADER}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E env
|
||||
PYTHONPATH=${pyincp_SOURCE_DIR}
|
||||
${INCP_GEN_COMMAND} --c ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
||||
${PYINCP} codegen --c ${INCP_OUTPUT_DIR} ${INCP_SCHEMA}
|
||||
MAIN_DEPENDENCY ${INCP_SCHEMA}
|
||||
COMMENT "INCP: Generating C wrapper"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# Integrate generated artifacts with the project's build
|
||||
target_sources(${EXECUTABLE} PRIVATE
|
||||
${ASN1SCC_SOURCES}
|
||||
${WRAPPER_SOURCE}
|
||||
# Custom target helps force ordering of code generation
|
||||
add_custom_target(generate_incp
|
||||
DEPENDS
|
||||
${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
|
||||
${INCP_OUTPUT_DIR}
|
||||
# Add include paths
|
||||
target_include_directories(${INCP_APP_TARGET} PRIVATE
|
||||
${INCP_OUTPUT_DIR}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user