summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorJohn Abd-El-Malek <jam@chromium.org>2014-05-22 16:14:52 -0700
committerJohn Abd-El-Malek <jam@chromium.org>2014-05-23 16:55:40 -0700
commit70e2270a8ac049bbcef0f13ae0848e3a2d01966b (patch)
tree5926bf475df15d3607033eb8f9416d5ae56c3c83 /build
parent3ce25e68aa8f6d4b880ce4e0e9f123d117fcbd0c (diff)
downloadpdfium-70e2270a8ac049bbcef0f13ae0848e3a2d01966b.tar.xz
Create a standalone pdfium build.
I moved pdfium_test from chromium's repo to pdfium's. It's now buildable as a sample following the instructions on the wiki.
Diffstat (limited to 'build')
-rw-r--r--build/all.gyp15
-rw-r--r--build/gyp_pdfium46
-rw-r--r--build/gyp_pdfium.py8
-rw-r--r--build/standalone.gypi259
4 files changed, 328 insertions, 0 deletions
diff --git a/build/all.gyp b/build/all.gyp
new file mode 100644
index 0000000000..e9229dd7c6
--- /dev/null
+++ b/build/all.gyp
@@ -0,0 +1,15 @@
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'All',
+ 'type': 'none',
+ 'dependencies': [
+ '../samples/samples.gyp:*',
+ ],
+ }
+ ]
+} \ No newline at end of file
diff --git a/build/gyp_pdfium b/build/gyp_pdfium
new file mode 100644
index 0000000000..0458b96d13
--- /dev/null
+++ b/build/gyp_pdfium
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script is wrapper for PDFium that adds some support for how GYP
+# is invoked by PDFium beyond what can be done in the gclient hooks.
+
+import os
+import platform
+import sys
+
+script_dir = os.path.dirname(os.path.realpath(__file__))
+pdfium_root = os.path.abspath(os.path.join(script_dir, os.pardir))
+
+sys.path.insert(0, os.path.join(pdfium_root, 'build', 'gyp', 'pylib'))
+import gyp
+
+
+def run_gyp(args):
+ rc = gyp.main(args)
+ if rc != 0:
+ print 'Error running GYP'
+ sys.exit(rc)
+
+
+def main():
+ args = sys.argv[1:]
+ args.append(os.path.join(script_dir, 'all.gyp'))
+
+ args.append('-I')
+ args.append(os.path.join(pdfium_root, 'build', 'standalone.gypi'))
+
+ args.extend(['-D', 'gyp_output_dir=out'])
+
+ # Set the GYP DEPTH variable to the root of the PDFium project.
+ args.append('--depth=' + os.path.relpath(pdfium_root))
+
+ print 'Updating projects from gyp files...'
+ sys.stdout.flush()
+
+ run_gyp(args)
+
+if __name__ == '__main__':
+ sys.exit(main()) \ No newline at end of file
diff --git a/build/gyp_pdfium.py b/build/gyp_pdfium.py
new file mode 100644
index 0000000000..9776c302d4
--- /dev/null
+++ b/build/gyp_pdfium.py
@@ -0,0 +1,8 @@
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+
+path = os.path.abspath(os.path.split(__file__)[0])
+execfile(os.path.join(path, 'gyp_pdfium'))
diff --git a/build/standalone.gypi b/build/standalone.gypi
new file mode 100644
index 0000000000..970c0590c7
--- /dev/null
+++ b/build/standalone.gypi
@@ -0,0 +1,259 @@
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Definitions to be used when building stand-alone PDFium binaries.
+
+{
+ 'variables': {
+ 'component%': 'static_library',
+ 'clang%': 0,
+ 'msvs_multi_core_compile%': '1',
+ 'variables': {
+ 'variables': {
+ 'variables': {
+ 'conditions': [
+ ['OS=="linux" or OS=="mac"', {
+ # This handles the Unix platforms we generally deal with.
+ # Anything else gets passed through, which probably won't work
+ # very well; such hosts should pass an explicit target_arch
+ # to gyp.
+ 'host_arch%':
+ '<!(uname -m | sed -e "s/i.86/ia32/;\
+ s/x86_64/x64/;\
+ s/amd64/x64/;\
+ s/arm.*/arm/;\
+ s/aarch64/arm64/;\
+ s/mips.*/mipsel/")',
+ }, {
+ # OS!="linux" and OS!="mac"
+ 'host_arch%': 'ia32',
+ }],
+ ],
+ },
+ 'host_arch%': '<(host_arch)',
+ 'target_arch%': '<(host_arch)',
+ },
+ 'host_arch%': '<(host_arch)',
+ 'target_arch%': '<(target_arch)',
+ },
+ 'host_arch%': '<(host_arch)',
+ 'target_arch%': '<(target_arch)',
+ 'werror%': '-Werror',
+ 'v8_optimized_debug%': 0,
+ 'icu_gyp_path': '../v8/third_party/icu/icu.gyp',
+ 'conditions': [
+ ['OS == "win"', {
+ 'os_posix%': 0,
+ }, {
+ 'os_posix%': 1,
+ }],
+ ],
+ },
+ 'target_defaults': {
+ 'default_configuration': 'Debug',
+ 'configurations': {
+ 'Debug': {
+ 'cflags': [
+ '-g',
+ '-O0',
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '0',
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'RuntimeLibrary': '3', # /MDd
+ }, {
+ 'RuntimeLibrary': '1', # /MTd
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '2',
+ },
+ },
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
+ },
+ },
+ 'Release': {
+ 'cflags': [
+ '-fno-strict-aliasing',
+ ],
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
+ 'GCC_STRICT_ALIASING': 'NO',
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '2',
+ 'InlineFunctionExpansion': '2',
+ 'EnableIntrinsicFunctions': 'true',
+ 'FavorSizeOrSpeed': '0',
+ 'StringPooling': 'true',
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'RuntimeLibrary': '2', #/MD
+ }, {
+ 'RuntimeLibrary': '0', #/MT
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '1',
+ 'OptimizeReferences': '2',
+ 'EnableCOMDATFolding': '2',
+ },
+ },
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [
+ '-fdata-sections',
+ '-ffunction-sections',
+ '-O3',
+ '-O2',
+ ],
+ }],
+ ['OS=="android"', {
+ 'cflags!': [
+ '-O3',
+ '-Os',
+ ],
+ 'cflags': [
+ '-fdata-sections',
+ '-ffunction-sections',
+ '-O2',
+ ],
+ }],
+ ], # conditions
+ },
+ },
+ 'defines!': [
+ 'DEBUG',
+ ],
+ 'cflags!': [
+ '-Wall',
+ '-W',
+ '-Wno-unused-parameter',
+ '-pthread', '-fno-exceptions',
+ '-fvisibility=hidden',
+ ],
+ 'cflags_cc': [
+ '-Wnon-virtual-dtor',
+ '-fno-rtti',
+ ],
+ 'ldflags': [
+ '-pthread',
+ ],
+ 'msvs_cygwin_dirs': ['<(DEPTH)/v8/third_party/cygwin'],
+ 'msvs_configuration_attributes': {
+ 'OutputDirectory': '<(DEPTH)\\out\\$(ConfigurationName)',
+ 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
+ 'CharacterSet': '1',
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'MinimalRebuild': 'false',
+ 'BufferSecurityCheck': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'RuntimeTypeInfo': 'false',
+ 'WarningLevel': '3',
+ 'WarnAsError': 'false',
+ 'DebugInformationFormat': '3',
+ 'Detect64BitPortabilityProblems': 'false',
+ 'conditions': [
+ [ 'msvs_multi_core_compile', {
+ 'AdditionalOptions': ['/MP'],
+ }],
+ ['component=="shared_library"', {
+ 'ExceptionHandling': '1', # /EHsc
+ }, {
+ 'ExceptionHandling': '0',
+ }],
+ ],
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalOptions': ['/ignore:4221'],
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ 'LinkIncremental': '1',
+ # SubSystem values:
+ # 0 == not set
+ # 1 == /SUBSYSTEM:CONSOLE
+ # 2 == /SUBSYSTEM:WINDOWS
+ 'SubSystem': '1',
+ 'AdditionalDependencies': [
+ 'advapi32.lib',
+ 'gdi32.lib',
+ 'user32.lib',
+ ],
+ },
+ },
+ 'xcode_settings': {
+ 'ALWAYS_SEARCH_USER_PATHS': 'NO',
+ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
+ 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
+ # (Equivalent to -fPIC)
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
+ 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
+ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
+ # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
+ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
+ 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror
+ 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor
+ 'SYMROOT': '<(DEPTH)/xcodebuild',
+ 'USE_HEADERMAP': 'NO',
+ 'OTHER_CFLAGS': [
+ '-fno-strict-aliasing',
+ ],
+ 'WARNING_CFLAGS': [
+ '-Wall',
+ '-Wendif-labels',
+ '-W',
+ '-Wno-unused-parameter',
+ ],
+ },
+ },
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'cflags': [
+ '-fPIC',
+ ],
+ }],
+ ['OS=="win"', {
+ 'target_defaults': {
+ 'defines': [
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_CRT_NONSTDC_NO_DEPRECATE',
+ ],
+ 'conditions': [
+ ['component=="static_library"', {
+ 'defines': [
+ '_HAS_EXCEPTIONS=0',
+ ],
+ }],
+ ],
+ },
+ }], # OS=="win"
+ ['OS=="mac"', {
+ 'target_defaults': {
+ 'link_settings': {
+ 'libraries': [
+ '$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
+ '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+ ],
+ },
+ 'target_conditions': [
+ ['_type!="static_library"', {
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
+ }],
+ ], # target_conditions
+ }, # target_defaults
+ }], # OS=="mac"
+ ],
+} \ No newline at end of file