diff options
author | lateralusX <lateralusx.github@gmail.com> | 2018-10-08 11:54:25 +0300 |
---|---|---|
committer | lateralusX <lateralusx.github@gmail.com> | 2018-10-08 11:54:25 +0300 |
commit | 911e2e4d34bb22a2166c4b4ddd755779e8f06c8c (patch) | |
tree | 156de2440fd0d42d1cdaa77fa8f8feff030bb616 | |
parent | 41221b45aafbbe9bb1ddadae4ac9e7dfdb2121b1 (diff) |
Reduce build dependencies when building with OPENSSL_NO_ASM.
Windows is currently building with OPENSSL_NO_ASM on cygwin/mingw/msvc.
Current cmake files still includes dependencies only needed when building
with ASM support, this PR reduce needed dependencies when building with
OPENSSL_NO_ASM (not requiring perl, yasm, ninja). In the long run we will
get all dependencies working on all Windows builds as well, but until that
is done, this enhancements to the build scripts will be beneficial.
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | crypto/CMakeLists.txt | 104 |
2 files changed, 64 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5da9df33..30c00425 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,10 +15,14 @@ enable_language(CXX) if(ANDROID) # Android-NDK CMake files reconfigure the path and so Go and Perl won't be # found. However, ninja will still find them in $PATH if we just name them. - set(PERL_EXECUTABLE "perl") + if(NOT OPENSSL_NO_ASM) + set(PERL_EXECUTABLE "perl") + endif() # set(GO_EXECUTABLE "go") else() - find_package(Perl REQUIRED) + if(NOT OPENSSL_NO_ASM) + find_package(Perl REQUIRED) + endif() # find_program(GO_EXECUTABLE go) endif() @@ -185,7 +189,9 @@ if (ANDROID AND ${ARCH} STREQUAL "arm") # The Android-NDK CMake files somehow fail to set the -march flag for # assembly files. Without this flag, the compiler believes that it's # building for ARMv5. - set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -march=${CMAKE_SYSTEM_PROCESSOR}") + if (NOT OPENSSL_NO_ASM) + set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -march=${CMAKE_SYSTEM_PROCESSOR}") + endif() endif() # if (${ARCH} STREQUAL "x86" AND APPLE) diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 94e47ea1..f034e9e5 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -1,59 +1,65 @@ include_directories(../include) -if(APPLE) - if (${ARCH} STREQUAL "x86") - set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2") - endif() - set(PERLASM_STYLE macosx) - set(ASM_EXT S) - enable_language(ASM) -elseif(UNIX) - if (${ARCH} STREQUAL "aarch64") - # The "armx" Perl scripts look for "64" in the style argument - # in order to decide whether to generate 32- or 64-bit asm. - set(PERLASM_STYLE linux64) - elseif (${ARCH} STREQUAL "arm") - set(PERLASM_STYLE linux32) - elseif (${ARCH} STREQUAL "x86") - set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2") - set(PERLASM_STYLE elf) - else() - set(PERLASM_STYLE elf) - endif() - set(ASM_EXT S) - enable_language(ASM) - set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack") -else() - if (CMAKE_CL_64) - message("Using nasm") - set(PERLASM_STYLE nasm) +if(NOT OPENSSL_NO_ASM) + if(APPLE) + if (${ARCH} STREQUAL "x86") + set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2") + endif() + set(PERLASM_STYLE macosx) + set(ASM_EXT S) + enable_language(ASM) + elseif(UNIX) + if (${ARCH} STREQUAL "aarch64") + # The "armx" Perl scripts look for "64" in the style argument + # in order to decide whether to generate 32- or 64-bit asm. + set(PERLASM_STYLE linux64) + elseif (${ARCH} STREQUAL "arm") + set(PERLASM_STYLE linux32) + elseif (${ARCH} STREQUAL "x86") + set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2") + set(PERLASM_STYLE elf) + else() + set(PERLASM_STYLE elf) + endif() + set(ASM_EXT S) + enable_language(ASM) + set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack") else() - message("Using win32n") - set(PERLASM_STYLE win32n) - set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2") + if (CMAKE_CL_64) + message("Using nasm") + set(PERLASM_STYLE nasm) + else() + message("Using win32n") + set(PERLASM_STYLE win32n) + set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2") + endif() + + # On Windows, we use the NASM output, specifically built with Yasm. + set(ASM_EXT asm) + enable_language(ASM_NASM) endif() - # On Windows, we use the NASM output, specifically built with Yasm. - set(ASM_EXT asm) - enable_language(ASM_NASM) + function(perlasm dest src) + add_custom_command( + OUTPUT ${dest} + COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${PERLASM_STYLE} ${PERLASM_FLAGS} ${ARGN} > ${dest} + DEPENDS + ${src} + ${PROJECT_SOURCE_DIR}/crypto/perlasm/arm-xlate.pl + ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86_64-xlate.pl + ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86asm.pl + ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86gas.pl + ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86masm.pl + ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86nasm.pl + WORKING_DIRECTORY . + ) + endfunction() +else() + function(perlasm dest src) + # Disabled since OPENSSL_NO_ASM has been defined. + endfunction() endif() -function(perlasm dest src) - add_custom_command( - OUTPUT ${dest} - COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${PERLASM_STYLE} ${PERLASM_FLAGS} ${ARGN} > ${dest} - DEPENDS - ${src} - ${PROJECT_SOURCE_DIR}/crypto/perlasm/arm-xlate.pl - ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86_64-xlate.pl - ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86asm.pl - ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86gas.pl - ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86masm.pl - ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86nasm.pl - WORKING_DIRECTORY . - ) -endfunction() - # Level 0.1 - depends on nothing outside this set. add_subdirectory(stack) add_subdirectory(lhash) |