-
Notifications
You must be signed in to change notification settings - Fork 4
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
misc improvements #1
base: master
Are you sure you want to change the base?
Conversation
mochaaP
commented
Nov 14, 2024
- deps: bump deps
- shims/linux: perform dlopen exactly once
- build: make cosmos relocatable
- main: declare ImGui backend names
- build: autodetect cosmocc in path
- build: optimize binary
- build: support building with makefile
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.
Thanks, the GL and sokol stuff are cool but the rest are a bit of a personal preference.
.clangd
Outdated
@@ -8,3 +8,7 @@ CompileFlags: | |||
- -std=c11 | |||
- -Ideps/sokol | |||
- -Ideps/cimgui | |||
- -Invapi | |||
- -D_COSMO_SOURCE | |||
- -I/opt/cosmos/include |
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.
My sokol is not in /opt
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.
it's for the cosmocc toolchain, not sokol.
there won't be errors if this is not present on the system.
.clangd
Outdated
- -Invapi | ||
- -D_COSMO_SOURCE | ||
- -I/opt/cosmos/include | ||
- -include libc/integral/normalize.inc |
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.
Is this relative to the project?
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.
without this <cosmo.h> and friends won't work. (missing a few internal macros and typedefs)
clean: | ||
rm -rf $(BUILD_DIR) $(BIN_DIR) | ||
|
||
-include $(DEPS) |
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 a demo so I just use shell script and no build system.
Normally, I don't even use make.
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 added this because I have to use gcc's dependency tracking (so targets get rebuilt when I make change in deps/ or header files). it's just here for convenience :)
@@ -1,24 +1,29 @@ | |||
#!/bin/sh -e | |||
|
|||
if ! command -v cosmocc > /dev/null | |||
COSMOS="${COSMOS:-/opt/cosmos}" |
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 don't have COSMOS set and only add cosmo bin to PATH when needed.
|
||
FLAGS="-I deps/sokol \ | ||
-I deps/cimgui \ | ||
-mcosmo \ | ||
-mtiny \ | ||
-Wall \ | ||
-Werror" |
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.
Please keep this.
case SG_BACKEND_DUMMY: | ||
io->BackendRendererName = "sokol_gfx_dummy"; | ||
break; | ||
} |
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.
Is this necessary? main.c
is just copied from sokol actual example.
.clangd
Outdated
@@ -8,3 +8,7 @@ CompileFlags: | |||
- -std=c11 | |||
- -Ideps/sokol | |||
- -Ideps/cimgui | |||
- -Invapi | |||
- -D_COSMO_SOURCE |
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 manually defined per file, only for cosmo related source.
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 will remove this.
aa91b46
to
584f687
Compare
i have some ideas on macos support: since cross compiling and linking with cocoa is very annoying 1, we could consider building the sokol_app dylib at runtime, provided that we already need to start, we can include a (partially) preprocessed source file of sokol_app in the binary, and copy the compiling logic from dlopen_helper. Footnotes
|