25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

60 satır
2.9 KiB

  1. cmake_minimum_required(VERSION 3.13)
  2. include(ExternalProject)
  3. find_program(MAKE_PROGRAM make)
  4. # The Configure script will set the CFLAGS
  5. set(CMAKE_C_FLAGS "")
  6. set(OPENSSL_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl-build)
  7. # Indicates where OpenSSL is placed after build. That path is used in
  8. # PQSDK build, but that's not the same as installing a package.
  9. set(OPENSSL_BUILD_INSTALL_ROOT ${CMAKE_CURRENT_BINARY_DIR}/openssl-install)
  10. set(OPENSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../openssl)
  11. set(OPENSSL_INCLUDE_DIR ${OPENSSL_BUILD_INSTALL_ROOT}/include)
  12. # OpenSSL is compiled with -prefix and --openssldir set to ${OPENSSL_PREFIX_OPENSSLDIR},
  13. # without RPATH. When used for PQS Engine testing it is placed in :
  14. # ${OPENSSL_BUILD_INSTALL_ROOT}/${OPENSSL_PREFIX_OPENSSLDIR}
  15. # But when installing it is placed in
  16. # ${OPENSSL_PREFIX_OPENSSLDIR}
  17. set(OPENSSL_PREFIX_OPENSSLDIR ${CMAKE_INSTALL_PREFIX}${PQSDK_INSTALL_DIR}/openssl)
  18. include(libdefs.cmake)
  19. set(OPENSSL_CONFIG_CMD "config" CACHE STRING "Command used to configure OpenSSL (default ./config)")
  20. set(OPENSSL_CONFIG_TARGET "" CACHE STRING "Platform for which OpenSSL should be compiled (default native)")
  21. message("OpenSSL root dir: ${OPENSSL_ROOT_DIR}")
  22. message("OpenSSL install dir: ${OPENSSL_BUILD_INSTALL_ROOT}")
  23. message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
  24. message("OpenSSL crypto lib: ${OPENSSL_LIB_CRYPTO}")
  25. message("OpenSSL ssl lib: ${OPENSSL_LIB_SSL}")
  26. # TODO: add no-deprecated. Need to get rid of ERR_load_crypto_strings and OBJ_cleanup first
  27. set(OPENSSL_CONFIG_ARGS no-shared shared threads no-md2 no-md4 no-sm2 no-sm3 no-sm4)
  28. if(DEBUG)
  29. set(OPENSSL_CONFIG_ARGS ${OPENSSL_CONFIG_ARGS} -d -g3 -O0 no-asm -fno-omit-frame-pointer -fno-inline-functions)
  30. elseif(OQS_SPEED_COMPARE AND OQS_GENERIC)
  31. set(OPENSSL_CONFIG_ARGS ${OPENSSL_CONFIG_ARGS} no-asm)
  32. endif()
  33. # Define dependencies on libcrypto.so and libssl.so
  34. add_dependencies(
  35. OpenSSL_crypto_shared
  36. OpenSSL)
  37. add_dependencies(
  38. OpenSSL_ssl_shared
  39. OpenSSL)
  40. # Add OpenSSL as external project
  41. ExternalProject_Add(OpenSSL
  42. SOURCE_DIR ${OPENSSL_ROOT_DIR}
  43. BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl-build
  44. CONFIGURE_COMMAND <SOURCE_DIR>/${OPENSSL_CONFIG_CMD} ${OPENSSL_CONFIG_TARGET} ${OPENSSL_CONFIG_ARGS} --prefix=${OPENSSL_PREFIX_OPENSSLDIR} --openssldir=${OPENSSL_PREFIX_OPENSSLDIR} --strict-warnings
  45. BUILD_COMMAND ${MAKE_PROGRAM} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_LINKER}
  46. INSTALL_DIR /
  47. INSTALL_COMMAND make DESTDIR=${OPENSSL_BUILD_INSTALL_ROOT} install
  48. )
  49. #install(DIRECTORY ${OPENSSL_BUILD_INSTALL_ROOT}/${OPENSSL_PREFIX_OPENSSLDIR}/.. DESTINATION ${OPENSSL_PREFIX_OPENSSLDIR})
  50. #install(DIRECTORY ${OPENSSL_BUILD_INSTALL_ROOT}${OPENSSL_PREFIX_OPENSSLDIR}/bin/ DESTINATION
  51. # ${OPENSSL_PREFIX_OPENSSLDIR}/bin
  52. # FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ)
  53. set_property(GLOBAL PROPERTY openssl_build_dir_property ${OPENSSL_BUILD_DIR})