def cmd_projgen(args, open_cmake=False): if not os.path.isfile(args.project_file): error_project_not_found(args.project_file) project = cryproject.CryProject() try: project.load(args.project_file) except Exception: error_project_json_decode(args.project_file) project_path = os.path.abspath(os.path.dirname(args.project_file)) engine_path = crypath.get_engine_path() cmakelists_dir = project.cmakelists_dir() if not cmakelists_dir: error_code_folder_not_specified() code_directory = os.path.join(project_path, cmakelists_dir) # Generate solutions crysolutiongenerator.generate_solution(args.project_file, code_directory, engine_path) # Skip on Crytek build agents if args.buildmachine: return cmakelists_path = os.path.join(os.path.join(project_path, cmakelists_dir), 'CMakeLists.txt') # Generate the Solution if code_directory is not None and os.path.isfile(cmakelists_path): generate_project_solution(project_path, code_directory, open_cmake)
def cmd_projgen(args): if not os.path.isfile(args.project_file): error_project_not_found(args.project_file) project = cryproject.load(args.project_file) if project is None: error_project_json_decode(args.project_file) project_path = os.path.abspath(os.path.dirname(args.project_file)) engine_path = get_engine_path() cmakelists_dir = cryproject.cmakelists_dir(project) code_directory = os.path.join(project_path, cmakelists_dir) # Generate solutions crysolutiongenerator.generate_solution(args.project_file, code_directory, engine_path) # Skip on Crytek build agents if args.buildmachine: return cmakelists_path = os.path.join(os.path.join(project_path, cmakelists_dir), 'CMakeLists.txt') # Generate the Solution if code_directory is not None and os.path.isfile(cmakelists_path): generate_project_solution(project_path, code_directory)
def cmd_projgen(args): if not os.path.isfile (args.project_file): error_project_not_found (args.project_file) project= cryproject.load (args.project_file) if project is None: error_project_json_decode (args.project_file) project_path= os.path.abspath (os.path.dirname (args.project_file)) engine_path= get_engine_path() cmakelists_dir= cryproject.cmakelists_dir(project) code_directory = os.path.join (project_path, cmakelists_dir) # Generate solutions crysolutiongenerator.generate_solution(args.project_file, code_directory, engine_path) cmakelists_path = os.path.join(os.path.join (project_path, cmakelists_dir), 'CMakeLists.txt') # Generate the Solution, skip on Crytek build agents if cmakelists_dir is not None and os.path.exists(cmakelists_path) and not args.buildmachine: cmake_path= get_cmake_path() if cmake_path is None: error_cmake_not_found() solution_path= os.path.join (project_path, get_solution_dir (args)) subcmd= ( cmake_path, {'win_x86': '-AWin32', 'win_x64': '-Ax64'}[args.platform], '-DCMAKE_TOOLCHAIN_FILE=%s' % os.path.join (engine_path, 'Tools', 'CMake', 'toolchain', 'windows', 'WindowsPC-MSVC.cmake'), os.path.join (project_path, cmakelists_dir) ) if not os.path.isdir (solution_path): os.makedirs (solution_path) print_subprocess (subcmd) errcode= subprocess.call(subcmd, cwd= solution_path) if errcode != 0: sys.exit (errcode)
def cmd_projgen(args): if not os.path.isfile(args.project_file): error_project_not_found(args.project_file) project = cryproject.load(args.project_file) if project is None: error_project_json_decode(args.project_file) project_path = os.path.abspath(os.path.dirname(args.project_file)) engine_path = get_engine_path() cmakelists_dir = cryproject.cmakelists_dir(project) code_directory = os.path.join(project_path, cmakelists_dir) # Generate solutions crysolutiongenerator.generate_solution(args.project_file, code_directory, engine_path) cmakelists_path = os.path.join(os.path.join(project_path, cmakelists_dir), 'CMakeLists.txt') # Generate the Solution, skip on Crytek build agents if cmakelists_dir is not None and os.path.exists( cmakelists_path) and not args.buildmachine: cmake_dir = get_cmake_dir() cmake_path = get_cmake_exe_path() if cmake_path is None: error_cmake_not_found() # Run the GUI to select a config for CMake. config = cryrun_gui.select_config() #No config means the user canceled while selecting the config, so we can safely exit. if not config: sys.exit(0) # By default the CMake output is hidden. This is printed to make sure the user knows it's not stuck. print("Generating solution...") toolchain = config['cmake_toolchain'] solution_path = os.path.join(project_path, config['cmake_builddir']) generator = config['cmake_generator'] if not os.path.isdir(solution_path): os.makedirs(solution_path) if toolchain: toolchain = toolchain.replace('\\', '/') toolchain = os.path.join(cmake_dir, toolchain) prepare_cmake_cache(solution_path, generator) cmake_command = ['"{}"'.format(cmake_path)] cmake_command.append('-Wno-dev') if toolchain: cmake_command.append( '-DCMAKE_TOOLCHAIN_FILE="{}"'.format(toolchain)) cmake_command.append('"{}"'.format(cmakelists_dir)) cmake_command.append('-B"{}"'.format(solution_path)) cmake_command.append('-G"{}"'.format(generator)) # Filter empty commands, and convert the list to a string. cmake_command = list(filter(bool, cmake_command)) command_str = ("".join("{} ".format(e) for e in cmake_command)).strip() try: subprocess.check_output(command_str, universal_newlines=True) except subprocess.CalledProcessError as e: if not e.returncode == 0: print( "Encountered and error while running command '{}'!".format( command_str)) print(e.output) print("Generating solution has failed!") print("Press Enter to exit") input()