Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ViZDoom #4933

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions V/ViZDoom/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

# See https://github.com/JuliaLang/Pkg.jl/issues/2942
# Once this Pkg issue is resolved, this must be removed
uuid = Base.UUID("a83860b7-747b-57cf-bf1f-3e79990d037f")
delete!(Pkg.Types.get_last_stdlibs(v"1.6.3"), uuid)

julia_versions = [v"1.6.3", v"1.7.0", v"1.8.0", v"1.9.0"]

name = "ViZDoom"
version = v"1.1.13"

# Collection of sources required to complete build
sources = [
ArchiveSource("https://github.com/mwydmuch/ViZDoom/archive/refs/tags/$version.tar.gz", "e379a242ada7e1028b7a635da672b0936d99da3702781b76a4400b83602d78c4"),
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/ViZDoom-*
mv ../CMakeLists.txt ../ViZDoomJuliaModule.cpp src/lib_julia/
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH=${prefix} \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_CROSSCOMPILING=FALSE \
-DJulia_PREFIX=${prefix} \
-DBUILD_JULIA=ON \
..
cmake --build . --parallel ${nproc}
cp -r bin/* ${libdir}
mv ../src/freedoom2.wad ${libdir}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds wrong. The content of the lib/ directory is

% tar tzvf x86_64-linux-gnu-cxx11-julia_version+1.6.3.tar.gz | grep lib/
-rwxr-xr-x 0/0           19920 1970-01-01 01:00 lib/arithchk
-rw-r--r-- 0/0        28544132 1970-01-01 01:00 lib/freedoom2.wad
-rwxr-xr-x 0/0           76024 1970-01-01 01:00 lib/lemon
-rw-r--r-- 0/0           25628 1970-01-01 01:00 lib/lempar.c
-rw-r--r-- 0/0         1416786 1970-01-01 01:00 lib/libvizdoom.a
-rwxr-xr-x 0/0          717640 1970-01-01 01:00 lib/libvizdoom.so
-rwxr-xr-x 0/0         1696184 1970-01-01 01:00 lib/libvizdoomjl.so
-rwxr-xr-x 0/0           19752 1970-01-01 01:00 lib/qnan
-rwxr-xr-x 0/0          216888 1970-01-01 01:00 lib/re2c
-rwxr-xr-x 0/0           20368 1970-01-01 01:00 lib/updaterevision
-rwxr-xr-x 0/0         5506216 1970-01-01 01:00 lib/vizdoom
-rw-r--r-- 0/0          630827 1970-01-01 01:00 lib/vizdoom.pk3
-rwxr-xr-x 0/0          144904 1970-01-01 01:00 lib/zipdir

There is a mix of shared libraries (only things which should be here), executable binaries (which should go to ${bindir}), source files (which shouldn't be in the tarball at all), files I have no idea what they are (*.wad and *.pk3) and static library (it's ok to have the static library in ${libdir}, but that's just useless for the purpose of calling a library from Julia, so we usually avoid having static libraries around).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I removed most files, but vizdoom.pk3 and freedoom2.wad seem to be needed. Otherwise games won't load.

mv ../scenarios $prefix/
install_license $WORKSPACE/srcdir/ViZDoom-*/README.md
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
include("../../L/libjulia/common.jl")
platforms = vcat(libjulia_platforms.(julia_versions)...)
platforms = expand_cxxstring_abis(platforms)
# Qt6Declarative_jll is not available for these architectures:
filter!(p -> arch(p) != "armv6l", platforms)

# The products that we will ensure are always built
products = [
LibraryProduct("libvizdoomjl", :libvizdoom),
FileProduct("scenarios", :scenarios)
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("boost_jll"),
Dependency("SDL2_jll"),
Dependency("libcxxwrap_julia_jll"),
BuildDependency("libjulia_jll"),
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
preferred_gcc_version = v"9",
julia_compat = "1.6")
11 changes: 11 additions & 0 deletions V/ViZDoom/bundled/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
find_package(JlCxx REQUIRED)

add_library(vizdoomjl SHARED ViZDoomJuliaModule.cpp)
target_link_libraries(vizdoomjl JlCxx::cxxwrap_julia ${VIZDOOM_LIBS} libvizdoom_static)
set_target_properties(vizdoomjl
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${VIZDOOM_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${VIZDOOM_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${VIZDOOM_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${VIZDOOM_OUTPUT_DIR}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${VIZDOOM_OUTPUT_DIR}")
Loading