GithubHelp home page GithubHelp logo

Comments (3)

jamescourtney avatar jamescourtney commented on May 28, 2024 1

Hey there. I apologize for my delay. I did see your earlier message, but life happened this week and I didn't have time to respond.

So, you're close to the mark here. The problem is that you're telling FlatSharp to process everything twice. I suggest putting the shared schemas into their own folder and only including that in the common project:

<PropertyGroup>
  <FlatSharpClassDefinitionsOnly>true</FlatSharpClassDefinitionsOnly>
</PropertyGroup>

<ItemGroup>
  <FlatSharpSchema Include="Schemas\Shared\**\*.fbs">
    <IncludePath>Schemas\</IncludePath>
  </FlatSharpSchema>
</ItemGroup>

Then the specific schemas that reference those shared ones need their own folder as well:

<ItemGroup>
  <ProjectReference Include="..\pkNX.Structures.FlatBuffers.Shared\pkNX.Structures.FlatBuffers.Shared.csproj" />
</ItemGroup>

<PropertyGroup>
  <FlatSharpDeserializers>GreedyMutable</FlatSharpDeserializers>
  <FlatSharpInputFilesOnly>true</FlatSharpInputFilesOnly>
</PropertyGroup>

<ItemGroup>
  <FlatSharpSchema Include="Schemas\Specific\**\*.fbs">
    <IncludePath>Schemas\</IncludePath>
    <IncludePath>..\pkNX.Structures.FlatBuffers.Shared\Schemas\Shared\</IncludePath>
  </FlatSharpSchema>
</ItemGroup>

This leads to the common project having the shared class definitions, but no serializers and the specific project having serializers for its types and the common types, but no class definitions for the common types.

Hope that makes sense. LMK if you need more help. I'm happy to share a fuller example.

from flatsharp.

duckdoom4 avatar duckdoom4 commented on May 28, 2024

So the files are already in a different physical folder, but I tried to use the method you layed out above and it's still not working. I think there may be a deeper underlaying issue. I will try with a simple setup to see if I can get this to work and then try to figure out what breaks it. I think it's caused by multi-layered includes

from flatsharp.

duckdoom4 avatar duckdoom4 commented on May 28, 2024

🎉 My mistake it's working perfectly fine. I had a duplicate flatbuffer in the main project. (so both main and shared had the same flatbuffer definition, but placed at a different physical disk location)

include "Math/Vec3f.fbs";

namespace pkNX.Structures.FlatBuffers;

table AABB {
    Min: Vec3f;
    Max: Vec3f;
}

Had a copy both in shared/Schemas/ and main/Schemas/

from flatsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.