Files
ce_cdm/cdm/cdm.gyp
2024-06-25 14:03:53 -07:00

333 lines
11 KiB
Python

# Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
# source code may only be used and distributed under the Widevine License
# Agreement.
#
# Refer to the distribution package's integration guide for information about
# setting up your system, performing the build, and using/testing the build
# targets.
{
'includes': [
'platform_properties.gypi',
'core.gypi',
'util.gypi',
], # Get list of core source files.
'variables': {
'has_dual_key%': 'false',
'embedded_cert%': '',
'support_embedded_cert_functions%': 'false',
},
'targets': [
{
'toolsets' : [ 'target' ],
'target_name': 'license_protocol',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'includes': ['../third_party/disable_warnings.gypi'],
'dependencies': [ '<(proto_gen_gyp_path):generate_license_protocol' ],
'sources': [
'<(proto_cc_dir)/license_protocol.pb.cc'
],
'include_dirs': [
'<(proto_cc_dir)',
'<(DEPTH)/third_party/protobuf/src'
],
'direct_dependent_settings': {
'include_dirs': [
'<(proto_cc_dir)',
'<(DEPTH)/third_party/protobuf/src'
]
},
},
{
'toolsets' : [ 'target' ],
'target_name': 'device_files',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'includes': ['../third_party/disable_warnings.gypi'],
'dependencies': [ '<(proto_gen_gyp_path):generate_device_files' ],
'sources': [
'<(proto_cc_dir)/device_files.pb.cc'
],
'include_dirs': [
'<(proto_cc_dir)',
'<(DEPTH)/third_party/protobuf/src'
],
'direct_dependent_settings': {
'include_dirs': [
'<(proto_cc_dir)',
'<(DEPTH)/third_party/protobuf/src'
]
},
},
{
'toolsets' : [ 'target' ],
'target_name': 'metrics_proto',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'includes': ['../third_party/disable_warnings.gypi'],
'dependencies': [ '<(proto_gen_gyp_path):generate_metrics_proto' ],
'sources': [
'<(proto_cc_dir)/wv_metrics.pb.cc'
],
'include_dirs': [
'<(proto_cc_dir)',
'<(DEPTH)/third_party/protobuf/src'
],
'direct_dependent_settings': {
'include_dirs': [
'<(proto_cc_dir)',
'<(DEPTH)/third_party/protobuf/src'
]
},
},
{
'toolsets' : [ 'target' ],
'target_name': 'widevine_utils',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'include_dirs': [
'../util/include',
],
'sources': [ '<@(wvutil_sources)'],
},
{
'toolsets' : [ 'target' ],
'target_name': 'widevine_cdm_core',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'dependencies': [
'device_files',
'license_protocol',
'metrics_proto',
'widevine_utils',
],
'include_dirs': [
'../core/include',
'../metrics/include',
'../oemcrypto/include',
'../oemcrypto/odk/include',
'../third_party/jsmn',
'../util/include',
],
'direct_dependent_settings': {
'include_dirs': [
'../core/include',
'../metrics/include',
'../oemcrypto/include',
'../util/include',
],
},
'sources': [
'<@(wvcdm_sources)',
'../third_party/jsmn/jsmn.h',
'../third_party/jsmn/jsmn.c',
],
'includes': [ '../util/libcrypto_dependency.gypi' ],
'conditions': [
['client_info_source=="compiled"', {
'conditions': [
['client_company_name=="" or " | " in client_company_name or "%" in client_company_name', {
'sources': [ 'invalid_client_company_name.c' ],
}],
['client_model_name=="" or " | " in client_model_name or "%" in client_model_name', {
'sources': [ 'invalid_client_model_name.c' ],
}],
# year may be a number, so use __str__ to convert to string. Can't use
# str() since we can't use global functions.
['client_model_year=="" or " | " in client_model_year.__str__() or "%" in client_model_year.__str__()', {
'sources': [ 'invalid_client_model_year.c' ],
}],
['client_product_name=="" or " | " in client_product_name or "%" in client_product_name', {
'sources': [ 'invalid_client_product_name.c' ],
}],
['client_device_name=="" or " | " in client_device_name or "%" in client_device_name', {
'sources': [ 'invalid_client_device_name.c' ],
}],
['client_arch_name=="" or " | " in client_arch_name or "%" in client_arch_name', {
'sources': [ 'invalid_client_arch_name.c' ],
}],
['client_platform=="" or " | " in client_platform or "%" in client_platform', {
'sources': [ 'invalid_client_platform.c' ],
}],
['client_form_factor=="" or " | " in client_form_factor or "%" in client_form_factor', {
'sources': [ 'invalid_client_form_factor.c' ],
}],
['client_version=="" or " | " in client_version or "%" in client_version', {
'sources': [ 'invalid_client_version.c' ],
}],
],
}],
['privacy_crypto_impl=="boringssl" or privacy_crypto_impl=="openssl"', {
'sources': [
'../core/src/privacy_crypto_boringssl.cpp',
],
}, { # else
'sources': [
'../core/src/privacy_crypto_<(privacy_crypto_impl).cpp',
],
'conditions': [
['privacy_crypto_impl=="apple"', {
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
],
},
}],
],
}], # end else
['oemcrypto_adapter_type=="dynamic"', {
'sources': [
'../core/src/oemcrypto_adapter_dynamic.cpp',
],
}],
['oemcrypto_adapter_type=="static"', {
'sources': [
'../core/src/oemcrypto_adapter_static.cpp',
],
}],
['oemcrypto_adapter_type=="static_v16"', {
'sources': [
'../core/src/oemcrypto_adapter_static.cpp',
'../core/src/oemcrypto_adapter_static_v17.cpp',
],
}],
['has_dual_key=="true"', {
'defines': ['HAS_DUAL_KEY'],
}],
['support_ota_keybox_functions=="false"', {
'sources': [
'../core/src/oemcrypto_ota_stubs.cpp',
],
}],
['support_embedded_cert_functions=="false"', {
'sources': [
'../core/src/oemcrypto_embedded_cert_stubs.cpp',
],
}],
],
}, # widevine_cdm_core target
{
# This is the widevine_ce_cdm built as a static library. This name does
# not mean that it uses oemcrypto's static adapter. Control over which
# adapter is used comes from the settings file for the platform.
'toolsets' : [ 'target' ],
'target_name': 'widevine_ce_cdm_static',
'type': 'static_library',
'standalone_static_library': 1,
'hard_dependency': 1,
'dependencies': [
'widevine_cdm_core',
'device_files',
'license_protocol',
'metrics_proto',
],
# Without this, library deps do not propagate from the protocol targets
# up to the shared lib or executable above.
'export_dependent_settings': [
'device_files',
'license_protocol',
'metrics_proto',
],
'defines': [
'CDM_IMPLEMENTATION',
],
'include_dirs': [
'include',
],
'direct_dependent_settings': {
'include_dirs': [
'include',
],
},
'sources': [
'include/cdm.h',
'include/cdm_version.h',
'include/properties_ce.h',
'src/cdm.cpp',
'src/log.cpp',
'src/logger_global.cpp',
'src/properties_ce.cpp',
],
'conditions': [
['embedded_cert!=""', {
'actions': [{
'action_name': 'generate_cert',
'msvs_cygwin_shell': 0,
'message': 'Generating cert.cc',
'inputs': [
'create_cert_cc.py',
'<(embedded_cert)',
],
'outputs': [
'<(INTERMEDIATE_DIR)/cert.cc',
],
'action': [
'python3',
'>@(_inputs)',
'>@(_outputs)',
],
}],
'sources': [
'<(INTERMEDIATE_DIR)/cert.cc',
],
}], # embedded_cert!=""
# This block defines preprocessor values that match the client
# information variables in platform properties.gypi. If you are writing
# your own build files to build CE CDM insted of using these GYP files
# and you are using compile-time client info, make sure to define these
# values, following the rules in the client info section in
# platform_properties.gypi.
['client_info_source=="compiled"', {
'defines': [
'CLIENT_COMPANY_NAME="<(client_company_name)"',
'CLIENT_MODEL_NAME="<(client_model_name)"',
'CLIENT_MODEL_YEAR="<(client_model_year)"',
'CLIENT_PRODUCT_NAME="<(client_product_name)"',
'CLIENT_DEVICE_NAME="<(client_device_name)"',
'CLIENT_ARCH_NAME="<(client_arch_name)"',
'CLIENT_PLATFORM="<(client_platform)"',
'CLIENT_FORM_FACTOR="<(client_form_factor)"',
'CLIENT_VERSION="<(client_version)"',
],
}], # client_info_source=="compiled"
['client_info_source=="runtime"', {
'defines': [
'RUNTIME_CLIENT_INFO',
],
'dependencies': [
'<(read_client_info_path)',
],
}], # client_info_source=="runtime"
], # conditions
}, # widevine_cdm_static target
{
'toolsets' : [ 'target' ],
'target_name': 'widevine_ce_cdm_shared',
'type': 'shared_library',
'dependencies': [
'widevine_ce_cdm_static',
],
'direct_dependent_settings': {
'include_dirs': [
'include',
],
},
},
{
'toolsets' : [ 'target' ],
'target_name': 'dummy',
'type': 'none',
},
],
}