-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo-sync-2023-10-20T15:35:58+0800 (#151)
* repo-sync-2023-10-20T15:35:58+0800 * Update mcl.patch
- Loading branch information
Jamie-Cui
authored
Oct 21, 2023
1 parent
dc041ce
commit 3982ecb
Showing
88 changed files
with
6,444 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
load("@yacl//bazel:yacl.bzl", "yacl_cmake_external") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
filegroup( | ||
name = "source", | ||
srcs = glob(["**"]), | ||
) | ||
|
||
# This is the value could be defined by --config=android_arm64 | ||
config_setting( | ||
name = "cpu_arm64_v8a", | ||
values = {"cpu": "arm64-v8a"}, | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
default_config = { | ||
"MCL_BUILD_TESTING": "OFF", | ||
# remove dependency on libgmp | ||
"MCL_TEST_WITH_GMP": "OFF", | ||
"MCL_STATIC_LIB": "ON", | ||
} | ||
|
||
android_config = { | ||
"MCL_BUILD_TESTING": "OFF", | ||
# remove dependency on libgmp | ||
"MCL_TEST_WITH_GMP": "OFF", | ||
"MCL_STATIC_LIB": "ON", | ||
"MCL_USE_LLVM": "OFF", | ||
"CMAKE_SYSTEM_NAME": "Android", | ||
"CMAKE_ANDROID_NDK": "$ANDROID_NDK_HOME", | ||
"CMAKE_ANDROID_ARCH_ABI": "arm64-v8a", | ||
} | ||
|
||
yacl_cmake_external( | ||
name = "mcl", | ||
build_args = ["-j"], | ||
cache_entries = select({ | ||
":cpu_arm64_v8a": android_config, | ||
"//conditions:default": default_config, | ||
}), | ||
# generate_crosstool_file = False, | ||
lib_source = ":source", | ||
out_static_libs = [ | ||
"libmcl.a", | ||
], | ||
alwayslink = True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 2b54b261..4c8eb32b 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -146,6 +146,11 @@ target_compile_options(mcl_st PRIVATE ${MCL_COMPILE_OPTIONS}) | ||
# target_compile_features(mcl_st PUBLIC cxx_std_11) | ||
|
||
|
||
+set(TARGET_FLAG "") | ||
+if(DEFINED CMAKE_ANDROID_ARCH_LLVM_TRIPLE) | ||
+ set(TARGET_FLAG "--target=${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}") | ||
+endif() | ||
+ | ||
# use bint-x64 on x64, bint${BIT}.ll on the other CPU | ||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") # Win64 | ||
find_program(ML64 ml64.exe HINTS "${cl_path}" DOC "path to assembler") | ||
@@ -172,7 +177,7 @@ else() | ||
target_compile_definitions(mcl_st PUBLIC MCL_BINT_ASM_X64=0) | ||
|
||
add_custom_command(OUTPUT ${BINT_OBJ} | ||
- COMMAND ${CMAKE_CXX_COMPILER} -c -o ${BINT_OBJ} ${CMAKE_CURRENT_SOURCE_DIR}/src/bint${BIT}.ll -O3 -fPIC | ||
+ COMMAND ${CMAKE_CXX_COMPILER} -c -o ${BINT_OBJ} ${CMAKE_CURRENT_SOURCE_DIR}/src/bint${BIT}.ll -O3 -fPIC ${TARGET_FLAG} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | ||
add_custom_target(gen_bint.o | ||
SOURCES ${BINT_OBJ}) | ||
@@ -199,7 +204,7 @@ elseif(${MCL_USE_LLVM}) | ||
target_compile_definitions(mcl_st PUBLIC MCL_USE_LLVM=1) | ||
|
||
add_custom_command(OUTPUT ${BASE_OBJ} | ||
- COMMAND ${CMAKE_CXX_COMPILER} -c -o ${BASE_OBJ} ${CMAKE_CURRENT_SOURCE_DIR}/src/base${BIT}.ll -O3 -fPIC | ||
+ COMMAND ${CMAKE_CXX_COMPILER} -c -o ${BASE_OBJ} ${CMAKE_CURRENT_SOURCE_DIR}/src/base${BIT}.ll -O3 -fPIC ${TARGET_FLAG} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) | ||
add_custom_target(gen_base.o | ||
SOURCES ${BASE_OBJ}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.