Giter VIP home page Giter VIP logo

Comments (10)

mgerhardy avatar mgerhardy commented on June 14, 2024

used this line btw.
fips_generate(FROM monster.fbs TYPE FlatC HEADER monster_generated.h)

but i still get src/server/monster.cc and src/server/monster.h generated.

https://github.com/google/flatbuffers/blob/master/samples/monster.fbs

from fips.

mgerhardy avatar mgerhardy commented on June 14, 2024

and another btw. flatc is put into a directory like this:
/home/mattn/dev/fips-deploy/Project/linux-make-debug/flatc

fips_project(flatbuffers) doesn't help - a whole fips_setup() fips_finish() cycle inside a dependency doesn't work of course, too.

from fips.

floooh avatar floooh commented on June 14, 2024

I'll play around with this a bit in the next days. I haven't thought of the case that a tool needed for code generation needs to be compiled first, but the bgfx shader compiler is a similar situation. I think the best solution is a new fips target type (fips_begin_tool / fips_end_tool or so...), and then either compile this during the cmake run (cmake does this too for checking whether the C compiler works), or run it as a pre-build-step before code generation...

from fips.

code-disaster avatar code-disaster commented on June 14, 2024

I have some experimental build running, because I've seen your module and want to learn more about flatbuffers.

So far I changed CMakeLists.txt to build flatc as a fips project if run from ./fips-flatbuffers:

if (NOT FIPS_PROJECT_DIR)
    message("Building 'flatc' compiler ...")
    cmake_minimum_required(VERSION 2.8)
    get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
    include("${FIPS_ROOT_DIR}/cmake/fips.cmake")
    set(FIPS_EXCEPTIONS ON)
    fips_setup()
    fips_project(flatbuffers)
    fips_begin_app(flatc cmdline)
... includes and source files omitted ...
    fips_end_app()
    fips_finish()
else()
    # todo: setup for projects *using* fips-flatbuffers
endif()

What's missing is how to point the generator to the flatc binary. Right now I hacked the generator to point to the fips-deploy folder.

Building a code generation tool as part of the project itself would be very nice though. In this case, I'm not sure if fips already supports to enable/disable exceptions per application (flatc requires them).

from fips.

floooh avatar floooh commented on June 14, 2024

I've been thinking about this a bit but haven't done any 'coding' yet. The advantage of building tools as pre-build-step is that it just happens automatically for the first build. But there are a few problems:

  1. as you found out: specific compile settings which are needed for the build tool, but not for the project
  2. cross-compiling: when cmake is started with a toolchain-file for cross-compiling, but the tools must still be compiled natively for the host platform (don't even know whether this is possible with cmake)
  3. a good place for the compiled tools would be the ${CMAKE_BINARY_DIR}, which is the top-level build directory, this is the same for the entire project

If this is too tricky to solve (esp (2)), then a separate './fips build-tools' action would be a fairly clean solution. You would still define tools inside a fips_begin_tool()/fips_end_tool() macro, but this would be ignored during normal builds, and vice versa, when building tools, all other fips_begin_xxx/fips_end_xxx would be ignored.

Currently in oryol, I simply have checked in precompiled tools for Windows/OSX/Linux, this would be the least elegant solution for fips-flatbuffers.

from fips.

mgerhardy avatar mgerhardy commented on June 14, 2024

Maybe the best would be to build tools 'outside' of fips - just triggering the cmake based build and put the resulting binary into CMAKE_INSTALL_PREFIX/bin

The point here is that this should even be extended to tools that don't use cmake as build system, but e.g. are Makefile based.

fips itself would then 'only' be used for cloning the repo and prodiving the py generators.

from fips.

mgerhardy avatar mgerhardy commented on June 14, 2024

I changed this to add precompiled flatc binaries for linux and windows. Would be glad if someone could maybe provide a mac binary for flatc and maybe provide a pull request.

from fips.

mgerhardy avatar mgerhardy commented on June 14, 2024

thanks for the osx binary - should this stay open? I mean, the points is imo still valid.

from fips.

floooh avatar floooh commented on June 14, 2024

I would prefer a new ticket since I'm having trouble figuring out what exactly is needed :) Is it a better way to integrate tool compilation, or a better way to integrate pre-built tools, or more freedom in specifying the target file locations?

from fips.

floooh avatar floooh commented on June 14, 2024

Some new discussion here: floooh/fips-bgfx#4, had the idea of separate subprojects, with the build targets below... not sure yet whether this overcomplicates things though.

from fips.

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.