-
Notifications
You must be signed in to change notification settings - Fork 435
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
Use leanc
written in Lean for testing & distribution
#687
Conversation
6855d0a
to
3475698
Compare
building is still handled by a (minimal) Bash script for bootstrapping purposes
@@ -325,7 +325,7 @@ endif() | |||
# are already loaded) and probably fail unless we set up LD_LIBRARY_PATH. | |||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | |||
# import library created by the `leanshared` target | |||
set(LEANC_SHARED_LINKER_FLAGS "${LEANC_SHARED_LINKER_FLAGS} $bindir/libleanshared.dll.a") | |||
set(LEANC_SHARED_LINKER_FLAGS "${LEANC_SHARED_LINKER_FLAGS} -lleanshared") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why cant this library dependency be a cmake target DEPENDS ? is it because "leanshared" is not a cmake "add_library" somewhere? If so, why isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flag is baked into leanc
, i.e. user programs are linked with it as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way the title of this PR confuses me, "testing & distribution", isn't stdlib.make a central part of the regular build too? What does "distribution" mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Distribution means what we ship to users, i.e. the release tarballs created by cpack
if args.isEmpty then | ||
IO.println "Lean C compiler | ||
|
||
A simple wrapper around a C compiler. Defaults to `@LEANC_CC@`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool, are you moving bash shell scripts to lean? That's awesome, and will make one day building on windows easier right? Do we still need nix if we use Lean like this? Is this what Lake is ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$LEAN_CC "${cflags[@]}" "${args[@]}" "${ldflags_ext[@]}" "${ldflags[@]}" -Wno-unused-command-line-argument | ||
# used only for building Lean itself | ||
root=$(dirname $0) | ||
${LEAN_CC:-@CMAKE_C_COMPILER@} "-I$root/include" @LEANC_EXTRA_FLAGS@ "$@" "-L$root/lib/lean" "${LEANC_GMP:--lgmp}" @LEAN_EXTRA_LINKER_FLAGS@ -Wno-unused-command-line-argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really still need this leanc.sh then? Can't we just move this line into the place that calls it? I think that's only stdlib.make.in right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, yes. It wouldn't exactly be pretty, and it makes it easier to communicate the flags to Nix.
@Kha looking at the simplicity of In order to keep things in sync, the built-in settings for Also, it seems to me like |
I considered it, but I didn't really see the point. Unless process creation on Windows is that slow. |
@Kha In my view, such a solutions provides the following benefits:
|
We can reevaluate the design when |
@Kha Fair enough. However, I did come up with one more reason in the meantime. I'll put it here so I don't forget it. One of the changes on my list is to make the compiler a target as well. This will make its hash part of the trace of targets which use it. Thus, they will be automatically rebuilt when the compiler binary changes. However, the hash of the current Just something to keep in mind for the future. |
Ok, makes sense |
This makes the `a b c` in `cases' foo with a b c` get hovers and syntax highlighting for the variables that were introduced.
Building is still handled by a (minimal) Bash script for bootstrapping purposes