Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libs: Add static compatiblity check for Rust #13245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/libc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ source "libs/libc/regex/Kconfig"
source "libs/libc/gnssutils/Kconfig"
source "libs/libc/fdt/Kconfig"
source "libs/libc/queue/Kconfig"
source "libs/libc/librust/Kconfig"
1 change: 1 addition & 0 deletions libs/libc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ include wchar/Make.defs
include wctype/Make.defs
include wqueue/Make.defs
include fdt/Make.defs
include librust/Make.defs

# Use double delim to fix windows native build and give an error:
# makefile:132: *** target mode do not include“%”. stop.
Expand Down
23 changes: 23 additions & 0 deletions libs/libc/librust/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ##############################################################################
# libs/librust/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_LIBRUST)
target_sources(c PRIVATE lib_rust.c)
endif()
16 changes: 16 additions & 0 deletions libs/libc/librust/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config LIBRUST
bool "Rust Runtime Compatibility Static Checker"
default y
depends on SYSTEM_TIME64
depends on FS_LARGEFILE
depends on !SMALL_MEMORY
depends on TLS_NELEM > 0
---help---
This option enables building and linking with Rust language support.
Currently, it only do static checking for the compatibility of structs
between Rust and C side.
30 changes: 30 additions & 0 deletions libs/libc/librust/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
############################################################################
# libs/libc/librust/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

ifeq ($(CONFIG_LIBRUST),y)
# Add the librust C files to the build

CSRCS += lib_rust.c

# Add the librust directory to the build

DEPPATH += --dep-path librust
VPATH += :librust
endif
Loading