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

[primecount] Update to v7.2.0 and build for multiple microarchitectures #4675

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
34 changes: 28 additions & 6 deletions P/primecount/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

include(joinpath(@__DIR__, "..", "..", "platforms", "microarchitectures.jl"))

name = "primecount"
version = v"6.5.0"
version = v"7.2.0"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/kimwalisch/primecount.git", "fe433f39fa16eaeab41d7caaef90a9caefa32474"),
GitSource("https://github.com/kimwalisch/primecount.git", "d65b5f1e17fc2689549d3a373c1765298caf78ba"),
DirectorySource("./bundled"),
]

Expand All @@ -16,11 +18,14 @@ script = raw"""
cd $WORKSPACE/srcdir/primecount/
atomic_patch -p1 ../patches/0001-Allow-disabling-building-static-library-for-Windows.patch
mkdir build && cd build
# We disable popcnt in CMake settings, but we expand the microarchitectures to
# let the compiler deal with the appropriate flags.
cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DWITH_POPCNT=OFF \
..
make -j${nproc}
make install
Expand All @@ -29,10 +34,24 @@ make install
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# code contains std::string values, this is needed for GCC 4/5 version boundary compat
# code contains std::string values
platforms = expand_cxxstring_abis(platforms)
# Let's limit expansion to x86_64. For example I didn't see any difference
# between armv8_0 vs apple-m1 on the same hardware.
platforms = expand_microarchitectures(platforms; filter=p->arch(p)=="x86_64")

augment_platform_block = """
$(MicroArchitectures.augment)

function augment_platform!(platform::Platform)
# We augment only x86_64
@static if Sys.ARCH === :x86_64
augment_microarchitecture!(platform)
else
platform
end
end
"""

# The products that we will ensure are always built
products = [
Expand All @@ -43,8 +62,11 @@ products = [

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae")),
# For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD
# systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else.
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); platforms=filter(!Sys.isbsd, platforms)),
Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); platforms=filter(Sys.isbsd, platforms)),
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version = v"5.2.0")
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version=v"5.2.0", julia_compat="1.6", augment_platform_block)
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ Subject: [PATCH] Allow disabling building static library for Windows


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a311094..89d7c51e 100644
index 5b82faac..c31ba1c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,10 +21,6 @@ option(WITH_FLOAT128 "Use __float128 (requires libquadmath)" OFF)
option(WITH_JEMALLOC "Use jemalloc allocator" OFF)
option(WITH_MPI "Enable MPI support" OFF)
@@ -23,12 +23,6 @@ option(WITH_JEMALLOC "Use jemalloc allocator" OFF)

# libprimecount sanity checks ########################################

-# We don't yet support building libprimecount as a shared DLL
-# library on Windows. If you need this let me know...
-if(WIN32)
- set(BUILD_SHARED_LIBS OFF)
-endif()
Expand Down