macOS can now build in debug mode, and can be built outside of a bundle

This commit is contained in:
Yousef Khadadeh 2025-11-24 02:00:06 -08:00
parent c5ba20173b
commit aa98e6e6d0
3 changed files with 26 additions and 20 deletions

View file

@ -24,6 +24,7 @@ option(USE_MEMORYSAN "Enable Memory Sanitizer" OFF)
option(NO_CONAN_BUILD "Not using conan to get packages" OFF) option(NO_CONAN_BUILD "Not using conan to get packages" OFF)
option(EMSCRIPTEN_SINGLE_HTML_FILE "Building with emscripten generates a single HTML file" OFF) option(EMSCRIPTEN_SINGLE_HTML_FILE "Building with emscripten generates a single HTML file" OFF)
option(CONFIG_NEXT_TO_EXECUTABLE "Place configuration folder next to executable (portable executable)" OFF) option(CONFIG_NEXT_TO_EXECUTABLE "Place configuration folder next to executable (portable executable)" OFF)
option(MACOS_MAKE_BUNDLE "Package the application as a bundle" ON)
# Setting sources # Setting sources
set(sources "src/main.cpp" set(sources "src/main.cpp"
@ -181,25 +182,28 @@ add_executable(infinipaint ${sources})
if(WIN32) if(WIN32)
set_target_properties(infinipaint PROPERTIES WIN32_EXECUTABLE TRUE) set_target_properties(infinipaint PROPERTIES WIN32_EXECUTABLE TRUE)
elseif(APPLE) elseif(APPLE)
set_target_properties(infinipaint PROPERTIES MACOSX_BUNDLE TRUE) if(MACOS_MAKE_BUNDLE)
set_target_properties(infinipaint PROPERTIES target_compile_definitions(infinipaint PRIVATE MACOS_MAKE_BUNDLE)
BUNDLE True set_target_properties(infinipaint PROPERTIES MACOSX_BUNDLE TRUE)
MACOSX_BUNDLE_GUI_IDENTIFIER com.erroratline0.infinipaint set_target_properties(infinipaint PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME infinipaint BUNDLE True
MACOSX_BUNDLE_BUNDLE_VERSION "0.3.0" MACOSX_BUNDLE_GUI_IDENTIFIER com.erroratline0.infinipaint
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.3.0" MACOSX_BUNDLE_BUNDLE_NAME infinipaint
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/macosinstall/Info.plist MACOSX_BUNDLE_BUNDLE_VERSION "0.3.0"
) MACOSX_BUNDLE_SHORT_VERSION_STRING "0.3.0"
add_custom_command(TARGET infinipaint POST_BUILD MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/macosinstall/Info.plist
COMMAND ${CMAKE_COMMAND} -E copy_directory )
"${CMAKE_SOURCE_DIR}/data" add_custom_command(TARGET infinipaint POST_BUILD
"$<TARGET_FILE_DIR:infinipaint>/../Resources/data" COMMAND ${CMAKE_COMMAND} -E copy_directory
) "${CMAKE_SOURCE_DIR}/data"
add_custom_command(TARGET infinipaint POST_BUILD "$<TARGET_FILE_DIR:infinipaint>/../Resources/data"
COMMAND ${CMAKE_COMMAND} -E copy )
"${CMAKE_SOURCE_DIR}/macosinstall/appicon.icns" add_custom_command(TARGET infinipaint POST_BUILD
"$<TARGET_FILE_DIR:infinipaint>/../Resources/appicon.icns" COMMAND ${CMAKE_COMMAND} -E copy
) "${CMAKE_SOURCE_DIR}/macosinstall/appicon.icns"
"$<TARGET_FILE_DIR:infinipaint>/../Resources/appicon.icns"
)
endif()
endif() endif()
if(EMSCRIPTEN) if(EMSCRIPTEN)

View file

@ -419,7 +419,7 @@ class ConanSkia(ConanFile):
self.tool_requires("ninja/[>=1.11.0]") self.tool_requires("ninja/[>=1.11.0]")
if self.options.use_harfbuzz and self.options.use_system_harfbuzz and self.options.use_conan_harfbuzz: if self.options.use_harfbuzz and self.options.use_system_harfbuzz and self.options.use_conan_harfbuzz:
self.requires("harfbuzz/10.4.0", options = {"with_subset":True, "with_glib":False}) self.requires("harfbuzz/11.4.1", options = {"with_subset":True, "with_glib":False})
if self.options.use_freetype and self.options.use_system_freetype and self.options.use_conan_freetype: if self.options.use_freetype and self.options.use_system_freetype and self.options.use_conan_freetype:
self.requires("freetype/2.13.2") self.requires("freetype/2.13.2")

View file

@ -21,7 +21,9 @@ void switch_cwd() {
CFStringGetCString(str, path, 4096, kCFStringEncodingUTF8); CFStringGetCString(str, path, 4096, kCFStringEncodingUTF8);
CFRelease(str); CFRelease(str);
std::string newCWD(path); std::string newCWD(path);
#ifdef MACOS_MAKE_BUNDLE
newCWD += "/Contents/Resources"; newCWD += "/Contents/Resources";
#endif
std::filesystem::current_path(std::filesystem::path(newCWD)); std::filesystem::current_path(std::filesystem::path(newCWD));
#elif _WIN32 #elif _WIN32