|
| 1 | +#!/usr/bin/env python |
| 2 | +import os |
| 3 | + |
| 4 | +script_dir = os.path.dirname(__file__) |
| 5 | +node_root = os.path.normpath(os.path.join(script_dir, os.pardir)) |
| 6 | +output_dir = os.path.join(os.path.abspath(node_root), 'out') |
| 7 | + |
| 8 | +cmake_debug_path = os.path.join(output_dir, 'Debug', 'CMakeLists.txt') |
| 9 | +cmake_release_path = os.path.join(output_dir, 'Release', 'CMakeLists.txt') |
| 10 | + |
| 11 | +def fix_cmake_list(path): |
| 12 | + with open(path, 'r') as f: |
| 13 | + fixed_lines = [] |
| 14 | + for line in f.readlines(): |
| 15 | + line = line.replace('"../../', '"') |
| 16 | + line = line.replace('${CMAKE_CURRENT_LIST_DIR}/../..', '${CMAKE_CURRENT_LIST_DIR}') |
| 17 | + line = line.replace(' "src/tracing/trace_event.hsrc/util.h"\n', ' "src/tracing/trace_event.h"\n "src/util.h"\n') |
| 18 | + line = line.replace('"deps/include/v8-inspector.h"', '"deps/v8/include/v8-inspector.h"') |
| 19 | + line = line.replace('"deps/include/v8-inspector-protocol.h"', '"deps/v8/include/v8-inspector-protocol.h"') |
| 20 | + line = line.replace('"${builddir}/obj.target/node/gen', '"${builddir}/CMakeFiles/node.dir/obj/gen') |
| 21 | + line = line.replace('"${builddir}/obj.target/node', '"${builddir}/CMakeFiles/node.dir') |
| 22 | + fixed_lines.append(line) |
| 23 | + |
| 24 | + with open(path, 'w') as f: |
| 25 | + f.writelines(fixed_lines) |
| 26 | + |
| 27 | +def fix_cmake_lists(): |
| 28 | + fix_cmake_list(cmake_debug_path) |
| 29 | + fix_cmake_list(cmake_release_path) |
| 30 | + |
| 31 | +if __name__ == '__main__': |
| 32 | + fix_cmake_lists() |
0 commit comments