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.
 
 
 
 
 
 

121 lines
5.0 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. "C4311" # 'type cast' : pointer truncation from 'uint8_t *' to 'long'
  26. # TODO(davidben): Fix the s3_pkt.c's alignment code to avoid this.
  27. "C4371" # layout of class may have changed from a previous version of the
  28. # compiler due to better packing of member '...'
  29. "C4388" # signed/unsigned mismatch
  30. "C4296" # '>=' : expression is always true
  31. "C4350" # behavior change: 'std::_Wrap_alloc...'
  32. "C4365" # '=' : conversion from 'size_t' to 'int',
  33. # signed/unsigned mismatch
  34. "C4389" # '!=' : signed/unsigned mismatch
  35. "C4510" # 'argument' : default constructor could not be generated
  36. "C4512" # 'argument' : assignment operator could not be generated
  37. "C4514" # 'function': unreferenced inline function has been removed
  38. "C4548" # expression before comma has no effect; expected expression with
  39. # side-effect" caused by FD_* macros.
  40. "C4610" # struct 'argument' can never be instantiated - user defined
  41. # constructor required.
  42. "C4625" # copy constructor could not be generated because a base class
  43. # copy constructor is inaccessible or deleted
  44. "C4626" # assignment operator could not be generated because a base class
  45. # assignment operator is inaccessible or deleted
  46. "C4701" # potentially uninitialized local variable 'mdlen' used
  47. "C4706" # assignment within conditional expression
  48. "C4710" # 'function': function not inlined
  49. "C4711" # function 'function' selected for inline expansion
  50. "C4800" # 'int' : forcing value to bool 'true' or 'false'
  51. # (performance warning)
  52. "C4820" # 'bytes' bytes padding added after construct 'member_name'
  53. "C4996" # 'read': The POSIX name for this item is deprecated. Instead,
  54. # use the ISO C++ conformant name: _read.
  55. )
  56. string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR
  57. ${MSVC_DISABLED_WARNINGS_LIST})
  58. set(CMAKE_C_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR}")
  59. set(CMAKE_CXX_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR}")
  60. add_definitions(-D_HAS_EXCEPTIONS=0)
  61. add_definitions(-DWIN32_LEAN_AND_MEAN)
  62. add_definitions(-DNOMINMAX)
  63. endif()
  64. if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.7.99") OR
  65. CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  66. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
  67. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
  68. endif()
  69. add_definitions(-DBORINGSSL_IMPLEMENTATION)
  70. if (BUILD_SHARED_LIBS)
  71. add_definitions(-DBORINGSSL_SHARED_LIBRARY)
  72. # Enable position-independent code globally. This is needed because
  73. # some library targets are OBJECT libraries.
  74. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
  75. endif()
  76. if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
  77. set(ARCH "x86_64")
  78. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
  79. set(ARCH "x86_64")
  80. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
  81. # cmake reports AMD64 on Windows, but we might be building for 32-bit.
  82. if (CMAKE_CL_64)
  83. set(ARCH "x86_64")
  84. else()
  85. set(ARCH "x86")
  86. endif()
  87. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
  88. set(ARCH "x86")
  89. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
  90. set(ARCH "x86")
  91. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
  92. set(ARCH "x86")
  93. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
  94. set(ARCH "arm")
  95. elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
  96. set(ARCH "aarch64")
  97. else()
  98. message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
  99. endif()
  100. if (${ARCH} STREQUAL "x86" AND APPLE)
  101. # With CMake 2.8.x, ${CMAKE_SYSTEM_PROCESSOR} evalutes to i386 on OS X,
  102. # but clang defaults to 64-bit builds on OS X unless otherwise told.
  103. # Set ARCH to x86_64 so clang and CMake agree. This is fixed in CMake 3.
  104. set(ARCH "x86_64")
  105. endif()
  106. add_subdirectory(crypto)
  107. add_subdirectory(ssl)
  108. add_subdirectory(ssl/test)
  109. add_subdirectory(tool)
  110. add_subdirectory(decrepit)