-
Notifications
You must be signed in to change notification settings - Fork 96
Add devshell for nix under macOs #135
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
base: oxce-plus
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then | ||
| source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" | ||
| fi | ||
|
|
||
| use flake . --impure |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,12 @@ option ( ENABLE_CLANG_ANALYSIS "When building with clang, enable the static anal | |
| option ( CHECK_CCACHE "Check if ccache is installed and use it" OFF ) | ||
| set ( MSVC_WARNING_LEVEL 3 CACHE STRING "Visual Studio warning levels" ) | ||
| option ( FORCE_INSTALL_DATA_TO_BIN "Force installation of data to binary directory" OFF ) | ||
| if ( APPLE ) | ||
| # Use by default since brew doesn't have legacy SDL1, sdl12-compat avalaible | ||
| option ( USE_SDL2 "Using SDL2 via SDL12 compatible layer" ON ) | ||
| else () | ||
| option ( USE_SDL2 "Using SDL2 via SDL12 compatible layer" OFF ) | ||
| endif () | ||
| set ( DATADIR "" CACHE STRING "Where to search for datafiles" ) | ||
|
|
||
| if ( CHECK_CCACHE ) | ||
|
|
@@ -91,17 +97,30 @@ if(NOT UNIX AND IS_DIRECTORY ${DEPS_DIR}) | |
| else ( ) | ||
| link_directories ( ${DEPS_DIR}/lib/Win32 ) | ||
| endif() | ||
| set( SDL_LIBRARY SDL ) | ||
| set ( SDL_LIBRARY SDL ) | ||
| if ( USE_SDL2 ) | ||
| # explicitly added SDL2 as dependency since needed for runtime work | ||
| set ( SDL2_LIBRARY SDL2 ) | ||
| message ( STATUS "Using SDL2 via SDL12 compatible layer" ) | ||
| else ( ) | ||
| set ( SDL2_LIBRARY "") | ||
| endif () | ||
| 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} ) | ||
| elseif(UNIX OR MINGW OR CYGWIN) | ||
| if(IS_DIRECTORY ${DEPS_DIR}) | ||
| set(ENV{PKG_CONFIG_PATH} "${DEPS_DIR}/lib/pkgconfig/") | ||
| endif() | ||
|
|
||
| include(FindPkgConfig) | ||
| if ( USE_SDL2 ) | ||
| # explicitly added SDL2 as dependency since needed for runtime work | ||
| pkg_check_modules(PKG_SDL2 REQUIRED sdl2) | ||
| else ( ) | ||
| set ( PKG_SDLG2_LDFLAGS "" ) | ||
| endif () | ||
| pkg_check_modules(PKG_SDL REQUIRED sdl) | ||
| pkg_check_modules(PKG_ZLIB REQUIRED zlib) | ||
| pkg_check_modules(PKG_SDLIMAGE REQUIRED SDL_image) | ||
|
|
@@ -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}) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| if (UNIX) | ||
| set(PKG_DEPS_LDFLAGS "${PKG_DEPS_LDFLAGS};dl") | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| { | ||
| inputs = { | ||
| systems.url = "github:nix-systems/default"; | ||
| nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | ||
| }; | ||
|
|
||
| outputs = | ||
| { | ||
| self, | ||
| nixpkgs, | ||
| systems, | ||
| }: | ||
| let | ||
| forEachSystem = | ||
| f: nixpkgs.lib.genAttrs (import systems) (system: f { pkgs = import nixpkgs { inherit system; }; }); | ||
| in | ||
| { | ||
| devShells = forEachSystem ( | ||
| { pkgs }: | ||
| { | ||
| default = | ||
| pkgs.mkShell.override | ||
| { | ||
| # override clang 16 runtime | ||
| stdenv = pkgs.lowPrio pkgs.llvmPackages_16.stdenv; | ||
| } | ||
| { | ||
| propagatedBuildInputs = [ | ||
| pkgs.SDL_compat | ||
| pkgs.SDL_image | ||
| pkgs.libwebp | ||
| ]; | ||
|
|
||
| buildInputs = with pkgs; [ | ||
| git | ||
| pkg-config | ||
| apple-sdk_15 | ||
|
|
||
| # Need to use brew cmake since nix use old one 3.30.5 | ||
| # which has issues with copy libraries to macOs app | ||
| cmake | ||
| # use clang explicitly since don't use cmake | ||
| clang_16 | ||
| # OpenXcom dependecies | ||
| rapidyaml | ||
| zlib | ||
| #SDL_mixer | ||
| # SDL_image | ||
| # SDL_gfx | ||
|
Comment on lines
+47
to
+49
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| ''; | ||
| })) | ||
| (SDL_mixer.override (old: { | ||
| SDL = SDL_compat; | ||
| smpeg = old.smpeg.override { | ||
| SDL = SDL_compat; | ||
| }; | ||
| })) | ||
| (SDL_gfx.override (old: { | ||
| SDL = SDL_compat; | ||
| })) | ||
| ( | ||
| (SDL_image.override (old: { | ||
| SDL = SDL_compat; | ||
| })).overrideAttrs | ||
| (old: { | ||
| propagatedBuildInputs = [ SDL_compat ]; | ||
| src = pkgs.fetchurl { | ||
| url = "https://github.com/libsdl-org/SDL_image/archive/refs/heads/SDL-1.2.tar.gz"; | ||
| hash = "sha256-ytt87YL2zrvLun7bi5Jd4m5N7/UR09Y3I1kRDAqf6nQ="; | ||
| }; | ||
| patches = [ ]; | ||
| }) | ||
| ) | ||
| ]; | ||
| }; | ||
| } | ||
| ); | ||
| }; | ||
| } | ||
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.
Using this SDL2 added to the dependecies list which trigger copy of it to macos Frameworks library