From 0df8f32be4aec3f0e950928900de567ff864b98e Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 17 Apr 2019 08:29:03 +0900 Subject: [PATCH] add USE_ASM/USE_XBYAK option to cmake --- CMakeLists.txt | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8832d9..557f98d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,16 @@ option( "use gmp" ON ) +option( + USE_ASM + "use asm" + ON +) +option( + USE_XBYAK + "use xbyak" + ON +) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -42,22 +52,24 @@ else() add_definitions(-DMCL_MAX_BIT_SIZE=${MCL_MAX_BIT_SIZE}) endif() - if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") - add_definitions(-DMCL_USE_LLVM=1) - set(SRCS ${SRCS} src/asm/aarch64.s) - set(CPU arch64) - elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") - add_definitions(-DMCL_USE_LLVM=1) - set(SRCS ${SRCS} src/asm/arm.s) - set(CPU arm) - elseif(APPLE) - add_definitions(-DMCL_USE_LLVM=1) - set(SRCS ${SRCS} src/asm/x86-64mac.s src/asm/x86-64mac.bmi2.s) - set(CPU x86-64) - elseif(UNIX) - add_definitions(-DMCL_USE_LLVM=1) - set(SRCS ${SRCS} src/asm/x86-64.s src/asm/x86-64.bmi2.s) - set(CPU x86-64) + if(USE_ASM) + if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") + add_definitions(-DMCL_USE_LLVM=1) + set(SRCS ${SRCS} src/asm/aarch64.s) + set(CPU arch64) + elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") + add_definitions(-DMCL_USE_LLVM=1) + set(SRCS ${SRCS} src/asm/arm.s) + set(CPU arm) + elseif(APPLE) + add_definitions(-DMCL_USE_LLVM=1) + set(SRCS ${SRCS} src/asm/x86-64mac.s src/asm/x86-64mac.bmi2.s) + set(CPU x86-64) + elseif(UNIX) + add_definitions(-DMCL_USE_LLVM=1) + set(SRCS ${SRCS} src/asm/x86-64.s src/asm/x86-64.bmi2.s) + set(CPU x86-64) + endif() endif() set(LIBS mcl) if(USE_GMP) @@ -74,6 +86,9 @@ endif() if(NOT USE_OPENSSL) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMCL_DONT_USE_OPENSSL") endif() +if(NOT USE_XBYAK) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMCL_DONT_USE_XBYAK") +endif() if(DOWNLOAD_SOURCE) if(MSVC)