c3lang / c3c

Compiler for the C3 language
https://c3-lang.org
GNU Lesser General Public License v3.0
2.83k stars 172 forks source link

Having exec or just empty type in project.json targets #1577

Open tonis2 opened 5 hours ago

tonis2 commented 5 hours ago

c3c project.json supports having array of exec functions in, but currently the type of targets can only be static-lib or executable, so the compiler shows some errors when trying to use only exec: [] target

Would it make sense to accept empty or exec type parameter there and the compiler would just run exec commands then ?

Example project.json

    "targets": {
        "shaders": {
            "exec": [
                "slangc examples/shader1.slang  -profile glsl_460 -target spirv -o /shaders/shader1.spv",
                                "slangc examples/shader2.slang  -profile glsl_460 -target spirv -o /shaders/shader2.spv"
            ]
        },
           "install": {
            "exec": [
                "scripts/download_dependencies.c3", 
                "scripts/build_something.c3"
            ]
        },
                "cube": {
            "type": "executable",
            "sources": ["examples/cube/main.c3"]
        },
    }
lerno commented 3 hours ago

I didn't think about it, but yes, it makes sense that there would be a target type that doesn't do anything (doesn't compile anything but runs exec etc)