oc-cmake



 

 

#import

#import

 

 

@interface AppDel : NSObject>

 

 

@end

 

 

@implementation AppDel

 

-(void) applicationDidFinishLaunching:(NSNotification *)notification

{

    NSRect rect = NSMakeRect(35, 35, 1024, 800);

    

    NSWindowStyleMask style = NSWindowStyleMaskClosable | NSWindowStyleMaskTitled | NSWindowStyleMaskResizable;

 

    NSWindow* window = [[NSWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO];

    

    [NSApp beginModalSessionForWindow:window];

}

    

-(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender

{

    return TRUE;

}

 

@end

 

 

int main(int argc, const char ** argv)

{

    @autoreleasepool {

        AppDel * del = [[AppDel alloc] init];

        [[NSApplication sharedApplication] setDelegate: del];

        

        NSApplicationMain(argc, argv);

    }

}

<?xml version="1.0" encoding="UTF-8"?>
DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSPrincipalClasskey>
    <string>NSApplicationstring>
    <key>BuildMachineOSBuildkey>
    <string>17G14019string>
    <key>CFBundleDevelopmentRegionkey>
    <string>Englishstring>
    <key>CFBundleExecutablekey>
    <string>ObjectStudystring>
    <key>CFBundleInfoDictionaryVersionkey>
    <string>6.0string>
    <key>CFBundleLongVersionStringkey>
    <string>string>
    <key>CFBundleNamekey>
    <string>ObjectStudystring>
    <key>CFBundlePackageTypekey>
    <string>APPLstring>
    <key>CFBundleSignaturekey>
    <string>????string>
    <key>CFBundleSupportedPlatformskey>
    <array>
        <string>MacOSXstring>
    array>
    <key>CFBundleVersionkey>
    <string>string>
    <key>CSResourcesFileMappedkey>
    <true/>
    <key>DTCompilerkey>
    <string>com.apple.compilers.llvm.clang.1_0string>
    <key>DTPlatformBuildkey>
    <string>10B61string>
    <key>DTPlatformVersionkey>
    <string>GMstring>
    <key>DTSDKBuildkey>
    <string>18B71string>
    <key>DTSDKNamekey>
    <string>macosx10.14string>
    <key>DTXcodekey>
    <string>1010string>
    <key>DTXcodeBuildkey>
    <string>10B61string>
    <key>NSHumanReadableCopyrightkey>
    <string>string>
dict>
plist>
cmake_minimum_required(VERSION 2.8)
set(PRINCIPAL_CLASS "NSApplication")
project(ObjectStudy)

set(SRC
    main.m
    Info.plist
)

set(CMAKE_C_FLAGS "-x objective-c")
set(CMAKE_CXX_FLAGS "-x objective-c++")
set(CMAKE_EXE_LINKER_FLAGS "-framework Cocoa -framework AppKit -framework CoreData -framework Foundation")

add_executable(ObjectStudy 
   ${SRC}
)

set_target_properties(ObjectStudy PROPERTIES
    MACOSX_BUNDLE TRUE
#   PRINCIPAL_CLASS ""
#MACOSX_BUNDLE_BUNDLE_NAME ""
    MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
mac