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

SDL build #346

Draft
wants to merge 39 commits into
base: master
Choose a base branch
from
Draft

SDL build #346

wants to merge 39 commits into from

Conversation

bobsayshilol
Copy link

@bobsayshilol bobsayshilol commented Oct 15, 2022

This PR gets engine-sim building on both Linux and Mac Edit: Mac isn't fully complete (though Mac doesn't run due to lack of GL support). Windows was tested and still builds and runs (for me).

Main changes include:

  • Compilation fixes
  • Data location can be set via cmake and overridden at runtime to support "run anywhere" behaviour
  • XDG support for adding custom engines without having to touch the original data
  • Versioning managed via cmake
  • Native discord support rather than prebuilt Windows+Release-only lib

This is intended to replace #112 and address #2.

The work couldn't have been done without the help of those on the discord server.

Note: currently in draft since it's blocked waiting on ange-yaghi/delta-studio#37.

@xirtus
Copy link

xirtus commented Dec 10, 2022

ok this is towards the direction of what I want to see, but I think it could be done all in Cabbage as a VST audio plugin for DAW and standalone that way, Maybe this should be it's own pulldown request but I want to use this to make music and would love to help

constexpr is for values known at compile time so there's no reason for
these to be extern since they can't be defined externally.
These work on all platforms rather than \ which only works on Windows.
I'm not 100% sure why GCC wants this but it has something to do with
aggregate initialisation (= {}) and default values for members.
This is never called and GCC warns that the Type template on the method
conflicts with the Type template on the class.
GCC picks up the static_assert(false) even if the template isn't
instantiated, and =delete-ing the method has the same effect of
notifying the caller if it's not specialised later in this header.

Also remove extraneous extern that GCC doesn't like.
These are presumably pulled in by other stdlib headers on Windows.
start() is a function so this check was wrong, however it looks like
this method is never called so it's probably not been an issue.
powf() is a C function but std::pow() is the thin C++ wrapper that
delegates to pow(), powf(), or powl() dependent on argument type.
Most of these are already acting on floats, and those that aren't have
been fixed up to do so.
This currently links to a prebuilt Windows library which we can't use
on Linux.
Also add missing include.
This is an odd fix, but it works and means that symbols in engine-sim
don't disappear.
This will allow us to provide a writeable area for users where custom
engines can be placed, while also keeping the shipped data immutable.
This way we can redirect the errors to wherever we want, which in this
case is just a different file.
ENGINESIM_DATA_ROOT was suggested so I'll use that.
This way we can bake in where we expect to look for data.
Also add the platform to it, because why not.
Without this an assert fires in debug and we get a leak.
Most of the big leaks are dealt with now.
This way it'll Just Work on Linux, Mac, and Debug Windows (since the
prebuild was only for Release Windows).
DetachErrorHandler() isn't implemented and I cba to add it right now so
this probably leaks.
clang complains about these since other methods on these classes have
override and it wants you to be consistent.
clang warns about this because a value of 1.1f is assigned to the max,
and the code using min and max always appears to compare it against a
float anyway.
This can cause an infinite loop when compiling with GCC or clang since
the target of the loop can be overwritten due to indexing out of bounds.
This assumes the number of cylinders is 8, which it might not be.
This can cause issues on certain platforms.
@UnBeatWaterGH
Copy link

Mac may run under Rosetta. Just maybe. Since, I have had luck building OpenGL software on Mac M1 through Rosetta (Also sometimes may work without)

@y4my4my4m
Copy link

make[2]: *** [dependencies/submodules/delta-studio/CMakeFiles/delta-core.dir/build.make:76: dependencies/submodules/delta-studio/CMakeFiles/delta-core.dir/src/yds_animation_action.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:581: dependencies/submodules/delta-studio/CMakeFiles/delta-core.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

This is what I get when trying to make.

This allows the code to build since it brings in fixes that those
submodules need merging.
@bobsayshilol
Copy link
Author

make[2]: *** [dependencies/submodules/delta-studio/CMakeFiles/delta-core.dir/build.make:76: dependencies/submodules/delta-studio/CMakeFiles/delta-core.dir/src/yds_animation_action.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:581: dependencies/submodules/delta-studio/CMakeFiles/delta-core.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

This is what I get when trying to make.

That doesn't show the error that make failed with, but considering that it's happening in delta-studio I think you need to run git submodule update --init --recursive after checking out this branch to update the submodules to the fixed versions.

@y4my4my4m
Copy link

@bobsayshilol that is my bad. I was on your fork but on master branch by accident, not the sdl-build branch. I've updated the submodules too just in case.

I was able to compile and it runs, unfortunately the audio is buggy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants