Reference implementations of PQC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

46 lines
1.7 KiB

  1. include(ExternalProject)
  2. find_program(MAKE_PROGRAM make)
  3. string (REPLACE " " "$<SEMICOLON>" LLVM_PROJECT_TARGETS "libcxx libcxxabi")
  4. set(PREFIX ${CMAKE_CURRENT_BINARY_DIR}/3rd/llvm-project)
  5. set(LLVM_LIB_CXX
  6. ${PREFIX}/usr/local/lib/libc++${CMAKE_STATIC_LIBRARY_SUFFIX})
  7. set(LLVM_LIB_CXXABI
  8. ${PREFIX}/usr/local/lib/libc++abi${CMAKE_STATIC_LIBRARY_SUFFIX})
  9. ExternalProject_Add(
  10. llvm-project
  11. GIT_REPOSITORY https://github.com/llvm/llvm-project.git
  12. GIT_TAG llvmorg-12.0.0
  13. GIT_SHALLOW TRUE
  14. CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=${LLVM_PROJECT_TARGETS} -DLLVM_USE_SANITIZER=MemoryWithOrigins -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm-project/llvm -DLLVM_INCLUDE_BENCHMARKS=OFF
  15. BUILD_COMMAND ${MAKE_PROGRAM} cxx cxxabi
  16. INSTALL_COMMAND DESTDIR=${PREFIX} make install-cxx-headers install-cxx install-cxxabi
  17. COMMENT "Building memcheck instrumented libc++ and libc++abi"
  18. PREFIX ${PREFIX}
  19. # Don't try updating the source. This prevents running update when calling 'make' (not sure why update step is run during make).
  20. # It will also cause not updateing source during calling 'cmake' again. But we use fixed branch, so this shouldn't be needed
  21. UPDATE_DISCONNECTED TRUE
  22. )
  23. add_library(
  24. cxx SHARED IMPORTED GLOBAL)
  25. add_library(
  26. cxxabi SHARED IMPORTED GLOBAL)
  27. add_dependencies(
  28. cxx
  29. llvm-project)
  30. add_dependencies(
  31. cxxabi
  32. llvm-project)
  33. set_target_properties(
  34. cxx PROPERTIES IMPORTED_LOCATION ${LLVM_LIB_CXX})
  35. set_target_properties(
  36. cxxabi PROPERTIES IMPORTED_LOCATION ${LLVM_LIB_CXXABI})
  37. set_property(
  38. GLOBAL PROPERTY llvmproject_build_install_dir_property
  39. ${PREFIX}/usr/local)