diff --git a/CMakeLists.txt b/CMakeLists.txt index f7a8a5584..8d2a6ec00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.12) # Project + versions #----------------------------------------------------------------------------------------------------------------------- -project(ViZDoom VERSION 1.2.2) +project(ViZDoom VERSION 1.3.0) set(ViZDoom_VERSION_STR ${ViZDoom_VERSION_MAJOR}.${ViZDoom_VERSION_MINOR}.${ViZDoom_VERSION_PATCH}) set(ViZDoom_VERSION_ID ${ViZDoom_VERSION_MAJOR}${ViZDoom_VERSION_MINOR}${ViZDoom_VERSION_PATCH}) @@ -68,6 +68,14 @@ endif() if(APPLE) set(CMAKE_MACOSX_RPATH ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + + if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64") + set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE INTERNAL "" FORCE) + message(STATUS "Apple Silicon detected, building for arm64") + else() + set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE INTERNAL "" FORCE) + message(STATUS "Intel CPU detected, building for x86_64") + endif() endif(APPLE) diff --git a/scripts/assemble_pip_package.bat b/scripts/assemble_pip_package.bat deleted file mode 100755 index 466e22679..000000000 --- a/scripts/assemble_pip_package.bat +++ /dev/null @@ -1,61 +0,0 @@ -:: @echo off -setlocal enabledelayedexpansion - -set PYTHON_VERSION=%1 -set BIN_PATH=%2 -set SRC_PATH=%3 - -:: Replace back-slashes with forward-slashes -set "BIN_PATH=%BIN_PATH:/=\%" -set "SRC_PATH=%SRC_PATH:/=\%" - -set PACKAGE_DEST_DIRECTORY=%BIN_PATH%\python%PYTHON_VERSION% -set PACKAGE_DEST_PATH=%PACKAGE_DEST_DIRECTORY%\pip_package -set PACAKGE_INIT_FILE_SRC=%SRC_PATH%\src\lib_python\__init__.py - -set VIZDOOM_EXEC_PATH=%BIN_PATH%\vizdoom.exe -set VIZDOOM_PK3_PATH=%BIN_PATH%\vizdoom.pk3 -set FREEDOOM_PATH=%SRC_PATH%\src\freedoom2.wad -set BOTS_PATH=%SRC_PATH%\src\bots.cfg -set SCENARIOS_DEST_DIR=%PACKAGE_DEST_PATH%\scenarios -set SCENARIOS_PATH=%SRC_PATH%\scenarios -set GYM_WRAPPER_DEST_DIR=%PACKAGE_DEST_PATH%\gym_wrapper -set GYM_WRAPPER_PATH=%SRC_PATH%\gym_wrapper -set GYMNASIUM_WRAPPER_DEST_DIR=%PACKAGE_DEST_PATH%\gymnasium_wrapper -set GYMNASIUM_WRAPPER_PATH=%SRC_PATH%\gymnasium_wrapper - - -if not exist "%BIN_PATH%\python%PYTHON_VERSION%\vizdoom*.pyd" ( - echo "Library for specified Python version does not exist. Aborting." - exit /B 2 -) - -if not exist "%VIZDOOM_EXEC_PATH%" ( - echo "Required ViZDoom's resources do not exist. Aborting." - exit /B 3 -) - -if not exist "%VIZDOOM_PK3_PATH%" ( - echo "Required ViZDoom's resources do not exist. Aborting." - exit /B 3 -) - -rmdir /Q /S %PACKAGE_DEST_PATH% -md %PACKAGE_DEST_PATH% - -copy "%PACAKGE_INIT_FILE_SRC%" "%PACKAGE_DEST_PATH%" -copy "%VIZDOOM_EXEC_PATH%" "%PACKAGE_DEST_PATH%" -copy "%VIZDOOM_PK3_PATH%" "%PACKAGE_DEST_PATH%" -copy "%BIN_PATH%\python%PYTHON_VERSION%\vizdoom*.pyd" "%PACKAGE_DEST_PATH%" -copy "%FREEDOOM_PATH%" "%PACKAGE_DEST_PATH%" -copy "%BOTS_PATH%" "%PACKAGE_DEST_PATH%" -copy "%BIN_PATH%\*.dll" "%PACKAGE_DEST_PATH%" - -md "%SCENARIOS_DEST_DIR% -copy "%SCENARIOS_PATH%\*.wad" "%SCENARIOS_DEST_DIR%" -copy "%SCENARIOS_PATH%\*.cfg" "%SCENARIOS_DEST_DIR%" - -md "%GYM_WRAPPER_DEST_DIR% -copy "%GYM_WRAPPER_PATH%\*.py" "%GYM_WRAPPER_DEST_DIR%" -md "%GYMNASIUM_WRAPPER_DEST_DIR% -copy "%GYMNASIUM_WRAPPER_PATH%\*.py" "%GYMNASIUM_WRAPPER_DEST_DIR%" diff --git a/scripts/assemble_pip_package.sh b/scripts/assemble_pip_package.sh deleted file mode 100755 index 810f2afa9..000000000 --- a/scripts/assemble_pip_package.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -PYTHON_VERSION=$1 -BIN_PATH=$2 -SRC_PATH=$3 - -if [ $# -ne 3 ];then - echo "Exactly three arguments required. Aborting." - exit 1 -fi - -PACKAGE_DEST_DIRECTORY="${BIN_PATH}/python${PYTHON_VERSION}" -PACKAGE_DEST_PATH="${PACKAGE_DEST_DIRECTORY}/pip_package" -PACKAGE_INIT_FILE_SRC="${SRC_PATH}/src/lib_python/__init__.py" - -if [ "$(uname)" == "Darwin" ]; then - VIZDOOM_EXEC_PATH="${BIN_PATH}/vizdoom.app/Contents/MacOS/vizdoom" -else - VIZDOOM_EXEC_PATH="${BIN_PATH}/vizdoom" -fi - -VIZDOOM_PK3_PATH="${BIN_PATH}/vizdoom.pk3" -PYTHON_BIN_PATH="$(ls ${PACKAGE_DEST_DIRECTORY}/vizdoom*)" -FREEDOOM_PATH="${SRC_PATH}/src/freedoom2.wad" -BOTS_PATH="${SRC_PATH}/src/bots.cfg" -SCENARIOS_DEST_DIR="${PACKAGE_DEST_PATH}/scenarios" -SCENARIOS_PATH="${SRC_PATH}/scenarios" -GYM_WRAPPER_DEST_DIR="${PACKAGE_DEST_PATH}/gym_wrapper" -GYM_WRAPPER_PATH="${SRC_PATH}/gym_wrapper" -GYMNASIUM_WRAPPER_DEST_DIR="${PACKAGE_DEST_PATH}/gymnasium_wrapper" -GYMNASIUM_WRAPPER_PATH="${SRC_PATH}/gymnasium_wrapper" - -if [ ! -e ${PYTHON_BIN_PATH} ]; then - echo "Library for specified Python version does not exist. Aborting." - exit 2 -fi - -if [ ! -e ${VIZDOOM_EXEC_PATH} ] || [ ! -e ${VIZDOOM_PK3_PATH} ]; then - echo "Required ViZDoom's resources do not exist. Aborting." - exit 3 -fi - -rm -rf ${PACKAGE_DEST_PATH} -mkdir -p ${PACKAGE_DEST_PATH} - -cp ${PACKAGE_INIT_FILE_SRC} ${PACKAGE_DEST_PATH} -cp ${PYTHON_BIN_PATH} ${PACKAGE_DEST_PATH} -cp ${VIZDOOM_EXEC_PATH} ${PACKAGE_DEST_PATH} -cp ${VIZDOOM_PK3_PATH} ${PACKAGE_DEST_PATH} -cp ${FREEDOOM_PATH} ${PACKAGE_DEST_PATH} -cp ${BOTS_PATH} ${PACKAGE_DEST_PATH} - -mkdir -p ${SCENARIOS_DEST_DIR} -cp ${SCENARIOS_PATH}/*.wad ${SCENARIOS_DEST_DIR} -cp ${SCENARIOS_PATH}/*.cfg ${SCENARIOS_DEST_DIR} - -mkdir -p ${GYM_WRAPPER_DEST_DIR} -cp ${GYM_WRAPPER_PATH}/*.py ${GYM_WRAPPER_DEST_DIR} -mkdir -p ${GYMNASIUM_WRAPPER_DEST_DIR} -cp ${GYMNASIUM_WRAPPER_PATH}/*.py ${GYMNASIUM_WRAPPER_DEST_DIR} diff --git a/src/lib_python/CMakeLists.txt b/src/lib_python/CMakeLists.txt index 0ef3f2d84..082eca535 100644 --- a/src/lib_python/CMakeLists.txt +++ b/src/lib_python/CMakeLists.txt @@ -13,6 +13,7 @@ if(WIN32) endif() set(VIZDOOM_PYTHON_OUTPUT_DIR ${VIZDOOM_OUTPUT_DIR}/python${BUILD_PYTHON_VERSION}) +set(VIZDOOM_PYTHON_PACKAGE_DIR ${VIZDOOM_PYTHON_OUTPUT_DIR}/vizdoom) set(VIZDOOM_PYTHON_SRC_DIR ${VIZDOOM_SRC_DIR}/lib_python) set(VIZDOOM_PYTHON_INCLUDE_DIR ${VIZDOOM_INCLUDE_DIR} ${VIZDOOM_PYTHON_SRC_DIR}) @@ -70,16 +71,6 @@ set_target_properties(libvizdoom_python OUTPUT_NAME vizdoom PROJECT_LABEL "python${BUILD_PYTHON_VERSION} binding") -# if(UNIX) -# add_custom_target(python_pip_package ALL -# COMMAND ${VIZDOOM_SCRIPTS_DIR}/assemble_pip_package.sh ${BUILD_PYTHON_VERSION} ${VIZDOOM_OUTPUT_DIR} ${CMAKE_SOURCE_DIR} -# COMMENT "Assembling pip package in ${VIZDOOM_PYTHON_OUTPUT_DIR}/pip_package") -# elseif(WIN32) -# add_custom_target(python_pip_package ALL -# COMMAND ${VIZDOOM_SCRIPTS_DIR}/assemble_pip_package.bat ${BUILD_PYTHON_VERSION} ${VIZDOOM_OUTPUT_DIR} ${CMAKE_SOURCE_DIR} -# COMMENT "Assembling pip package in ${VIZDOOM_PYTHON_OUTPUT_DIR}/pip_package") -# endif() - add_custom_target(assemble_package ALL COMMAND ${CMAKE_COMMAND} -E make_directory ${VIZDOOM_PYTHON_PACKAGE_DIR} COMMAND ${CMAKE_COMMAND} -E copy $ ${VIZDOOM_PYTHON_PACKAGE_DIR}