()
| 926 | |
| 927 | # Find path to cmake executable, as one of the activated tools, in PATH, or from installed tools. |
| 928 | def find_cmake(): |
| 929 | def locate_cmake_from_tool(tool): |
| 930 | tool_path = get_required_path([tool]) |
| 931 | tool_path = tool_path[-1] |
| 932 | cmake_exe = 'cmake.exe' if WINDOWS else 'cmake' |
| 933 | cmake_exe = os.path.join(tool_path, cmake_exe) |
| 934 | if os.path.isfile(cmake_exe): |
| 935 | return cmake_exe |
| 936 | |
| 937 | # 1. If user has activated a specific cmake tool, then use that tool to configure the build. |
| 938 | for tool in reversed(tools): |
| 939 | if tool.id == 'cmake' and tool.is_active(): |
| 940 | cmake_exe = locate_cmake_from_tool(tool) |
| 941 | if cmake_exe: |
| 942 | info(f'Found installed+activated CMake tool at "{cmake_exe}"') |
| 943 | return cmake_exe |
| 944 | |
| 945 | # 2. If cmake already exists in PATH, then use that cmake to configure the build. |
| 946 | cmake_exe = shutil.which('cmake') |
| 947 | if cmake_exe: |
| 948 | info(f'Found CMake from PATH at "{cmake_exe}"') |
| 949 | return cmake_exe |
| 950 | |
| 951 | # 3. Finally, if user has installed a cmake tool, but has not activated that, then use |
| 952 | # that tool. This enables a single-liner directive |
| 953 | # "emsdk install cmake-4.2.0-rc3-64bit llvm-git-main-64bit" to first install CMake, and |
| 954 | # then use it to configure to build LLVM. |
| 955 | for tool in reversed(tools): |
| 956 | if tool.id == 'cmake' and tool.is_installed(): |
| 957 | cmake_exe = locate_cmake_from_tool(tool) |
| 958 | if cmake_exe: |
| 959 | info(f'Found installed CMake tool at "{cmake_exe}"') |
| 960 | return cmake_exe |
| 961 | |
| 962 | exit_with_error('Unable to find "cmake" in PATH, or as installed/activated tool! Please install CMake first') |
| 963 | |
| 964 | |
| 965 | def make_build(build_root, build_type): |
no test coverage detected