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

Add devshell for nix under macOs #135

Open
wants to merge 1 commit into
base: oxce-plus
Choose a base branch
from

Conversation

vkravets
Copy link

@vkravets vkravets commented Jan 6, 2025

This PR added devshel under nix macOs and can be adopded in future for the linux with nix.

nix develop -c $SHELL

After this command enter to shell where all dependecies and configuration to build already defined.

README-OSX.md has beeen updated also.

This PR also added USE_SDL2 options which turn on by default on apple.
Under brew (which is default build on macOs and easiest ) leagcy SDL is not avalaible and only sdl12-compat is available. Also there is deprecation for sdl-mixer and sdl-gfx but it's only disabled and can be enabled via brew edit, so I don't touch enything about it in this PR.

@vkravets
Copy link
Author

vkravets commented Jan 6, 2025

As aditional for the #123

set ( SDLGFX_LIBRARY SDL_gfx )
set ( SDLMIXER_LIBRARY SDL_mixer )
set ( SDLIMAGE_LIBRARY SDL_image )
set ( PKG_DEPS_LDFLAGS ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${SDLGFX_LIBRARY} ${SDL_LIBRARY} ${OPENGL_LIBRARIES} )
set ( PKG_DEPS_LDFLAGS ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${SDLGFX_LIBRARY} ${SDL_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} )
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this SDL2 added to the dependecies list which trigger copy of it to macos Frameworks library

@@ -110,7 +129,7 @@ elseif(UNIX OR MINGW OR CYGWIN)

include_directories(${PKG_SDL_INCLUDE_DIRS} ${PKG_ZLIB_INCLUDE_DIRS} ${PKG_SDLIMAGE_INCLUDE_DIRS})
include_directories(${PKG_SDLGFX_INCLUDE_DIRS} ${PKG_SDLMIXER_INCLUDE_DIRS})
set(PKG_DEPS_LDFLAGS ${PKG_SDL_LDFLAGS} ${PKG_ZLIB_LDFLAGS} ${PKG_SDLIMAGE_LDFLAGS} ${PKG_SDLGFX_LDFLAGS} ${PKG_SDLMIXER_LDFLAGS} ${OPENGL_LIBRARIES})
set(PKG_DEPS_LDFLAGS ${PKG_SDL_LDFLAGS} ${PKG_SDL2_LDFLAGS} ${PKG_ZLIB_LDFLAGS} ${PKG_SDLIMAGE_LDFLAGS} ${PKG_SDLGFX_LDFLAGS} ${PKG_SDLMIXER_LDFLAGS} ${OPENGL_LIBRARIES})
Copy link
Author

@vkravets vkravets Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using all dependecies of SDL2, which trigger copy of webp and etc libraries which is needed for runtime work

Comment on lines +48 to +49
#SDL_mixer
# SDL_image
# SDL_gfx
Copy link
Author

@vkravets vkravets Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This old libraries avalaible for SDL1, using it teh sound and the software rendering is not working, only OpenGL works and there is no video support also

# Try to build using SDL12_compat
(SDL_compat.overrideAttrs (old: {
postInstall = ''
ln -s $out/lib/pkgconfig/sdl12_compat.pc $out/lib/pkgconfig/sdl.pc
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workaround to have working dependecies checking in cmake flow.

Note: The same behavior done in the brew formula

@vkravets vkravets force-pushed the macos_nix_devshell branch from 6e12068 to 6ff84ea Compare January 6, 2025 15:02
flake.nix Outdated

# Need to use brew cmake since nix use old one 3.30.5
# which has issues with copy libraries to macOs app
#cmake
Copy link
Author

@vkravets vkravets Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is issue with cmake for the new macOs due to libSystem shared library which is not exists under filesystem anymore due to cmake while generate macOs appication(directory) cannot copy this library to it.

Brew cmake already updated and doesn't have this issue.

Nix has already update the cmake, but it's not avalaible for now.
We can wait and merge when it will be updated in at least under unstable nixpkgs, since I'm using it in flake.nix

NixOS/nixpkgs#363395
Merged yesterday

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.

1 participant