diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b46481e..e32ee05c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ option(USE_KEYCHAIN "Store the token in the keychain (default)" ON) option(ENABLE_NOTIFICATION_SOUNDS "Enable notification sounds (default)" ON) option(ENABLE_RNNOISE "Enable RNNoise for voice activity detection (default)" ON) option(ENABLE_QRCODE_LOGIN "Enable QR code login (default)" ON) +option(BUNDLE_MACOSX_APP "Bundle the application as a .app on macOS (default)" ON) find_package(nlohmann_json REQUIRED) find_package(CURL) @@ -50,6 +51,10 @@ list(FILTER ABADDON_SOURCES EXCLUDE REGEX ".*notifier_gio\\.cpp$") list(FILTER ABADDON_SOURCES EXCLUDE REGEX ".*notifier_fallback\\.cpp$") add_executable(abaddon ${ABADDON_SOURCES}) +if (APPLE AND BUNDLE_MACOSX_APP) + set_target_properties(abaddon PROPERTIES MACOSX_BUNDLE TRUE) +endif() + target_include_directories(abaddon PUBLIC ${PROJECT_SOURCE_DIR}/src) target_include_directories(abaddon PUBLIC ${PROJECT_BINARY_DIR}) target_include_directories(abaddon PUBLIC ${GTKMM_INCLUDE_DIRS}) @@ -221,7 +226,11 @@ foreach (COMPILER_DEF IN LISTS ABADDON_COMPILER_DEFS) target_compile_definitions(abaddon PRIVATE "${COMPILER_DEF}") endforeach () -install(TARGETS abaddon RUNTIME) +if (APPLE AND BUNDLE_MACOSX_APP) + install(TARGETS abaddon BUNDLE DESTINATION ".") +else() + install(TARGETS abaddon RUNTIME) +endif() install(DIRECTORY res/css DESTINATION ${ABADDON_RESOURCE_DIR}) install(DIRECTORY res/fonts DESTINATION ${ABADDON_RESOURCE_DIR}) install(DIRECTORY res/res DESTINATION ${ABADDON_RESOURCE_DIR}) diff --git a/README.md b/README.md index 44a00558..d5142edc 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ the result of fundamental issues with Discord's thread implementation. 5. `make` 6. [Copy resources](#resources) +For an unbundled build (i.e., a standalone unix executable instead of a macOS .app), pass `cmake -DBUNDLE_MACOSX_APP=OFF ..` for step 4 instead. + #### Linux: 1. Install dependencies @@ -133,8 +135,8 @@ Latest release version: https://github.com/uowuo/abaddon/releases/latest #### Resources The two folders within the `res` folder (`res/res` and `res/css`) are necessary. Windows also uses the `fonts` folder. -You can put them directly next to the executable. On Linux, `css` and `res` can also be loaded from -`~/.local/share/abaddon` or `/usr/share/abaddon` +On Windows & Linux, you can put them directly next to the executable. On Linux, `css` and `res` can also be loaded from +`~/.local/share/abaddon` or `/usr/share/abaddon`. On a bundled macOS build, you can put them inside of `abaddon.app/Contents/Resources/`. `abaddon.ini` will also be automatically used if located at `~/.config/abaddon/abaddon.ini` and there is no `abaddon.ini` in the working directory