Giter Club home page Giter Club logo

Comments (6)

floooh avatar floooh commented on August 29, 2024

PS: this should be an alternative way for non-.py file extensions. fips_generate() would basically associate a specific file (e.g. bla.xml, blub.png) with a Python generator script under fips-generators/. Fips would then create a custom build target for this the same way it would if a .py file would be provided.

from fips.

code-disaster avatar code-disaster commented on August 29, 2024

With Oryol you add both the .shd files and the generated sources to source control. This itself isn't such a big issue, but I wonder how difficult it would be with CMake to generate sources into some intermediate build folder, without losing any benefits.

For example, the build system I've used in the past (https://github.com/code-disaster/lace-build) can write generated code too, but for some chicken-and-egg reasons they were not added to the IDE project files. Only the include path was added to the compile flags. This caused the symbols to not be available in the IDE, which was kind of counter-productive.

Of course one could simply setup a naming convention, and then .gitignore the generated files...

from fips.

floooh avatar floooh commented on August 29, 2024

Yes good idea, I've been thinking about that as well, for instance the glfw cmake files generate a config.h header somewhere in the cmake build directory structure. The generated files would still have to be added to the project but not among the normal source files, but probably in the generator build target.

First thing however is that I want to have this fips_generate() macro, which takes the name of a python code generator, one or more input files, and one or more output files, e.g. for Oryol's shader system this would be:

fips_generate(ShaderLibrary bla.shd "bla.cc;bla.h")

This way the output isn't restricted anymore to exactly one .cc and one .h file, cmake has all the information to setup file dependencies correctly, and the output file extensions are no longer hardcoded to .cc and .h and the current bla.py can be removed.

from fips.

floooh avatar floooh commented on August 29, 2024

Hmm, just stumbled over a problem when trying to move the generated files out of the source tree. I can't find a simple/intuitive way to automatically setup header search paths. I will keep them in the source tree, but move them into an IDE sub folder so that they are out of the way (that's what I found most confusing, instead of just a shader.shd file in the IDE, there's also a shader.py, shader.cc and shader.h file. The generated files will still be available in the IDE.

As for inclusion in version control: I think I will just keep them in there, since updating .gitignore, or having some naming convention for the generated files and .gitignore them with a pattern isn't very nice either. I can't currently think of a downside of adding them to version control, generated files will only change if the source .py file changes, or the VERSION stamp of the generator script is updated, so they wont show up as modified in version control without a reason.

from fips.

floooh avatar floooh commented on August 29, 2024

PS: of course I could just put all generated files into one directory, but this would cause naming collisions (e.g. all samples have the same filename for the shader files), also I can't use auto-generated names (e.g. GUIDs) since the generated headers must still have a humen readable name since they must be included elsewhere in the code.

from fips.

floooh avatar floooh commented on August 29, 2024

This is now merged into master. I had to move the generated source files back into the source tree (and for now also under version control, will open a new ticket for this), because setting up header search paths for generated files in dependent projects which import projects with code generation wasn't doable without lots of hacks and assumptions about project structure.

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.