Remove support for CMake builds

This also removes support for Travis and AppVeyor, as well as git
submodules for dependencies.

It also adjusts .gitignore to include dependencies (submodules are
implicitly ignored but are removed in this commit).

Finally, removes some CMake-specific code from the code generator.

BUG=

Change-Id: I4ebc04e530a574b412ef0ca81e4672db01f0ed92
Reviewed-on: https://dawn-review.googlesource.com/c/2040
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2018-10-31 10:53:11 +00:00
committed by Commit Bot service account
parent 84cde51741
commit 146edf5bec
22 changed files with 14 additions and 1230 deletions

View File

@@ -1,77 +0,0 @@
# Copyright 2017 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
find_package(PythonInterp REQUIRED)
include(CMakeParseArguments)
# Check for Jinja2
message(STATUS "${PYTHON_EXECUTABLE}")
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import jinja2"
RESULT_VARIABLE RET
)
if (NOT RET EQUAL 0)
message(FATAL_ERROR "Missing dependencies for code generation, please ensure you have python-jinja2 installed.")
endif()
function(Generate)
set(oneValueArgs LIB_NAME LIB_TYPE PRINT_NAME EXECUTABLE FOLDER)
set(multiValueArgs COMMAND_LINE_ARGS EXTRA_DEPS EXTRA_SOURCES)
cmake_parse_arguments(G "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
execute_process(
COMMAND ${G_COMMAND_LINE_ARGS} --print-dependencies
OUTPUT_VARIABLE DEPENDENCIES
RESULT_VARIABLE RET
)
if (NOT RET EQUAL 0)
message(STATUS ${RET})
message(FATAL_ERROR "Failed to get the dependencies for ${G_PRINT_NAME}.")
endif()
execute_process(
COMMAND ${G_COMMAND_LINE_ARGS} --print-outputs
OUTPUT_VARIABLE OUTPUTS
RESULT_VARIABLE RET
)
if (NOT RET EQUAL 0)
message(FATAL_ERROR "Failed to get the outputs for ${G_PRINT_NAME}.")
endif()
add_custom_command(
COMMAND ${G_COMMAND_LINE_ARGS}
DEPENDS ${DEPENDENCIES} ${G_EXTRA_DEPS}
OUTPUT ${OUTPUTS}
COMMENT "Generating files for ${G_PRINT_NAME}."
)
add_library(${G_LIB_NAME} ${G_LIB_TYPE}
${G_EXTRA_SOURCES}
${OUTPUTS}
)
DawnInternalTarget("${G_FOLDER}" ${G_LIB_NAME})
set_property(TARGET ${G_LIB_NAME} APPEND PROPERTY COMPILE_OPTIONS ${DAWN_GENERATED_FLAGS})
endfunction()
set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
set(GENERATOR_COMMON_ARGS
${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/main.py
${PROJECT_SOURCE_DIR}/dawn.json
-t ${CMAKE_CURRENT_SOURCE_DIR}/templates
-o ${CMAKE_CURRENT_BINARY_DIR}
PARENT_SCOPE
)

View File

@@ -503,16 +503,6 @@ def get_renders_for_targets(api_params, targets):
return renders
def output_to_files(outputs, output_dir):
for output in outputs:
output_file = output_dir + os.path.sep + output.name
directory = os.path.dirname(output_file)
if not os.path.exists(directory):
os.makedirs(directory)
with open(output_file, 'w') as outfile:
outfile.write(output.content)
def output_to_json(outputs, output_json):
json_root = {}
for output in outputs:
@@ -535,15 +525,10 @@ def main():
parser.add_argument('json', metavar='DAWN_JSON', nargs=1, type=str, help ='The DAWN JSON definition to use.')
parser.add_argument('-t', '--template-dir', default='templates', type=str, help='Directory with template files.')
parser.add_argument('-T', '--targets', required=True, type=str, help='Comma-separated subset of targets to output. Available targets: ' + ', '.join(allowed_targets))
# Arguments used only for the GN build
parser.add_argument(kExtraPythonPath, default=None, type=str, help='Additional python path to set before loading Jinja2')
parser.add_argument('--output-json-tarball', default=None, type=str, help='Name of the "JSON tarball" to create (tar is too annoying to use in python).')
parser.add_argument('--depfile', default=None, type=str, help='Name of the Ninja depfile to create for the JSON tarball')
parser.add_argument('--expected-outputs-file', default=None, type=str, help="File to compare outputs with and fail if it doesn't match")
# Arguments used only for the CMake build
parser.add_argument('-o', '--output-dir', default=None, type=str, help='Output directory for the generated source files.')
parser.add_argument('--print-dependencies', action='store_true', help='Prints a space separated list of file dependencies, used for CMake integration')
parser.add_argument('--print-outputs', action='store_true', help='Prints a space separated list of file outputs, used for CMake integration')
args = parser.parse_args()
@@ -555,27 +540,8 @@ def main():
targets = args.targets.split(',')
renders = get_renders_for_targets(api_params, targets)
# Print outputs and dependencies for CMake
if args.print_dependencies:
dependencies = set(
[os.path.abspath(args.template_dir + os.path.sep + render.template) for render in renders] +
[os.path.abspath(args.json[0])] +
[os.path.realpath(__file__)]
)
dependencies = [dependency.replace('\\', '/') for dependency in dependencies]
sys.stdout.write(';'.join(dependencies))
return 0
if args.print_outputs:
outputs = set(
[os.path.abspath(args.output_dir + os.path.sep + render.output) for render in renders]
)
outputs = [output.replace('\\', '/') for output in outputs]
sys.stdout.write(';'.join(outputs))
return 0
# The caller wants to assert that the outputs are what it expects.
# Load the file and compare with our renders. GN-only.
# Load the file and compare with our renders.
if args.expected_outputs_file != None:
with open(args.expected_outputs_file) as f:
expected = set([line.strip() for line in f.readlines()])
@@ -590,11 +556,7 @@ def main():
outputs = do_renders(renders, args.template_dir)
# CMake only: output all the files directly.
if args.output_dir != None:
output_to_files(outputs, args.output_dir)
# GN only: output the tarball and its depfile
# Output the tarball and its depfile
if args.output_json_tarball != None:
output_to_json(outputs, args.output_json_tarball)