in procgen/builder.py [0:0]
def _attempt_configure(build_type, package):
if "PROCGEN_CMAKE_PREFIX_PATH" in os.environ:
cmake_prefix_paths = [os.environ["PROCGEN_CMAKE_PREFIX_PATH"]]
else:
# guess some common qt cmake paths, it's unclear why cmake can't find qt without this
cmake_prefix_paths = ["/usr/local/opt/qt5/lib/cmake"]
conda_exe = shutil.which("conda")
if conda_exe is not None:
conda_info = json.loads(
sp.run(["conda", "info", "--json"], stdout=sp.PIPE).stdout
)
conda_prefix = conda_info["active_prefix"]
if conda_prefix is None:
conda_prefix = conda_info["conda_prefix"]
if platform.system() == "Windows":
conda_prefix = os.path.join(conda_prefix, "library")
conda_cmake_path = os.path.join(conda_prefix, "lib", "cmake", "Qt5")
# prepend this qt since it's likely to be loaded already by the python process
cmake_prefix_paths.insert(0, conda_cmake_path)
generator = "Unix Makefiles"
extra_configure_options = []
if platform.system() == "Windows":
generator = "Visual Studio 16 2019"
extra_configure_options.extend(["-A", "x64"])
configure_cmd = [
"cmake",
"-G",
generator,
*extra_configure_options,
"-DCMAKE_PREFIX_PATH=" + ";".join(cmake_prefix_paths),
f"-DLIBENV_DIR={gym3.libenv.get_header_dir()}",
"../..",
]
if package:
configure_cmd.append("-DPROCGEN_PACKAGE=ON")
if platform.system() != "Windows":
# this is not used on windows, the option needs to be passed to cmake --build instead
configure_cmd.append(f"-DCMAKE_BUILD_TYPE={build_type}")
check(run(configure_cmd), verbose=package)