Skip to content

Commit

Permalink
Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
musm committed Dec 5, 2019
1 parent 4bfba9d commit 060cfc2
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions deps/compile.jl
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
using BinaryProvider
using CMakeWrapper: cmake_executable
using Libdl: dlext
# using BinaryProvider
# using CMakeWrapper: cmake_executable
# using Libdl: dlext

function compile(libname, tarball_url, hash; prefix=BinaryProvider.global_prefix, verbose=false)
# download to tarball_path
tarball_path = joinpath(prefix, "downloads", "src.tar.gz")
download_verify(tarball_url, hash, tarball_path; force=true, verbose=verbose)
# function compile(libname, tarball_url, hash; prefix=BinaryProvider.global_prefix, verbose=false)
# # download to tarball_path
# tarball_path = joinpath(prefix, "downloads", "src.tar.gz")
# download_verify(tarball_url, hash, tarball_path; force=true, verbose=verbose)

# unpack into source_path
tarball_dir = joinpath(prefix, "downloads", dirname(first(list_tarball_files(tarball_path)))) # e.g. "hdf5-1.10.5"
source_path = joinpath(prefix, "downloads", "src")
verbose && @info("Unpacking $tarball_path into $source_path")
rm(tarball_dir, force=true, recursive=true)
rm(source_path, force=true, recursive=true)
unpack(tarball_path, dirname(tarball_dir); verbose=verbose)
mv(tarball_dir, source_path)
# # unpack into source_path
# tarball_dir = joinpath(prefix, "downloads", dirname(first(list_tarball_files(tarball_path)))) # e.g. "hdf5-1.10.5"
# source_path = joinpath(prefix, "downloads", "src")
# verbose && @info("Unpacking $tarball_path into $source_path")
# rm(tarball_dir, force=true, recursive=true)
# rm(source_path, force=true, recursive=true)
# unpack(tarball_path, dirname(tarball_dir); verbose=verbose)
# mv(tarball_dir, source_path)

build_dir = joinpath(source_path, "build")
mkdir(build_dir)
verbose && @info("Compiling in $build_dir...")
cd(build_dir) do
# build in parallel hdf5 mode if mpi is installed
parallel_mode_flag = Sys.which("mpicc") !== nothing ? "ON" : "OFF"
run(`$cmake_executable -DBUILD_TESTING:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=$parallel_mode_flag ..`)
run(`$cmake_executable --build . --config release -j $(Sys.CPU_THREADS + 1)`)
mkpath(libdir(prefix))
cp("bin/libhdf5.$dlext", joinpath(libdir(prefix), libname*"."*dlext), force=true, follow_symlinks=true)
cp("bin/libhdf5_hl.$dlext", joinpath(libdir(prefix), libname*"_hl."*dlext), force=true, follow_symlinks=true)
cp("bin/libhdf5_tools.$dlext", joinpath(libdir(prefix), libname*"_tools."*dlext), force=true, follow_symlinks=true)
end
end
# build_dir = joinpath(source_path, "build")
# mkdir(build_dir)
# verbose && @info("Compiling in $build_dir...")
# cd(build_dir) do
# # build in parallel hdf5 mode if mpi is installed
# parallel_mode_flag = Sys.which("mpicc") !== nothing ? "ON" : "OFF"
# run(`$cmake_executable -DBUILD_TESTING:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=$parallel_mode_flag ..`)
# run(`$cmake_executable --build . --config release -j $(Sys.CPU_THREADS + 1)`)
# mkpath(libdir(prefix))
# cp("bin/libhdf5.$dlext", joinpath(libdir(prefix), libname*"."*dlext), force=true, follow_symlinks=true)
# cp("bin/libhdf5_hl.$dlext", joinpath(libdir(prefix), libname*"_hl."*dlext), force=true, follow_symlinks=true)
# cp("bin/libhdf5_tools.$dlext", joinpath(libdir(prefix), libname*"_tools."*dlext), force=true, follow_symlinks=true)
# end
# end

0 comments on commit 060cfc2

Please sign in to comment.