1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #include "os_macos.h"
- #include "main/main.h"
- #include <string.h>
- #include <unistd.h>
- #if defined(SANITIZERS_ENABLED)
- #include <sys/resource.h>
- #endif
- int main(int argc, char **argv) {
- #if defined(VULKAN_ENABLED)
- setenv("MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE", "1", 1);
- setenv("MVK_CONFIG_SWAPCHAIN_MIN_MAG_FILTER_USE_NEAREST", "0", 1);
- #endif
- #if defined(SANITIZERS_ENABLED)
-
- struct rlimit stack_lim = { 0x1E00000, 0x1E00000 };
- setrlimit(RLIMIT_STACK, &stack_lim);
- #endif
- int first_arg = 1;
- const char *dbg_arg = "-NSDocumentRevisionsDebugMode";
- for (int i = 0; i < argc; i++) {
- if (strcmp(dbg_arg, argv[i]) == 0) {
- first_arg = i + 2;
- }
- }
- OS_MacOS os;
- Error err;
-
- TEST_MAIN_OVERRIDE
- @autoreleasepool {
- err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]);
- }
- if (err != OK) {
- if (err == ERR_HELP) {
- return EXIT_SUCCESS;
- }
- return EXIT_FAILURE;
- }
- int ret;
- @autoreleasepool {
- ret = Main::start();
- }
- if (ret == EXIT_SUCCESS) {
- os.run();
- } else {
- os.set_exit_code(EXIT_FAILURE);
- }
- @autoreleasepool {
- Main::cleanup();
- }
- return os.get_exit_code();
- }
|