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

Making the src-gen folder more stand-alone #1677

Closed
edwardalee opened this issue Mar 28, 2023 · 1 comment · Fixed by #2036
Closed

Making the src-gen folder more stand-alone #1677

edwardalee opened this issue Mar 28, 2023 · 1 comment · Fixed by #2036
Labels
build system compiler enhancement Enhancement of existing feature good first issue Good for newcomers

Comments

@edwardalee
Copy link
Collaborator

The src-gen folder currently generated by lfc does not quite contain enough information to build the generated C code. To reproduce:

cd test/C
lfc src/Minimal.lf
cd src-gen/Minimal
rm -rf build
mkdir build
cd build
cmake ../
make

This fails with

/Users/eal/lingua-franca-intellij/test/C/src-gen/Minimal/core/../include/core/platform.h:50:2: error: Must define either LF_UNTHREADED or LF_THREADED runtime
#error Must define either LF_UNTHREADED or LF_THREADED runtime
 ^
1 error generated.

In order to get the program to build, you have issue the following incantation:

cmake -DLF_REACTION_GRAPH_BREADTH=1 -DLF_THREADED=1 -DNUMBER_OF_WORKERS=0 -DSCHEDULER=NP -DLOG_LEVEL=2 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Users/eal/lingua-franca-intellij/test/C -DCMAKE_INSTALL_BINDIR=bin ../

@erlingrj suggested that a simple solution would be to write the default/provided target properties to both CMakeLists.txt and CompileDefinitions.txt. We can put the variables behind statements like this:

if (NOT DEFINED NUMBER_OF_WORKERS)
  set(NUMBER_OF_WORKERS 42 )
endif()

This way we get (1) plug-and-play integration with cmake, (2) easy to extend to other build system because the info is also readily available in CompileDefinitions.txt and (3) change target properties without rebuilding by changing passing arguments to cmake.

@edwardalee edwardalee added enhancement Enhancement of existing feature good first issue Good for newcomers compiler build system labels Mar 28, 2023
@erlingrj
Copy link
Collaborator

Now that the compiler generates vscodes files I would say that this is less of an issue. But still would be a nice feature. In fact, it might make the generation of vscode files redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system compiler enhancement Enhancement of existing feature good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants