Browse Source

Build atom-shell with ninja.

Cheng Zhao 12 years ago
parent
commit
6d187cbb7d
8 changed files with 74 additions and 12 deletions
  1. 1 0
      .gitignore
  2. 15 11
      atom.gyp
  3. 2 0
      browser/mac/Info.plist
  4. 42 0
      common.gypi
  5. 2 0
      renderer/mac/Info.plist
  6. 2 1
      script/update
  7. 0 0
      tools/mac/find_sdk.py
  8. 10 0
      tools/mac/source_root.py

+ 1 - 0
.gitignore

@@ -6,6 +6,7 @@ dist/
 frameworks/
 node/
 node_modules/
+out/
 vendor/
 *.xcodeproj
 *.swp

+ 15 - 11
atom.gyp

@@ -144,11 +144,10 @@
       '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
     ],
   },
-  'includes': [
-    'vendor/brightray/brightray.gypi'
-  ],
   'target_defaults': {
-    'mac_framework_dirs': [ 'frameworks' ],
+    'mac_framework_dirs': [
+      '<(source_root)/frameworks',
+    ],
   },
   'targets': [
     {
@@ -180,7 +179,9 @@
           ],
           'xcode_settings': {
             'INFOPLIST_FILE': 'browser/mac/Info.plist',
-            'LD_RUNPATH_SEARCH_PATHS': '@executable_path/../Frameworks',
+            'LD_RUNPATH_SEARCH_PATHS': [
+              '@executable_path/../Frameworks',
+            ],
           },
           'copies': [
             {
@@ -305,11 +306,12 @@
             '<(libchromiumcontent_resources_dir)/content_shell.pak',
           ],
           'xcode_settings': {
-            'LIBRARY_SEARCH_PATHS': '<(libchromiumcontent_library_dir)',
+            'LIBRARY_SEARCH_PATHS': [
+              '<(libchromiumcontent_library_dir)',
+            ],
             'LD_DYLIB_INSTALL_NAME': '@rpath/<(product_name).framework/<(product_name)',
-            'LD_RUNPATH_SEARCH_PATHS': '@loader_path/Libraries',
-            'OTHER_LDFLAGS': [
-              '-ObjC',
+            'LD_RUNPATH_SEARCH_PATHS': [
+              '@loader_path/Libraries',
             ],
           },
           'copies': [
@@ -346,7 +348,9 @@
           'mac_bundle': 1,
           'xcode_settings': {
             'INFOPLIST_FILE': 'renderer/mac/Info.plist',
-            'LD_RUNPATH_SEARCH_PATHS': '@executable_path/../../..',
+            'LD_RUNPATH_SEARCH_PATHS': [
+              '@executable_path/../../..',
+            ],
           },
           'postbuilds': [
             {
@@ -358,6 +362,6 @@
           ],
         },  # target helper
       ],
-    }],
+    }],  # OS==Mac
   ],
 }

+ 2 - 0
browser/mac/Info.plist

@@ -6,6 +6,8 @@
 	<string>com.github.atom</string>
 	<key>CFBundleName</key>
 	<string>${PRODUCT_NAME}</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
   <key>CFBundleIconFile</key>
   <string>atom.icns</string>
   <key>CFBundleVersion</key>

+ 42 - 0
common.gypi

@@ -0,0 +1,42 @@
+{
+  'variables': {
+    'clang': 0,
+    'source_root': '<!(python tools/mac/source_root.py)',
+    'conditions': [
+      ['OS=="mac"', {
+        'clang': 1,
+        'mac_sdk%': '<!(python tools/mac/find_sdk.py 10.8)',
+      }],
+    ],
+  },
+  'conditions': [
+    ['clang==1', {
+      'make_global_settings': [
+        ['CC', '/usr/bin/clang'],
+        ['CXX', '/usr/bin/clang++'],
+        ['LINK', '$(CXX)'],
+        ['CC.host', '$(CC)'],
+        ['CXX.host', '$(CXX)'],
+        ['LINK.host', '$(LINK)'],
+      ],
+      'target_defaults': {
+        'cflags_cc': [
+          '-std=c++11',
+        ],
+        'xcode_settings': {
+          'CC': '/usr/bin/clang',
+          'LDPLUSPLUS': '/usr/bin/clang++',
+          'OTHER_CPLUSPLUSFLAGS': [
+            '$(inherited)', '-std=gnu++11'
+          ],
+          'OTHER_CFLAGS': [
+            '-fcolor-diagnostics',
+          ],
+
+          'SDKROOT': 'macosx<(mac_sdk)',     # -isysroot
+          'GCC_C_LANGUAGE_STANDARD': 'c99',  # -std=c99
+        },
+      },
+    }],  # clang==1
+  ],
+}

+ 2 - 0
renderer/mac/Info.plist

@@ -6,6 +6,8 @@
 	<string>com.github.atom.helper</string>
 	<key>CFBundleName</key>
 	<string>${PRODUCT_NAME}</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
 	<key>LSUIElement</key>
 	<true/>
 </dict>

+ 2 - 1
script/update

@@ -7,7 +7,8 @@ cd "$(dirname "$0")/.."
 ./script/update-frameworks
 ./script/update-node v0.10.9
 
-gyp --depth . atom.gyp \
+gyp -f ninja --depth . atom.gyp \
+  -Icommon.gypi \
   -Ivendor/brightray/brightray.gypi \
   -Dtarget_arch=ia32 \
   -Dlibrary=static_library

+ 0 - 0
script/find_sdk.py → tools/mac/find_sdk.py


+ 10 - 0
tools/mac/source_root.py

@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+import os
+
+"""Prints the absolute path of the root of atom-shell's source tree.
+"""
+
+
+relative_source_root = os.path.join(__file__, '..', '..', '..')
+print os.path.abspath(relative_source_root)