Skip to content

Commit

Permalink
chore(build): finalize cmake and bazel support
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie-Cui committed Jan 7, 2025
1 parent 439f3f3 commit 9142d3e
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 29 deletions.
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ build:macos --macos_minimum_os=13.0
build:macos --host_macos_minimum_os=13.0
build:macos --action_env MACOSX_DEPLOYMENT_TARGET=13.0

# HACK https://github.com/bazelbuild/apple_support
build --enable_platform_specific_config
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain

build:asan --features=asan
build:ubsan --features=ubsan

Expand Down
1 change: 1 addition & 0 deletions bazel/FourQlib.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ make(
}),
lib_source = ":all_srcs",
out_static_libs = ["libFourQ.a"],
# FIXME try to install header in include/fourq/*.h
targets = [
"libFourQ",
"install",
Expand Down
5 changes: 5 additions & 0 deletions bazel/libgmp.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ configure_make_variant(
name = "gmp",
configure_options = ["--with-pic"],
copts = ["-w"],
# HACK fix macos build
# see: https://github.com/bazel-contrib/rules_foreign_cc/issues/338
env = {
"AR": "",
},
lib_name = "libgmp",
lib_source = ":sources",
out_static_libs = [
Expand Down
20 changes: 12 additions & 8 deletions cmake/deps/fourq.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ ExternalProject_Add(fourq
COMMAND
${CMAKE_MAKE_PROGRAM} PREFIX=${CMAKE_THIRDPARTY_PREFIX}
-C FourQ_64bit_and_portable install
COMMAND
mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/FourQ.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
COMMAND
mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/FourQ_api.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
COMMAND
mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/FourQ_internal.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
COMMAND
mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/random.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
#
# FIXME wait for bazel try to install header in include/fourq/*.h
# see: fourq.BUILD
#
# COMMAND
# mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/FourQ.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
# COMMAND
# mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/FourQ_api.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
# COMMAND
# mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/FourQ_internal.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
# COMMAND
# mv ${CMAKE_THIRDPARTY_INCLUDEDIR}/random.h ${CMAKE_THIRDPARTY_INCLUDEDIR}/fourq/
EXCLUDE_FROM_ALL true
LOG_DOWNLOAD On
LOG_CONFIGURE On
Expand Down
16 changes: 2 additions & 14 deletions yacl/crypto/aes/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:yacl.bzl", "AES_COPT_FLAGS", "yacl_cc_binary", "yacl_cc_library", "yacl_cc_test")
load("//bazel:yacl.bzl", "AES_COPT_FLAGS", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

yacl_cc_binary(
name = "aes_bench",
srcs = ["aes_bench.cc"],
copts = AES_COPT_FLAGS,
deps = [
":aes_opt",
"//yacl/crypto/rand",
"//yacl/crypto/tools:prg",
"@com_github_google_benchmark//:benchmark_main",
],
)

yacl_cc_library(
name = "aes_intrinsics",
srcs = [
"aes_intrinsics.h",
],
copts = AES_COPT_FLAGS,
deps = [
"//yacl/base:secparam",
"//yacl/base:int128",
"//yacl/base:secparam",
] + select({
"@platforms//cpu:aarch64": [
"@com_github_dltcollab_sse2neon//:sse2neon",
Expand Down
2 changes: 1 addition & 1 deletion yacl/crypto/ecc/FourQlib/FourQ_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#pragma once

#include "fourq/FourQ_internal.h"
#include "FourQ_internal.h"

#include "yacl/crypto/ecc/group_sketch.h"

Expand Down
4 changes: 2 additions & 2 deletions yacl/crypto/rand/drbg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ yacl_cc_library(
)

yacl_cc_test(
name = "factory_test",
srcs = ["factory_test.cc"],
name = "drbg_test",
srcs = ["drbg_test.cc"],
deps = [
":drbg",
],
Expand Down
4 changes: 2 additions & 2 deletions yacl/crypto/rand/entropy_source/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ yacl_cc_library(
)

yacl_cc_test(
name = "factory_test",
name = "entropy_source_test",
srcs = [
"factory_test.cc",
"entropy_source_test.cc",
],
deps = [
":entropy_source",
Expand Down
2 changes: 1 addition & 1 deletion yacl/kernel/algorithms/ferret_ote.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "yacl/kernel/type/ot_store_utils.h"
#include "yacl/math/gadget.h"
#include "yacl/base/secparam.h"
#include "yacl/utils/cuckoo_index.h"
#include "yacl/crypto/tools/cuckoo_index.h"

/* submodules */
#include "yacl/kernel/algorithms/ferret_ote_rn.h"
Expand Down
2 changes: 1 addition & 1 deletion yacl/kernel/algorithms/ferret_ote_un.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "yacl/math/gadget.h"
#include "yacl/base/secparam.h"
#include "yacl/utils/cuckoo_index.h"
#include "yacl/crypto/tools/cuckoo_index.h"

/* submodules */
#include "yacl/crypto/tools/rp.h"
Expand Down

0 comments on commit 9142d3e

Please sign in to comment.