diff --git a/README.md b/README.md index 6048ab89..85772b96 100644 --- a/README.md +++ b/README.md @@ -492,6 +492,8 @@ Recommended in this case is `cmake-vs2019-64bit.bat` or `cmake-vs2019-64bit-no-f > sudo port install cmake libsdl2 +universal openal-soft +universal (for universal arch libraries) You don't need FFmpeg to be installed. You can turn it off by adding -DFFMPEG=OFF and -DBINKDEC=ON to the CMake options. For debug builds FFmpeg is enabled by default because the bundled libbinkdec is slow during development if compiled for Debug mode. For release, retail and universal builds FFmpeg is disabled and libbinkdec is enabled by default. + + The Vulkan SDK must be installed and can be obtained from https://vulkan.lunarg.com/sdk/home#mac 3. Generate the Makefiles using CMake: @@ -507,6 +509,8 @@ Recommended in this case is `cmake-vs2019-64bit.bat` or `cmake-vs2019-64bit-no-f or > ./cmake-xcode-universal.sh (universal build on macOS Big Sur / Xcode 12.2 or later) + Xcode release and universal builds now automatically package the executable into a macOS app bundle, defining an Info.plist file and copying the base directory and custom icon into the application bundle's Contents/Resources folder. This is controlled by adding -DMACOSX_BUNDLE=ON to the CMake options. + Depending on which package manager you install (Homebrew or MacPorts) you may need to change the openal-soft library and include paths specified in the cmake shell scripts. For single architecture builds (debug, release, retail) the default openal-soft paths are set for Homebrew on x86, while for universal builds the default paths are set for MacPorts on x86 or Apple Silicon. If you want to build using the single architecture shell scripts (debug, release, retail) on Apple Silicon, you will need to change the openal-soft paths from `/usr/local/...` to either `/opt/homebrew/...` (Homebrew) or `/opt/local/...` (MacPorts). 4. Compile RBDOOM-3-BFG targets: @@ -609,15 +613,15 @@ Anyway: * _common.crc * (etc) -5. On macOS the RBDoom3BFG executable will also search for game data within an app bundle's Contents/Resources/base folder, and as a last resort, within the absolute path /Applications/RBDoom-3-BFG.app/Contents/Resources/base. In addition, if you want the game to be standalone without dependencies on pre-installed dynamic libs, you can use macdylibbundler to bundle all external dylib dependencies into the app bundle (see https://github.com/auriamg/macdylibbundler or simply install via "brew install dylibbundler" or "sudo port install dylibbundler"). For example, the following command will copy all external dylib dependencies to the Contents/libs directory of the game's app bundle and adjust the rpaths within the RBDoom3BFG executable and copied dylibs. +5. On macOS the RBDoom3BFG executable will also search for game data within an app bundle's Contents/Resources/base folder, and as a last resort, within the absolute path /Applications/RBDoom3BFG.app/Contents/Resources/base. In addition, if you want the game to be standalone without dependencies on pre-installed dynamic libs, you can use macdylibbundler to bundle all external dylib dependencies into the app bundle (see https://github.com/auriamg/macdylibbundler or simply install via "brew install dylibbundler" or "sudo port install dylibbundler"). For example, the following command will copy all external dylib dependencies to the Contents/libs directory of the game's app bundle and adjust the rpaths within the RBDoom3BFG executable and copied dylibs. - > dylibbundler -od -b -x RBDoom-3-BFG.app/Contents/MacOS/RBDoom3BFG -d RBDoom-3-BFG.app/Contents/libs/ + > dylibbundler -od -b -x RBDoom3BFG.app/Contents/MacOS/RBDoom3BFG -d RBDoom3BFG.app/Contents/libs/ After running dylibbundler you may need to re-sign the modified executable and dylibs if planning to run on **Apple Silicon** machines. Newer versions of dylibbundler now do this automatically. The output of dylibbundler will indicate which executable and dylibs (if any) require re-signing. This code signing step is not needed for x86-based Macs. - > codesign -s - --force RBDoom-3-BFG.app/Contents/libs/lib.dylib + > codesign -s - --force RBDoom3BFG.app/Contents/libs/lib.dylib ... - > codesign -s - --force RBDoom-3-BFG.app/Contents/MacOS/RBDoom3BFG + > codesign -s - --force RBDoom3BFG.app/Contents/MacOS/RBDoom3BFG 6. Run the game by executing the RBDoom3BFG executable. diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 3029f889..6104fcd4 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -1793,7 +1793,27 @@ else() add_dependencies(precomp_header_rbdoom3bfg idlib) endif() - add_executable(RBDoom3BFG WIN32 ${RBDOOM3_SOURCES}) + if(MACOSX_BUNDLE) + # define contents of macOS app bundle Resources folder + set(MACOS_RESOURCES sys/posix/res/Doom3BFG.icns ../base) + source_group("Resources" FILES ${MACOS_RESOURCES}) + set_source_files_properties(${MACOS_RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + + # enable Xcode to display the icons file properly + set_source_files_properties(sys/posix/res/Doom3BFG.icns PROPERTIES XCODE_EXPLICIT_FILE_TYPE .icns) + + # add macOS bundle properties to executable + set(MACOSX_BUNDLE_BUNDLE_NAME RBDoom-3-BFG) + set(MACOSX_BUNDLE_BUNDLE_VERSION 1.5.0) + set(MACOSX_BUNDLE_SHORT_VERSION_STRING 1.5.0) + set(MACOSX_BUNDLE_ICON_FILE Doom3BFG.icns) + set(MACOSX_BUNDLE_INFO_STRING "") # to be added by author if desired + set(MACOSX_BUNDLE_COPYRIGHT "") # to be added by author if desired + + add_executable(RBDoom3BFG MACOSX_BUNDLE ${MACOS_RESOURCES} ${RBDOOM3_INCLUDES} ${RBDOOM3_SOURCES}) + else() + add_executable(RBDoom3BFG WIN32 ${RBDOOM3_INCLUDES} ${RBDOOM3_SOURCES}) + endif() if(USE_VULKAN) add_dependencies(RBDoom3BFG nvrhi_vk) diff --git a/neo/cmake-xcode-release.sh b/neo/cmake-xcode-release.sh index 9577d032..3d9991cb 100755 --- a/neo/cmake-xcode-release.sh +++ b/neo/cmake-xcode-release.sh @@ -5,4 +5,4 @@ cd xcode-release # note 1: remove or set -DCMAKE_SUPPRESS_REGENERATION=OFF to reenable ZERO_CHECK target which checks for CMakeLists.txt changes and re-runs CMake before builds # however, if ZERO_CHECK is reenabled **must** add VULKAN_SDK location to Xcode Custom Paths (under Prefs/Locations) otherwise build failures may occur # note 2: policy CMAKE_POLICY_DEFAULT_CMP0142=NEW suppresses non-existant per-config suffixes on Xcode library search paths, works for cmake version 3.25 and later -cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev +cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DMACOSX_BUNDLE=ON -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/usr/local/opt/openal-soft/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/opt/openal-soft/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev diff --git a/neo/cmake-xcode-universal.sh b/neo/cmake-xcode-universal.sh index 63ff3977..d28fedf3 100755 --- a/neo/cmake-xcode-universal.sh +++ b/neo/cmake-xcode-universal.sh @@ -6,4 +6,4 @@ cd xcode-universal # however, if ZERO_CHECK is reenabled **must** add VULKAN_SDK location to Xcode Custom Paths (under Prefs/Locations) otherwise build failures may occur # note 2: policy CMAKE_POLICY_DEFAULT_CMP0142=NEW suppresses non-existant per-config suffixes on Xcode library search paths, works for cmake version 3.25 and later # note 3: universal openal-soft library and include paths assume MacPorts install locations -cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/opt/local/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/opt/local/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev +cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_CONFIGURATION_TYPES="Release;MinSizeRel;RelWithDebInfo" -DMACOSX_BUNDLE=ON -DFFMPEG=OFF -DBINKDEC=ON -DUSE_MoltenVK=ON -DCMAKE_XCODE_GENERATE_SCHEME=ON -DCMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION=OFF -DCMAKE_SUPPRESS_REGENERATION=ON -DOPENAL_LIBRARY=/opt/local/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/opt/local/include ../neo -DCMAKE_POLICY_DEFAULT_CMP0142=NEW -Wno-dev diff --git a/neo/framework/Licensee.h b/neo/framework/Licensee.h index 4f3b04fc..7c5c748a 100644 --- a/neo/framework/Licensee.h +++ b/neo/framework/Licensee.h @@ -68,7 +68,7 @@ If you have questions concerning this license or the applicable additional terms // RB begin // Default base path (used only if none could be found) #ifdef __APPLE__ - #define DEFAULT_BASEPATH "/Applications/RBDOOM-3-BFG.app/Contents/Resources" + #define DEFAULT_BASEPATH "/Applications/RBDoom3BFG.app/Contents/Resources" #else #define DEFAULT_BASEPATH "/usr/share/games/doom3bfg" #endif @@ -79,4 +79,4 @@ If you have questions concerning this license or the applicable additional terms #define STEAMPATH_NAME "DOOM 3 BFG Edition" // raynorpat: GOG.com Galaxy Launcher Game ID for figuring out Steam base path -#define GOGPATH_ID "1733124578" \ No newline at end of file +#define GOGPATH_ID "1733124578" diff --git a/neo/imgui/BFGimguiImpl.cpp b/neo/imgui/BFGimguiImpl.cpp index 67aae326..5a79da55 100644 --- a/neo/imgui/BFGimguiImpl.cpp +++ b/neo/imgui/BFGimguiImpl.cpp @@ -254,6 +254,10 @@ bool Init( int windowWidth, int windowHeight ) io.GetClipboardTextFn = GetClipboardText; io.ClipboardUserData = NULL; + // SRS - store imgui.ini file in fs_savepath (not in cwd please!) + static idStr BFG_IniFilename = fileSystem->BuildOSPath( cvarSystem->GetCVarString( "fs_savepath" ), io.IniFilename ); + io.IniFilename = BFG_IniFilename; + // make it a bit prettier with rounded edges ImGuiStyle& style = ImGui::GetStyle(); //style.ChildWindowRounding = 9.0f; diff --git a/neo/sys/posix/res/Doom3BFG.icns b/neo/sys/posix/res/Doom3BFG.icns new file mode 100644 index 00000000..b54b1752 Binary files /dev/null and b/neo/sys/posix/res/Doom3BFG.icns differ