From 5a9c05656df211d37cf84229f8ac66ed49295243 Mon Sep 17 00:00:00 2001 From: Orazio <22700499+orazioedoardo@users.noreply.github.com> Date: Mon, 31 Jul 2023 11:54:07 +0200 Subject: [PATCH 1/4] Add libs search paths to CMakeLists.txt instead of find files --- CMakeLists.txt | 2 ++ CMakeModules/FindSDL2.cmake | 1 - CMakeModules/FindSDL2_mixer.cmake | 9 ++------- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d77ee6..0033946 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ if(APPLE) set(CMAKE_BUILD_WITH_INSTALL_RPATH true) set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") + list(APPEND SDL2_PATH "${CMAKE_CURRENT_LIST_DIR}/extern") + list(APPEND SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/extern") endif() # SDL2main is not needed diff --git a/CMakeModules/FindSDL2.cmake b/CMakeModules/FindSDL2.cmake index 91181c4..dfaaa17 100644 --- a/CMakeModules/FindSDL2.cmake +++ b/CMakeModules/FindSDL2.cmake @@ -77,7 +77,6 @@ SET(SDL2_SEARCH_PATHS /opt/csw # Blastwave /opt ${SDL2_PATH} - ${CMAKE_SOURCE_DIR}/extern ) FIND_PATH(SDL2_INCLUDE_DIR SDL.h diff --git a/CMakeModules/FindSDL2_mixer.cmake b/CMakeModules/FindSDL2_mixer.cmake index dc052a8..9bf2719 100644 --- a/CMakeModules/FindSDL2_mixer.cmake +++ b/CMakeModules/FindSDL2_mixer.cmake @@ -42,11 +42,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(SDL2_MIXER_SEARCH_PATHS - ${SDL2_MIXER_PATH} - ${CMAKE_SOURCE_DIR}/extern -) - find_path(SDL2_MIXER_INCLUDE_DIR SDL_mixer.h HINTS ENV SDL2MIXERDIR @@ -54,7 +49,7 @@ find_path(SDL2_MIXER_INCLUDE_DIR SDL_mixer.h PATH_SUFFIXES SDL2 # path suffixes to search inside ENV{SDLDIR} include/SDL2 include - PATHS ${SDL2_MIXER_SEARCH_PATHS} + PATHS ${SDL2_MIXER_PATH} ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -69,7 +64,7 @@ find_library(SDL2_MIXER_LIBRARY ENV SDL2MIXERDIR ENV SDL2DIR PATH_SUFFIXES lib bin ${VC_LIB_PATH_SUFFIX} - PATHS ${SDL2_MIXER_SEARCH_PATHS} + PATHS ${SDL2_MIXER_PATH} ) if(SDL2_MIXER_INCLUDE_DIR AND EXISTS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h") From 6f9e6159e1d9c036a49fc50b6cfc1dd4a87c940c Mon Sep 17 00:00:00 2001 From: Orazio <22700499+orazioedoardo@users.noreply.github.com> Date: Mon, 31 Jul 2023 11:55:02 +0200 Subject: [PATCH 2/4] Use same /Libs folder as libs search path --- .gitignore | 2 +- CMakeLists.txt | 4 ++-- build-mac-app.sh | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index d81cc3d..f83ee98 100644 --- a/.gitignore +++ b/.gitignore @@ -266,7 +266,7 @@ __pycache__/ /Export /DrMem /Doc private -# Windows local libraries +# Windows and macOS local libraries /Libs #CMake generated diff --git a/CMakeLists.txt b/CMakeLists.txt index 0033946..93e5ef0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,8 @@ if(APPLE) set(CMAKE_BUILD_WITH_INSTALL_RPATH true) set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") - list(APPEND SDL2_PATH "${CMAKE_CURRENT_LIST_DIR}/extern") - list(APPEND SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/extern") + list(APPEND SDL2_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs") + list(APPEND SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs") endif() # SDL2main is not needed diff --git a/build-mac-app.sh b/build-mac-app.sh index a77a492..5f3b332 100644 --- a/build-mac-app.sh +++ b/build-mac-app.sh @@ -2,9 +2,9 @@ set -xe -mkdir extern +mkdir Libs -cd extern +cd Libs sdl_version='2.28.1' sdl_filename="SDL2-$sdl_version.dmg" @@ -47,8 +47,8 @@ mkdir -p SpaceCadetPinball.app/Contents/Frameworks cp -a Platform/macOS/Info.plist SpaceCadetPinball.app/Contents/ cp -a Platform/macOS/SpaceCadetPinball.icns SpaceCadetPinball.app/Contents/Resources/ -cp -a extern/SDL2.framework SpaceCadetPinball.app/Contents/Frameworks/ -cp -a extern/SDL2_mixer.framework SpaceCadetPinball.app/Contents/Frameworks/ +cp -a Libs/SDL2.framework SpaceCadetPinball.app/Contents/Frameworks/ +cp -a Libs/SDL2_mixer.framework SpaceCadetPinball.app/Contents/Frameworks/ cp -a bin/SpaceCadetPinball SpaceCadetPinball.app/Contents/MacOS/ sed -i '' "s/CHANGEME_SW_VERSION/$sw_version/" SpaceCadetPinball.app/Contents/Info.plist From 704249a5229d3a32fcac0933f5651dde5bdfb484 Mon Sep 17 00:00:00 2001 From: Orazio <22700499+orazioedoardo@users.noreply.github.com> Date: Mon, 31 Jul 2023 11:55:37 +0200 Subject: [PATCH 3/4] Make build-mac-app.sh not fail on repeated runs --- build-mac-app.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-mac-app.sh b/build-mac-app.sh index 5f3b332..dbd1998 100644 --- a/build-mac-app.sh +++ b/build-mac-app.sh @@ -2,7 +2,7 @@ set -xe -mkdir Libs +mkdir -p Libs cd Libs From faf4ef2cf23b6b033a8da808e4a7da8c95e4db84 Mon Sep 17 00:00:00 2001 From: Orazio <22700499+orazioedoardo@users.noreply.github.com> Date: Mon, 31 Jul 2023 11:56:02 +0200 Subject: [PATCH 4/4] Make build-mac-app.sh executable --- build-mac-app.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build-mac-app.sh diff --git a/build-mac-app.sh b/build-mac-app.sh old mode 100644 new mode 100755