diff --git a/.gitignore b/.gitignore index 65380c109..48f30c292 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ ImportExecutables.cmake **/CMakeScripts **/cmake_install.cmake **/install_manifest.txt +*.cbp # MSVC *.sln diff --git a/CMakeLists.txt b/CMakeLists.txt index 8609b404e..5f3fa3410 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ option(BUILD_JAVA "Build ViZDoom Java binding." OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden") if (COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) + cmake_policy(SET CMP0023 NEW) endif (COMMAND cmake_policy) # Add cmake_modules to module @@ -191,7 +192,7 @@ if (BUILD_PYTHON OR BUILD_PYTHON3) ${VIZDOOM_PYTHON_SRC_DIR}/ViZDoomPythonModule.cpp) pybind11_add_module(libvizdoom_python ${VIZDOOM_PYTHON_SOURCES}) - target_link_libraries(libvizdoom_python ${VIZDOOM_PYTHON_LIBS} libvizdoom_static) + target_link_libraries(libvizdoom_python PRIVATE ${VIZDOOM_PYTHON_LIBS} libvizdoom_static) set_target_properties(libvizdoom_python PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${VIZDOOM_PYTHON_OUTPUT_DIR} @@ -206,7 +207,7 @@ if (BUILD_PYTHON OR BUILD_PYTHON3) if (UNIX) add_custom_target(python_pip_package ALL COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/assemble_pip_package.sh ${_PYTHON_VERSION} - COMMENT "Assembling pip package in ${VIZDOOM_PYTHON2_OUTPUT_DIR}/pip_package") + COMMENT "Assembling pip package in ${VIZDOOM_PYTHON_OUTPUT_DIR}/pip_package") # vizdoom, vizdoom.pk3 and freedoom2.wad are needed to assemble the package add_dependencies(python_pip_package libvizdoom_python vizdoom pk3 freedoom2) @@ -250,7 +251,7 @@ if (BUILD_LUA) ${VIZDOOM_LUA_SRC_DIR}/ViZDoomLuaModule.cpp) add_library(libvizdoom_lua SHARED ${VIZDOOM_LUA_SOURCES}) - target_link_libraries(libvizdoom_lua ${VIZDOOM_LUA_LIBS} libvizdoom_static) + target_link_libraries(libvizdoom_lua PRIVATE ${VIZDOOM_LUA_LIBS} libvizdoom_static) set_target_properties(libvizdoom_lua PROPERTIES PREFIX "" @@ -320,7 +321,7 @@ if (BUILD_JAVA) ${VIZDOOM_JAVA_SRC_DIR}/ViZDoomGameJava.cpp) add_library(libvizdoom_java SHARED ${VIZDOOM_JAVA_SOURCES}) - target_link_libraries(libvizdoom_java ${VIZDOOM_JAVA_LIBS} libvizdoom_static) + target_link_libraries(libvizdoom_java PRIVATE ${VIZDOOM_JAVA_LIBS} libvizdoom_static) set_target_properties(libvizdoom_java PROPERTIES diff --git a/scripts/assemble_luarocks_package.sh b/scripts/assemble_luarocks_package.sh index 650beff04..f14a9bcab 100755 --- a/scripts/assemble_luarocks_package.sh +++ b/scripts/assemble_luarocks_package.sh @@ -28,14 +28,15 @@ fi rm -rf ${PACKAGE_DEST_PATH} rm -rf ${SHARED_PACKAGE_DEST_PATH} -mkdir ${PACKAGE_DEST_PATH} -mkdir ${SHARED_PACKAGE_DEST_PATH} +mkdir -p ${PACKAGE_DEST_PATH} +mkdir -p ${SHARED_PACKAGE_DEST_PATH} + cp -r ${PACKAGE_SOURCE}/* ${SHARED_PACKAGE_DEST_PATH} cp -r ${PACKAGE_SOURCE}/* ${PACKAGE_DEST_PATH} -cp ${VIZDOOM_EXEC_PATH} ${PACKAGE_DEST_PATH} cp ${LUA_BIN_PATH} ${PACKAGE_DEST_PATH} -cp ${FREEDOOM_PATH} ${PACKAGE_DEST_PATH} +cp ${VIZDOOM_EXEC_PATH} ${PACKAGE_DEST_PATH} cp ${VIZDOOM_PK3_PATH} ${PACKAGE_DEST_PATH} +cp ${FREEDOOM_PATH} ${PACKAGE_DEST_PATH} mkdir -p ${SCENARIOS_DEST_DIR} cp ${SCENARIOS_PATH}/*.wad ${SCENARIOS_DEST_DIR} cp ${SCENARIOS_PATH}/*.cfg ${SCENARIOS_DEST_DIR} diff --git a/scripts/assemble_pip_package.sh b/scripts/assemble_pip_package.sh index 96d6330af..324fa5e0e 100755 --- a/scripts/assemble_pip_package.sh +++ b/scripts/assemble_pip_package.sh @@ -17,7 +17,8 @@ else fi VIZDOOM_PK3_PATH="./bin/vizdoom.pk3" -PYTHON_BIN_PATH="$(ls ${PACKAGE_DEST_DIRECTORY}/vizdoom*.so)" +PYTHON_BIN_PATH="$(ls ${PACKAGE_DEST_DIRECTORY}/vizdoom*)" +PYTHON_BIN_EXT="${PYTHON_BIN_PATH##*.}" FREEDOOM_PATH="./bin/freedoom2.wad" SCENARIOS_DEST_DIR="${PACKAGE_DEST_PATH}/scenarios" @@ -34,12 +35,14 @@ if [ ! -e ${VIZDOOM_EXEC_PATH} ] || [ ! -e ${VIZDOOM_PK3_PATH} ]; then fi rm -rf ${PACKAGE_DEST_PATH} -cp -r ${PACKAGE_SOURCE} ${PACKAGE_DEST_PATH} -cp ${VIZDOOM_EXEC_PATH} ${PACKAGE_DEST_PATH} +mkdir -p ${PACKAGE_DEST_PATH} + +cp -r ${PACKAGE_SOURCE}/* ${PACKAGE_DEST_PATH} cp ${PYTHON_BIN_PATH} ${PACKAGE_DEST_PATH} -mv ${PYTHON_BIN_PATH} "${PACKAGE_DEST_PATH}/vizdoom.so" -cp ${FREEDOOM_PATH} ${PACKAGE_DEST_PATH} +mv "$(ls ${PACKAGE_DEST_PATH}/vizdoom*)" "${PACKAGE_DEST_PATH}/vizdoom.${PYTHON_BIN_EXT}" +cp ${VIZDOOM_EXEC_PATH} ${PACKAGE_DEST_PATH} cp ${VIZDOOM_PK3_PATH} ${PACKAGE_DEST_PATH} +cp ${FREEDOOM_PATH} ${PACKAGE_DEST_PATH} mkdir -p ${SCENARIOS_DEST_DIR} cp ${SCENARIOS_PATH}/*.wad ${SCENARIOS_DEST_DIR} cp ${SCENARIOS_PATH}/*.cfg ${SCENARIOS_DEST_DIR} diff --git a/setup.py b/setup.py index e7bc01d2d..48c37601c 100644 --- a/setup.py +++ b/setup.py @@ -57,9 +57,9 @@ def run(self): cmake_arg_list.append("-DCMAKE_BUILD_TYPE=Release") cmake_arg_list.append("-DBUILD_PYTHON=ON") cmake_arg_list.append("-DPYTHON_EXECUTABLE={}".format(python_executable)) - cmake_arg_list.append("-DPYTHON_LIBRARY={}".format(python_library)) - cmake_arg_list.append("-DPYTHON_INCLUDE_DIR={}".format(python_include_dir)) - cmake_arg_list.append("-DNUMPY_INCLUDES={}".format(numpy_include_dir)) + #cmake_arg_list.append("-DPYTHON_LIBRARY={}".format(python_library)) + #cmake_arg_list.append("-DPYTHON_INCLUDE_DIR={}".format(python_include_dir)) + #cmake_arg_list.append("-DNUMPY_INCLUDES={}".format(numpy_include_dir)) if python_version == "3": cmake_arg_list.append("-DBUILD_PYTHON3=ON") else: diff --git a/src/lib_python/ViZDoomPythonModule.cpp b/src/lib_python/ViZDoomPythonModule.cpp index 9b3861ae2..67d4d7810 100644 --- a/src/lib_python/ViZDoomPythonModule.cpp +++ b/src/lib_python/ViZDoomPythonModule.cpp @@ -27,8 +27,6 @@ #include #include -namespace pyb = pybind11; - using namespace vizdoom; /* C++ code to expose DoomGame library via Python */