Skip to content

Commit 249c88a

Browse files
Merge pull request #6 from clearmatics/build-fixes
Build fixes
2 parents d73d448 + fc30dcd commit 249c88a

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
cmake_minimum_required(VERSION 2.8)
22

3+
# Change the compiler BEFORE the first `project()` command to avoid an infinite loop.
4+
# See: https://public.kitware.com/pipermail/cmake/2009-November/033133.html
5+
if(APPLE)
6+
# If custom llvm compilers are available, use them (for openmp
7+
# support), otherwise disable multicore.
8+
if(EXISTS "/usr/local/opt/llvm/bin/clang")
9+
set(CMAKE_C_COMPILER "/usr/local/opt/llvm/bin/clang")
10+
set(CMAKE_CXX_COMPILER "/usr/local/opt/llvm/bin/clang++")
11+
endif()
12+
endif()
13+
314
project(libfqfft)
415

516
set(
@@ -57,7 +68,11 @@ else()
5768
set(DEPENDS_DIR "${DEPENDS_DIR}")
5869
endif()
5970

60-
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
71+
if(APPLE)
72+
set(WITH_PROCPS OFF)
73+
endif()
74+
75+
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
6176
# Common compilation flags and warning configuration
6277
set(
6378
CMAKE_CXX_FLAGS

libfqfft/polynomial_arithmetic/basic_operations.tcc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Implementation of interfaces for basic polynomial operation routines.
55
66
See basic_operations.hpp .
7-
7+
88
*****************************************************************************
99
* @author This file is part of libfqfft, developed by SCIPR Lab
1010
* and contributors (see AUTHORS).
@@ -15,6 +15,7 @@
1515
#define BASIC_OPERATIONS_TCC_
1616

1717
#include <algorithm>
18+
#include <functional>
1819

1920
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>
2021
#include <libfqfft/kronecker_substitution/kronecker_substitution.hpp>
@@ -75,7 +76,7 @@ void _polynomial_addition(std::vector<FieldT> &c, const std::vector<FieldT> &a,
7576
std::copy(b.begin() + a_size, b.end(), c.begin() + a_size);
7677
}
7778
}
78-
79+
7980
_condense(c);
8081
}
8182

@@ -95,7 +96,7 @@ void _polynomial_subtraction(std::vector<FieldT> &c, const std::vector<FieldT> &
9596
{
9697
size_t a_size = a.size();
9798
size_t b_size = b.size();
98-
99+
99100
if (a_size > b_size)
100101
{
101102
c.resize(a_size);
@@ -148,7 +149,11 @@ void _polynomial_multiplication_on_fft(std::vector<FieldT> &c, const std::vector
148149
#endif
149150

150151
const FieldT sconst = FieldT(n).inverse();
151-
std::transform(c.begin(), c.end(), c.begin(), std::bind1st(std::multiplies<FieldT>(), sconst));
152+
std::transform(
153+
c.begin(),
154+
c.end(),
155+
c.begin(),
156+
std::bind(std::multiplies<FieldT>(), sconst, std::placeholders::_1));
152157
_condense(c);
153158
}
154159

libfqfft/polynomial_arithmetic/xgcd.tcc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Implementation of interfaces for extended GCD routines.
55
66
See xgcd.hpp .
7-
7+
88
*****************************************************************************
99
* @author This file is part of libfqfft, developed by SCIPR Lab
1010
* and contributors (see AUTHORS).
@@ -58,9 +58,21 @@ void _polynomial_xgcd(const std::vector<FieldT> &a, const std::vector<FieldT> &b
5858
_polynomial_division(V1, R, V3, b);
5959

6060
FieldT lead_coeff = G.back().inverse();
61-
std::transform(G.begin(), G.end(), G.begin(), std::bind1st(std::multiplies<FieldT>(), lead_coeff));
62-
std::transform(U.begin(), U.end(), U.begin(), std::bind1st(std::multiplies<FieldT>(), lead_coeff));
63-
std::transform(V1.begin(), V1.end(), V1.begin(), std::bind1st(std::multiplies<FieldT>(), lead_coeff));
61+
std::transform(
62+
G.begin(),
63+
G.end(),
64+
G.begin(),
65+
std::bind(std::multiplies<FieldT>(), lead_coeff, std::placeholders::_1));
66+
std::transform(
67+
U.begin(),
68+
U.end(),
69+
U.begin(),
70+
std::bind(std::multiplies<FieldT>(), lead_coeff, std::placeholders::_1));
71+
std::transform(
72+
V1.begin(),
73+
V1.end(),
74+
V1.begin(),
75+
std::bind(std::multiplies<FieldT>(), lead_coeff, std::placeholders::_1));
6476

6577
g = G;
6678
u = U;

0 commit comments

Comments
 (0)