build: fixes for nix on macOS

Add references to frameworks being linked to `buildInputs` in
`default.nix`.  Remove `-framework System` from `wxWidgets_LIBRARIES` in
the cmake code as it's not necessary and nix does it have it in
`darwin.apple_sdk.frameworks`.

TODO:

Debug build currently builds and runs. Release build builds but does not
run because of a problem with the dylib bundling.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2023-10-04 13:19:44 -07:00
parent 7e46939826
commit e17d2cbaf5
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 13 additions and 2 deletions

View File

@ -2,7 +2,7 @@ with import <nixpkgs> {};
stdenv.mkDerivation { stdenv.mkDerivation {
name = "visualboyadvance-m"; name = "visualboyadvance-m";
buildInputs = if stdenv.isDarwin then buildInputs = if stdenv.isDarwin then
[ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 ] [ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL ]
else else
[ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 mesa glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon epoxy dbus at-spi2-core ]; [ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 mesa glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon epoxy dbus at-spi2-core ];
} }

View File

@ -259,7 +259,7 @@ else()
include_directories(${wxWidgets_INCLUDE_DIRS}) include_directories(${wxWidgets_INCLUDE_DIRS})
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$") if(CMAKE_BUILD_TYPE STREQUAL Debug)
# tell wx to enable debug mode if possible, if the cmake module did not do it for us # tell wx to enable debug mode if possible, if the cmake module did not do it for us
execute_process(COMMAND "${wxWidgets_CONFIG_EXECUTABLE} --debug=yes" RESULT_VARIABLE WX_CONFIG_DEBUG OUTPUT_QUIET ERROR_QUIET) execute_process(COMMAND "${wxWidgets_CONFIG_EXECUTABLE} --debug=yes" RESULT_VARIABLE WX_CONFIG_DEBUG OUTPUT_QUIET ERROR_QUIET)
@ -279,6 +279,17 @@ else()
add_compile_options(${CXX_COMPILE_FLAG}) add_compile_options(${CXX_COMPILE_FLAG})
endforeach() endforeach()
# Remove "-framework System" from libs on macOS, it's not necessary and nix doesn't have it.
if(APPLE)
unset(tmp_libs)
foreach(lib ${wxWidgets_LIBRARIES})
if(NOT lib STREQUAL "-framework System")
list(APPEND tmp_libs "${lib}")
endif()
endforeach()
set(wxWidgets_LIBRARIES "${tmp_libs}")
endif()
# set up variables for some compile/run checks for wxWidgets # set up variables for some compile/run checks for wxWidgets
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MY_CXX_FLAGS} ${MY_C_FLAGS} ${MY_CXX_LINKER_FLAGS} ${MY_C_LINKER_FLAGS} ${wxWidgets_LIBRARIES}) set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MY_CXX_FLAGS} ${MY_C_FLAGS} ${MY_CXX_LINKER_FLAGS} ${MY_C_LINKER_FLAGS} ${wxWidgets_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${wxWidgets_CXX_FLAGS} ${MY_CXX_FLAGS} ${MY_C_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${wxWidgets_CXX_FLAGS} ${MY_CXX_FLAGS} ${MY_C_FLAGS})