From 0ea3387b806ba37eb79307477c9f415735d02275 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 14 Jul 2022 18:33:40 -0500 Subject: [PATCH 1/5] cmake: Adjust linkage for macOS This properly links dylibs set during build instead of expecting the libraries to be in the system path. # Conflicts: # src/sdl/CMakeLists.txt --- src/sdl/CMakeLists.txt | 47 ++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 04670bdc8..4e4506932 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -147,37 +147,30 @@ if(${SDL2_FOUND}) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME}) if(${CMAKE_SYSTEM} MATCHES Darwin) - find_library(CORE_LIB CoreFoundation) + find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation") target_link_libraries(SRB2SDL2 PRIVATE - ${CORE_LIB} - SDL2 - SDL2_mixer - ${GME_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} - ${DISCORDRPC_LIBRARIES} + ${CORE_FOUNDATION_LIBRARY} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") - else() - target_link_libraries(SRB2SDL2 PRIVATE - ${SDL2_LIBRARIES} - ${SDL2_MIXER_LIBRARIES} - ${GME_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} - ${DISCORDRPC_LIBRARIES} - ) + endif() - if(${CMAKE_SYSTEM} MATCHES Linux) - target_link_libraries(SRB2SDL2 PRIVATE - m - rt - ) - endif() + target_link_libraries(SRB2SDL2 PRIVATE + ${SDL2_LIBRARIES} + ${SDL2_MIXER_LIBRARIES} + ${GME_LIBRARIES} + ${OPENMPT_LIBRARIES} + ${MIXERX_LIBRARIES} + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${OPENGL_LIBRARIES} + ${CURL_LIBRARIES} + ) + + if(${CMAKE_SYSTEM} MATCHES Linux) + target_link_libraries(SRB2SDL2 PRIVATE + m + rt + ) endif() #target_link_libraries(SRB2SDL2 PRIVATE SRB2Core) From 0f675e93b2225491c2e5ad9b7af4b315fc533536 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 14 Jul 2022 23:32:34 -0500 Subject: [PATCH 2/5] cmake: Fix rpath issues in macOS bundle fixup --- src/sdl/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 4e4506932..0f2a29cfd 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -199,8 +199,6 @@ if(${SDL2_FOUND}) endif() endif() - set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION}) - if(${CMAKE_SYSTEM} MATCHES Windows) target_link_libraries(SRB2SDL2 PRIVATE ws2_32 @@ -271,6 +269,7 @@ if(${SDL2_FOUND}) install(TARGETS SRB2SDL2 BUNDLE DESTINATION . ) + set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON) else() install(TARGETS SRB2SDL2 SRB2SDL2 RUNTIME DESTINATION . From e87650f65388ab0cb1a7709062a5bda311b3df0c Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 14 Jul 2022 23:57:53 -0500 Subject: [PATCH 3/5] cmake: Set plist properties for macOS bundle yay icon --- src/sdl/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 0f2a29cfd..73871c922 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -152,6 +152,16 @@ if(${SDL2_FOUND}) ${CORE_FOUNDATION_LIBRARY} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") + + # Configure the app bundle icon and plist properties + target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns") + set_target_properties(SRB2SDL2 PROPERTIES + MACOSX_BUNDLE_ICON_FILE "Srb2mac" + MACOSX_BUNDLE_BUNDLE_NAME "Sonic Robo Blast 2" + MACOSX_BUNDLE_BUNDLE_VERSION ${SRB2_VERSION} + + RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns" + ) endif() target_link_libraries(SRB2SDL2 PRIVATE From f945c369c7a9fb6aea5da04e2ecbcaa89668e143 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Mon, 18 Jul 2022 18:36:41 -0500 Subject: [PATCH 4/5] cmake: readd discord rpc libraries to link --- src/sdl/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 73871c922..b285eed5b 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -174,6 +174,7 @@ if(${SDL2_FOUND}) ${ZLIB_LIBRARIES} ${OPENGL_LIBRARIES} ${CURL_LIBRARIES} + ${DISCORDRPC_LIBRARIES} ) if(${CMAKE_SYSTEM} MATCHES Linux) From 7de827deb45912d786b0fb2fbc316a82bfc8f24e Mon Sep 17 00:00:00 2001 From: Eidolon Date: Mon, 18 Jul 2022 19:28:52 -0500 Subject: [PATCH 5/5] Fix mac crashes + signal handling --- src/http-mserv.c | 2 +- src/sdl/i_system.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http-mserv.c b/src/http-mserv.c index e925c50d5..919acf330 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -138,7 +138,7 @@ HMS_connect (const char *format, ...) return NULL; } - if (cv_masterserver_token.string[0]) + if (cv_masterserver_token.string && cv_masterserver_token.string[0]) { quack_token = curl_easy_escape(curl, cv_masterserver_token.string, 0); token_length = ( sizeof "&token="-1 )+ strlen(quack_token); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 7ec85e5d6..8cb479b86 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -102,7 +102,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #endif #endif -#if (defined (__unix__) && !defined (_MSDOS)) || defined (UNIXCOMMON) +#if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__)) #include #include #define NEWSIGNALHANDLER