diff --git a/.gitignore b/.gitignore index 72823be..4860d33 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ cmake-build-debug/ -.DS_Store \ No newline at end of file +.DS_Store +*.xcodeproj/project.xcworkspace/xcuserdata/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9316a1b..4efe54d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) -project(cerberus C) set(CMAKE_C_STANDARD 11) +project(cerberus C) if (WIN32) # TODO set arch on target instead of generator @@ -17,9 +17,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # does not work, use Xcode to build # TODO use makefile instead of cmake? add_definitions(-DMACOS) - add_executable(cerberus src/main.h src/main.m) - include_directories(/usr/include) - link_directories() + add_executable(cerberus MACOSX_BUNDLE src/main.h src/main.m) elseif(UNIX) add_definitions(-DUNIX) endif () diff --git a/cerberus.xcodeproj/project.xcworkspace/xcuserdata/theoryofnekomata.xcuserdatad/UserInterfaceState.xcuserstate b/cerberus.xcodeproj/project.xcworkspace/xcuserdata/theoryofnekomata.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 25a5f3f..0000000 Binary files a/cerberus.xcodeproj/project.xcworkspace/xcuserdata/theoryofnekomata.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/src/main.m b/src/main.m index 7c8d9e6..a219440 100644 --- a/src/main.m +++ b/src/main.m @@ -1,26 +1,14 @@ #import -#import "main.h" - int main() { - // https://stackoverflow.com/questions/30269329/creating-window-application-in-pure-c-on-mac-osx - @autoreleasepool { + @autoreleasepool{ [NSApplication sharedApplication]; [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; id applicationName = [[NSProcessInfo processInfo] processName]; - id window = [ - [NSWindow alloc] - initWithContentRect: NSMakeRect(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT) - styleMask: - NSWindowStyleMaskTitled - | NSWindowStyleMaskClosable - | NSWindowStyleMaskMiniaturizable - | NSWindowStyleMaskResizable - backing:NSBackingStoreBuffered - defer:NO - ]; - [window cascadeTopLeftFromPoint:NSMakePoint(20, 20)]; - [window setTitle:applicationName]; + id window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 120, 120) + styleMask:NSWindowStyleMaskTitled backing:NSBackingStoreBuffered defer:NO]; + [window cascadeTopLeftFromPoint:NSMakePoint(20,20)]; + [window setTitle: applicationName]; [window makeKeyAndOrderFront:nil]; [NSApp activateIgnoringOtherApps:YES]; [NSApp run];