EthBuildInfo.cmake 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. function(create_build_info NAME)
  2. # Set build platform; to be written to BuildInfo.h
  3. set(ETH_BUILD_OS "${CMAKE_SYSTEM_NAME}")
  4. if (CMAKE_COMPILER_IS_MINGW)
  5. set(ETH_BUILD_COMPILER "mingw")
  6. elseif (CMAKE_COMPILER_IS_MSYS)
  7. set(ETH_BUILD_COMPILER "msys")
  8. elseif (CMAKE_COMPILER_IS_GNUCXX)
  9. set(ETH_BUILD_COMPILER "g++")
  10. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  11. set(ETH_BUILD_COMPILER "msvc")
  12. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  13. set(ETH_BUILD_COMPILER "clang")
  14. elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
  15. set(ETH_BUILD_COMPILER "appleclang")
  16. else ()
  17. set(ETH_BUILD_COMPILER "unknown")
  18. endif ()
  19. if (EVMJIT)
  20. set(ETH_BUILD_JIT_MODE "JIT")
  21. else ()
  22. set(ETH_BUILD_JIT_MODE "Interpreter")
  23. endif ()
  24. set(ETH_BUILD_PLATFORM "${ETH_BUILD_OS}/${ETH_BUILD_COMPILER}/${ETH_BUILD_JIT_MODE}")
  25. if (PARANOID)
  26. set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/PARA")
  27. endif ()
  28. #cmake build type may be not speCified when using msvc
  29. if (CMAKE_BUILD_TYPE)
  30. set(_cmake_build_type ${CMAKE_BUILD_TYPE})
  31. else()
  32. set(_cmake_build_type "${CMAKE_CFG_INTDIR}")
  33. endif()
  34. # Generate header file containing useful build information
  35. add_custom_target(${NAME}_BuildInfo.h ALL
  36. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  37. COMMAND ${CMAKE_COMMAND} -DETH_SOURCE_DIR="${PROJECT_SOURCE_DIR}" -DETH_BUILDINFO_IN="${ETH_CMAKE_DIR}/templates/BuildInfo.h.in" -DETH_DST_DIR="${PROJECT_BINARY_DIR}/include/${PROJECT_NAME}" -DETH_CMAKE_DIR="${ETH_CMAKE_DIR}"
  38. -DETH_BUILD_TYPE="${_cmake_build_type}"
  39. -DETH_BUILD_OS="${ETH_BUILD_OS}"
  40. -DETH_BUILD_COMPILER="${ETH_BUILD_COMPILER}"
  41. -DETH_BUILD_JIT_MODE="${ETH_BUILD_JIT_MODE}"
  42. -DETH_BUILD_PLATFORM="${ETH_BUILD_PLATFORM}"
  43. -DETH_BUILD_NUMBER="${BUILD_NUMBER}"
  44. -DETH_VERSION_SUFFIX="${VERSION_SUFFIX}"
  45. -DPROJECT_VERSION="${PROJECT_VERSION}"
  46. -DETH_FATDB="${FATDB10}"
  47. -P "${ETH_SCRIPTS_DIR}/buildinfo.cmake"
  48. )
  49. include_directories(BEFORE ${PROJECT_BINARY_DIR})
  50. endfunction()