Skip to content

Instantly share code, notes, and snippets.

@eyelash
Created September 29, 2016 14:02
Show Gist options
  • Select an option

  • Save eyelash/ff0c88a187acb4cbd54f7af5323d52ff to your computer and use it in GitHub Desktop.

Select an option

Save eyelash/ff0c88a187acb4cbd54f7af5323d52ff to your computer and use it in GitHub Desktop.
Cocoa
project(test)
find_library(COCOA Cocoa)
add_executable(test MACOSX_BUNDLE main.m)
target_link_libraries(test ${COCOA})
#import <Cocoa/Cocoa.h>
int main(int argc, char **argv) {
@autoreleasepool {
[NSApplication sharedApplication];
NSWindow *window = [[NSWindow alloc]
initWithContentRect: CGRectMake(0, 0, 800, 600)
styleMask: NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable
backing: NSBackingStoreBuffered
defer: false
];
[window setTitle: @"test"];
[window makeKeyAndOrderFront: nil];
[NSApp run];
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment