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

[Nim] Bfbs Nim Generator #7534

Merged
merged 41 commits into from Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9cfefce
Bfbs Nim Generator
danlapid Sep 15, 2022
a739546
Remove commented out tests
danlapid Sep 15, 2022
8e0b4c1
add missing line to idl.h
danlapid Sep 15, 2022
7b09a80
Commit python reflection changes
danlapid Sep 15, 2022
92ac716
Commit python reflection changes and move tests
danlapid Sep 15, 2022
61e2ae3
Remove default string addition
danlapid Sep 16, 2022
37e4f4c
Merge branch 'nim_bfbs' of https://github.com/danlapid/flatbuffers in…
danlapid Sep 16, 2022
bf1dcfc
Move tests to python file
danlapid Sep 16, 2022
14c639a
Fix element size check when element is table
danlapid Sep 16, 2022
581ffe1
remove whitespace changes
danlapid Sep 18, 2022
a5278bd
add element_type docs and commit further to namer and remove kkeep
danlapid Sep 20, 2022
cfba8fd
Bfbs Nim Generator
danlapid Sep 15, 2022
c7e8bbf
Remove commented out tests
danlapid Sep 15, 2022
c432b95
add missing line to idl.h
danlapid Sep 15, 2022
b6279dd
Commit python reflection changes
danlapid Sep 15, 2022
fcb84c0
Commit python reflection changes and move tests
danlapid Sep 15, 2022
6fdf6ae
Remove default string addition
danlapid Sep 16, 2022
92c736e
Move tests to python file
danlapid Sep 16, 2022
6e6969b
Fix element size check when element is table
danlapid Sep 16, 2022
8ea3fc8
remove whitespace changes
danlapid Sep 18, 2022
1e16326
add element_type docs and commit further to namer and remove kkeep
danlapid Sep 20, 2022
a371273
Merge branch 'nim_bfbs' of https://github.com/danlapid/flatbuffers in…
danlapid Sep 22, 2022
8e97848
remove unused variables
danlapid Sep 22, 2022
c2657e0
added tests to ci
danlapid Sep 23, 2022
687c070
added tests to ci
danlapid Sep 23, 2022
a256083
Merge branch 'nim_bfbs' of https://github.com/danlapid/flatbuffers in…
danlapid Sep 23, 2022
df9acaf
Merge branch 'nim_bfbs' of https://github.com/danlapid/flatbuffers in…
danlapid Sep 23, 2022
f7a1f38
Merge branch 'nim_bfbs' of https://github.com/danlapid/flatbuffers in…
danlapid Sep 23, 2022
dd88e3e
Merge branch 'nim_bfbs' of https://github.com/danlapid/flatbuffers in…
danlapid Sep 23, 2022
e27f0c4
Merge branch 'nim_bfbs' of https://github.com/danlapid/flatbuffers in…
danlapid Sep 24, 2022
011c237
Merge branch 'master' into nim_bfbs
danlapid Sep 27, 2022
a8c97e1
fixes
danlapid Sep 27, 2022
dbf21aa
Merge branch 'master' into nim_bfbs
danlapid Oct 19, 2022
67a5556
merge
danlapid Oct 19, 2022
bdf5e59
Merge branch 'master' into nim_bfbs
danlapid Oct 21, 2022
38eef94
Added reflection type Field, Variable to namer
danlapid Oct 21, 2022
aa3fd9e
Moved reflection namer impl to bfbsnamer
danlapid Oct 21, 2022
368fd21
Remove whitespace at end of line
danlapid Oct 21, 2022
39aeae1
Added nim to generated code
danlapid Oct 21, 2022
e6dacdf
Revert whitespace removal
danlapid Oct 21, 2022
c01cd09
Merge branch 'master' into nim_bfbs
dbaileychess Oct 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/labeler.yml
Expand Up @@ -18,6 +18,12 @@ swift:
- tests/swift/**
- src/idl_gen_swift.cpp

nim:
- '**/*.nim'
- nim/**/*
- src/idl_gen_nim.cpp
- src/bfbs_gen_nim.cpp

javascript:
- '**/*.js'
- src/idl_gen_ts.cpp
Expand Down Expand Up @@ -61,7 +67,7 @@ rust:
- '**/*.rs'
- rust/**/*
- src/idl_gen_rust.cpp

dart:
- '**/*.dart'
- src/idl_gen_dart.cpp
Expand All @@ -88,4 +94,4 @@ CI:

grpc:
- grpc/**/*
- src/idl_gen_grpc.cpp
- src/idl_gen_grpc.cpp
40 changes: 21 additions & 19 deletions CMakeLists.txt
Expand Up @@ -71,10 +71,10 @@ option(FLATBUFFERS_ENABLE_PCH
Only work if CMake supports 'target_precompile_headers'. \"
This can speed up compilation time."
OFF)
option(FLATBUFFERS_SKIP_MONSTER_EXTRA
option(FLATBUFFERS_SKIP_MONSTER_EXTRA
"Skip generating monster_extra.fbs that contains non-supported numerical\"
types." OFF)
option(FLATBUFFERS_STRICT_MODE
option(FLATBUFFERS_STRICT_MODE
"Build flatbuffers with all warnings as errors (-Werror or /WX)."
OFF)

Expand Down Expand Up @@ -182,13 +182,15 @@ set(FlatBuffers_Compiler_SRCS
src/flatc_main.cpp
src/bfbs_gen.h
src/bfbs_gen_lua.h
src/bfbs_gen_nim.h
src/bfbs_namer.h
include/flatbuffers/code_generators.h
src/binary_annotator.h
src/binary_annotator.cpp
src/annotated_binary_text_gen.h
src/annotated_binary_text_gen.cpp
src/bfbs_gen_lua.cpp
src/bfbs_gen_nim.cpp
src/code_generators.cpp
grpc/src/compiler/schema_interface.h
grpc/src/compiler/cpp_generator.h
Expand Down Expand Up @@ -352,8 +354,8 @@ include_directories(grpc)

# Creates an interface library that stores the configuration settings that each
# target links too. This is a compromise between setting configuration globally
# with add_compile_options() and the more targetted target_compile_options().
# This way each target in this file can share settings and override them if
# with add_compile_options() and the more targetted target_compile_options().
# This way each target in this file can share settings and override them if
# needed.
add_library(ProjectConfig INTERFACE)
target_compile_features(ProjectConfig
Expand All @@ -369,7 +371,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)

if(MSVC_LIKE)
target_compile_options(ProjectConfig
INTERFACE
INTERFACE
/W4
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
/WX # Treat all compiler warnings as errors
Expand Down Expand Up @@ -401,8 +403,8 @@ else()
-Wno-error=stringop-overflow
>
>
-pedantic
-Wextra
-pedantic
-Wextra
-Wno-unused-parameter
-Wold-style-cast
-fsigned-char
Expand All @@ -416,7 +418,7 @@ else()
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,3.8>:
-Wimplicit-fallthrough
-Wextra-semi
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
-Werror=unused-private-field
>
>
Expand All @@ -425,15 +427,15 @@ else()
$<$<CXX_COMPILER_ID:GNU>:
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.4>:
-Wunused-result
-Wunused-parameter
-Wunused-parameter
danlapid marked this conversation as resolved.
Show resolved Hide resolved
-Werror=unused-parameter
-Wmissing-declarations
>
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.7>:
-Wzero-as-null-pointer-constant
>
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,7.0>:
-faligned-new
-faligned-new
$<$<BOOL:${FLATBUFFERS_STRICT_MODE}>:
-Werror=implicit-fallthrough=2
>
Expand Down Expand Up @@ -463,7 +465,7 @@ if(FLATBUFFERS_BUILD_FLATLIB)
add_library(flatbuffers STATIC ${FlatBuffers_Library_SRCS})

# Attach header directory for when build via add_subdirectory().
target_include_directories(flatbuffers
target_include_directories(flatbuffers
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
Expand All @@ -481,7 +483,7 @@ if(FLATBUFFERS_BUILD_FLATC)
endif()

target_link_libraries(flatc PRIVATE $<BUILD_INTERFACE:ProjectConfig>)
target_compile_options(flatc
target_compile_options(flatc
PUBLIC
$<$<AND:$<BOOL:${MSVC_LIKE}>,$<CONFIG:Release>>:
/MT
Expand Down Expand Up @@ -682,13 +684,13 @@ if(FLATBUFFERS_BUILD_GRPCTEST)
find_package(gRPC CONFIG REQUIRED)
add_executable(grpctest ${FlatBuffers_GRPCTest_SRCS})
add_dependencies(grpctest generated_code)
target_link_libraries(grpctext
PRIVATE
target_link_libraries(grpctext
PRIVATE
$<BUILD_INTERFACE:ProjectConfig>
gRPC::grpc++_unsecure
gRPC::gpr
gRPC::grpc++_unsecure
gRPC::gpr
pthread
dl
dl
)
endif()

Expand All @@ -701,8 +703,8 @@ if(FLATBUFFERS_INSTALL)

configure_file(CMake/flatbuffers-config-version.cmake.in flatbuffers-config-version.cmake @ONLY)
install(
FILES
"CMake/flatbuffers-config.cmake"
FILES
"CMake/flatbuffers-config.cmake"
"CMake/BuildFlatBuffers.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-config-version.cmake"
DESTINATION ${FB_CMAKE_DIR}
Expand Down
1 change: 1 addition & 0 deletions include/flatbuffers/idl.h
Expand Up @@ -653,6 +653,7 @@ struct IDLOptions {
kRust = 1 << 14,
kKotlin = 1 << 15,
kSwift = 1 << 16,
kNim = 1 << 17,
kMAX
};

Expand Down
7 changes: 7 additions & 0 deletions nim/flatbuffers.nimble
@@ -0,0 +1,7 @@
version = "2.0.8"
author = "flatbuffers"
description = "Flatbuffers"
license = "Apache 2.0"
srcDir = "flatbuffers"

requires "nim >= 1.4.0"
7 changes: 7 additions & 0 deletions nim/flatbuffers/flatbuffers.nim
@@ -0,0 +1,7 @@
import
src/[
builder,
struct,
table
]
export flatbuffers.builder, flatbuffers.table, flatbuffers.struct