diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2017-05-21 21:33:04 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2017-05-21 21:33:04 +0800 |
commit | a27f9ea729efa2f5279cd7dc88275e4389934577 (patch) | |
tree | d98d1fe7889d801763a8e7a6ad0450a200382afa | |
parent | 3081a013d7623632753c2e0a4f57dbc668bb86a9 (diff) | |
download | tangerine-mcl-a27f9ea729efa2f5279cd7dc88275e4389934577.tar.gz tangerine-mcl-a27f9ea729efa2f5279cd7dc88275e4389934577.tar.zst tangerine-mcl-a27f9ea729efa2f5279cd7dc88275e4389934577.zip |
cmake downloads all extra files
-rw-r--r-- | CMakeLists.txt | 74 | ||||
-rw-r--r-- | readme.md | 8 |
2 files changed, 52 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5833603..a7b551c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,12 @@ option( "max bit size for Fp" 0 ) +option( + DOWNLOAD_SOURCE + "download xbyak, cybozulib" + OFF +) +set(DOWNLOAD_SOURCE ON) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -43,7 +49,7 @@ else() set(LIBS mcl gmp gmpxx crypto) endif() -if(NOT MSVC) +if(DOWNLOAD_SOURCE) set(XBYAK_TAG v5.43) foreach(file IN ITEMS xbyak.h xbyak_util.h xbyak_mnemonic.h) file(DOWNLOAD https://raw.githubusercontent.com/herumi/xbyak/${XBYAK_TAG}/xbyak/${file} ${mcl_SOURCE_DIR}/include/xbyak/${file}) @@ -51,44 +57,52 @@ if(NOT MSVC) endforeach() set(CYBOZULIB_TAG release20170521) - set(CYBOZULIB_FILES atoi.hpp bit_operation.hpp endian.hpp hash.hpp itoa.hpp random_generator.hpp unordered_map.hpp benchmark.hpp crypto.hpp exception.hpp inttype.hpp option.hpp test.hpp xorshift.hpp) + set(CYBOZULIB_FILES atoi.hpp bit_operation.hpp endian.hpp hash.hpp itoa.hpp random_generator.hpp unordered_map.hpp benchmark.hpp crypto.hpp exception.hpp inttype.hpp option.hpp test.hpp xorshift.hpp link_mpir.hpp link_libeay32.hpp link_ssleay32.hpp critical_section.hpp mutex.hpp) foreach(file IN ITEMS ${CYBOZULIB_FILES}) file(DOWNLOAD https://raw.githubusercontent.com/herumi/cybozulib/${CYBOZULIB_TAG}/include/cybozu/${file} ${mcl_SOURCE_DIR}/include/cybozu/${file}) message("download cybozu/" ${file}) endforeach() -endif() -if(MSVC AND false) - set(CYBOZULIB_EXT_TAG release20170521) - set(FILES config.h gmp-impl.h gmp-mparam.h gmp.h gmpxx.h longlong.h mpir.h mpirxx.h) - foreach(file IN ITEMS ${FILES}) - file(DOWNLOAD https://raw.githubusercontent.com/herumi/cybozulib_ext/${CYBOZULIB_EXT_TAG}/include/${file} ${mcl_SOURCE_DIR}/include/cybozulib_ext/${file}) - message("download cybozulib_ext/" ${file}) - endforeach() - set(FILES aes.h applink.c asn1.h asn1_mac.h asn1t.h bio.h blowfish.h bn.h buffer.h camellia.h cast.h cmac.h cms.h comp.h conf.h conf_api.h crypto.h des.h des_old.h dh.h dsa.h dso.h dtls1.h e_os2.h ebcdic.h ec.h ecdh.h ecdsa.h engine.h err.h evp.h hmac.h idea.h krb5_asn.h kssl.h lhash.h md4.h md5.h mdc2.h modes.h obj_mac.h objects.h ocsp.h opensslconf.h opensslv.h ossl_typ.h pem.h pem2.h pkcs12.h pkcs7.h pqueue.h rand.h rc2.h rc4.h ripemd.h rsa.h safestack.h seed.h sha.h srp.h srtp.h ssl.h ssl2.h ssl23.h ssl3.h stack.h symhacks.h tls1.h ts.h txt_db.h ui.h ui_compat.h whrlpool.h x509.h x509_vfy.h x509v3.h) - foreach(file IN ITEMS ${FILES}) - file(DOWNLOAD https://raw.githubusercontent.com/herumi/cybozulib_ext/${CYBOZULIB_EXT_TAG}/include/openssl/${file} ${mcl_SOURCE_DIR}/include/cybozulib_ext/openssl/${file}) - message("download cybozulib_ext/openssl/" ${file}) - endforeach() - set(FILES mpir.lib mpirxx.lib mpirxx.pdb ssleay32.lib libeay32.lib mpir.pdb) - foreach(file IN ITEMS ${FILES}) - file(DOWNLOAD https://raw.githubusercontent.com/herumi/cybozulib_ext/${CYBOZULIB_EXT_TAG}/lib/mt/14/${file} ${mcl_SOURCE_DIR}/lib/mt/14/${file}) - message("download lib/mt/14/" ${file}) - endforeach() + if(MSVC) + set(CYBOZULIB_EXT_TAG release20170521) + set(FILES config.h gmp-impl.h gmp-mparam.h gmp.h gmpxx.h longlong.h mpir.h mpirxx.h) + foreach(file IN ITEMS ${FILES}) + file(DOWNLOAD https://raw.githubusercontent.com/herumi/cybozulib_ext/${CYBOZULIB_EXT_TAG}/include/${file} ${mcl_SOURCE_DIR}/include/cybozulib_ext/${file}) + message("download cybozulib_ext/" ${file}) + endforeach() + set(FILES aes.h applink.c asn1.h asn1_mac.h asn1t.h bio.h blowfish.h bn.h buffer.h camellia.h cast.h cmac.h cms.h comp.h conf.h conf_api.h crypto.h des.h des_old.h dh.h dsa.h dso.h dtls1.h e_os2.h ebcdic.h ec.h ecdh.h ecdsa.h engine.h err.h evp.h hmac.h idea.h krb5_asn.h kssl.h lhash.h md4.h md5.h mdc2.h modes.h obj_mac.h objects.h ocsp.h opensslconf.h opensslv.h ossl_typ.h pem.h pem2.h pkcs12.h pkcs7.h pqueue.h rand.h rc2.h rc4.h ripemd.h rsa.h safestack.h seed.h sha.h srp.h srtp.h ssl.h ssl2.h ssl23.h ssl3.h stack.h symhacks.h tls1.h ts.h txt_db.h ui.h ui_compat.h whrlpool.h x509.h x509_vfy.h x509v3.h) + foreach(file IN ITEMS ${FILES}) + file(DOWNLOAD https://raw.githubusercontent.com/herumi/cybozulib_ext/${CYBOZULIB_EXT_TAG}/include/openssl/${file} ${mcl_SOURCE_DIR}/include/cybozulib_ext/openssl/${file}) + message("download cybozulib_ext/openssl/" ${file}) + endforeach() + set(FILES mpir.lib mpirxx.lib mpirxx.pdb ssleay32.lib libeay32.lib mpir.pdb) + foreach(file IN ITEMS ${FILES}) + file(DOWNLOAD https://raw.githubusercontent.com/herumi/cybozulib_ext/${CYBOZULIB_EXT_TAG}/lib/mt/14/${file} ${mcl_SOURCE_DIR}/lib/mt/14/${file}) + message("download lib/mt/14/" ${file}) + endforeach() + if(MSVC) + include_directories( + ${mcl_SOURCE_DIR}/include/cybozulib_ext + ) + endif() + endif() +else() + include_directories( + ${mcl_SOURCE_DIR}/../cybozulib/include + ${mcl_SOURCE_DIR}/../xbyak + ${mcl_SOURCE_DIR}/../cybozulib_ext/include + ) + if(MSVC) + include_directories( + ${mcl_SOURCE_DIR}/../cybozulib_ext/include + ) + endif() endif() include_directories( ${mcl_SOURCE_DIR}/include ) -if(MSVC) -include_directories( - ${mcl_SOURCE_DIR}/../cybozulib/include - ${mcl_SOURCE_DIR}/../cybozulib_ext/include - ${mcl_SOURCE_DIR}/../xbyak -) -endif() - add_library(mcl STATIC ${SRCS}) if(NOT MSVC) add_library(mcl_dy SHARED ${SRCS}) @@ -104,8 +118,8 @@ endif() install(FILES ${MCL_HEADERS} DESTINATION include/mcl) install(FILES ${CYBOZULIB_HEADERS} DESTINATION include/cybozu) -#set(TEST_BASE fp_test ec_test fp_util_test window_method_test elgamal_test fp_tower_test gmp_test bn_test glv_test) -set(TEST_BASE bn_test) +set(TEST_BASE fp_test ec_test fp_util_test window_method_test elgamal_test fp_tower_test gmp_test bn_test glv_test) +#set(TEST_BASE bn_test) foreach(base IN ITEMS ${TEST_BASE}) add_executable( ${base} @@ -78,12 +78,20 @@ msbuild /p:Configuration=Release ```
## Build with cmake
+For Linux,
```
mkdir build
cd build
cmake ..
make
```
+For Visual Studio,
+```
+mkdir build
+cd build
+cmake .. -A x64
+msbuild mcl.sln /p:Configuration=Release /m
+```
### SELinux
mcl uses Xbyak JIT engine if it is available on x64 architecture,
otherwise mcl uses a little slower functions generated by LLVM.
|