Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

118 Zeilen
4.8 KiB

  1. cmake_minimum_required (VERSION 2.8.10)
  2. project (BoringSSL)
  3. find_package(Perl REQUIRED)
  4. find_program(GO_EXECUTABLE go)
  5. if (NOT GO_EXECUTABLE)
  6. message(FATAL_ERROR "Could not find Go")
  7. endif()
  8. if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  9. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -ggdb -fvisibility=hidden")
  10. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -ggdb -std=c++0x -fvisibility=hidden")
  11. elseif(MSVC)
  12. set(MSVC_DISABLED_WARNINGS_LIST
  13. "C4100" # 'exarg' : unreferenced formal parameter
  14. "C4127" # conditional expression is constant
  15. "C4200" # nonstandard extension used : zero-sized array in
  16. # struct/union.
  17. "C4210" # nonstandard extension used : function given file scope
  18. "C4242" # 'function' : conversion from 'int' to 'uint8_t',
  19. # possible loss of data
  20. "C4244" # 'function' : conversion from 'int' to 'uint8_t',
  21. # possible loss of data
  22. "C4245" # 'initializing' : conversion from 'long' to
  23. # 'unsigned long', signed/unsigned mismatch
  24. "C4267" # conversion from 'size_t' to 'int', possible loss of data
  25. "C4371" # layout of class may have changed from a previous version of the
  26. # compiler due to better packing of member '...'
  27. "C4388" # signed/unsigned mismatch
  28. "C4296" # '>=' : expression is always true
  29. "C4350" # behavior change: 'std::_Wrap_alloc...'
  30. "C4365" # '=' : conversion from 'size_t' to 'int',
  31. # signed/unsigned mismatch
  32. "C4389" # '!=' : signed/unsigned mismatch
  33. "C4510" # 'argument' : default constructor could not be generated
  34. "C4512" # 'argument' : assignment operator could not be generated
  35. "C4514" # 'function': unreferenced inline function has been removed
  36. "C4548" # expression before comma has no effect; expected expression with
  37. # side-effect" caused by FD_* macros.
  38. "C4610" # struct 'argument' can never be instantiated - user defined
  39. # constructor required.
  40. "C4625" # copy constructor could not be generated because a base class
  41. # copy constructor is inaccessible or deleted
  42. "C4626" # assignment operator could not be generated because a base class
  43. # assignment operator is inaccessible or deleted
  44. "C4706" # assignment within conditional expression
  45. "C4710" # 'function': function not inlined
  46. "C4711" # function 'function' selected for inline expansion
  47. "C4800" # 'int' : forcing value to bool 'true' or 'false'
  48. # (performance warning)
  49. "C4820" # 'bytes' bytes padding added after construct 'member_name'
  50. "C4996" # 'read': The POSIX name for this item is deprecated. Instead,
  51. # use the ISO C++ conformant name: _read.
  52. )
  53. string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR
  54. ${MSVC_DISABLED_WARNINGS_LIST})
  55. set(CMAKE_C_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR}")
  56. set(CMAKE_CXX_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR}")
  57. add_definitions(-D_HAS_EXCEPTIONS=0)
  58. add_definitions(-DWIN32_LEAN_AND_MEAN)
  59. add_definitions(-DNOMINMAX)
  60. endif()
  61. if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.7.99") OR
  62. CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  63. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
  64. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
  65. endif()
  66. add_definitions(-DBORINGSSL_IMPLEMENTATION)
  67. if (BUILD_SHARED_LIBS)
  68. add_definitions(-DBORINGSSL_SHARED_LIBRARY)
  69. # Enable position-independent code globally. This is needed because
  70. # some library targets are OBJECT libraries.
  71. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
  72. endif()
  73. if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
  74. set(ARCH "x86_64")
  75. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
  76. set(ARCH "x86_64")
  77. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
  78. # cmake reports AMD64 on Windows, but we might be building for 32-bit.
  79. if (CMAKE_CL_64)
  80. set(ARCH "x86_64")
  81. else()
  82. set(ARCH "x86")
  83. endif()
  84. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
  85. set(ARCH "x86")
  86. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
  87. set(ARCH "x86")
  88. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
  89. set(ARCH "x86")
  90. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
  91. set(ARCH "arm")
  92. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
  93. set(ARCH "aarch64")
  94. else()
  95. message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
  96. endif()
  97. if (${ARCH} STREQUAL "x86" AND APPLE)
  98. # With CMake 2.8.x, ${CMAKE_SYSTEM_PROCESSOR} evalutes to i386 on OS X,
  99. # but clang defaults to 64-bit builds on OS X unless otherwise told.
  100. # Set ARCH to x86_64 so clang and CMake agree. This is fixed in CMake 3.
  101. set(ARCH "x86_64")
  102. endif()
  103. add_subdirectory(crypto)
  104. add_subdirectory(ssl)
  105. add_subdirectory(ssl/test)
  106. add_subdirectory(tool)
  107. add_subdirectory(decrepit)