generate_dump.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/usr/bin/env bash
  2. TMP_FOLDER='/tmp/ydb-build-dump'
  3. rm -rf $TMP_FOLDER
  4. mkdir $TMP_FOLDER
  5. PLATFORM=$1
  6. TARGET_PLATFORM=$2
  7. PARAMS_FILE=$TMP_FOLDER/params.json
  8. UNIX_TEMPLATE=$TMP_FOLDER/unix_template.txt
  9. WIN_TEMPLATE=$TMP_FOLDER/win_template.txt
  10. cat <<'EOF'>$UNIX_TEMPLATE
  11. {
  12. "env": {
  13. "CPATH": [""],
  14. "LIBRARY_PATH": [""],
  15. "SDKROOT": [""]
  16. },
  17. "params": {
  18. "c_compiler": "$$($platform)/bin/clang",
  19. "cxx_compiler": "$$($platform)/bin/clang++",
  20. "gcc_version": "14.0",
  21. "llvm-symbolizer": "$$($platform)/bin/llvm-symbolizer",
  22. "match_root": "$platform",
  23. "objcopy": "$$($platform)/bin/llvm-objcopy",
  24. "strip": "$$($platform)/bin/llvm-strip",
  25. "type": "clang",
  26. "werror_mode": "all"
  27. },
  28. "platform": {
  29. "host": {
  30. "arch": "$arch",
  31. "os": "$os",
  32. "toolchain": "default",
  33. "visible_name": "clang14"
  34. },
  35. "target": {
  36. "arch": "$arch",
  37. "os": "$os",
  38. "toolchain": "default",
  39. "visible_name": "clang14"
  40. }
  41. }
  42. }
  43. EOF
  44. cat <<'EOF'>$WIN_TEMPLATE
  45. {
  46. "params": {
  47. "c_compiler": "$$($platform)/bin/Hostx64/x64/cl.exe",
  48. "cxx_compiler": "$$($platform)/bin/Hostx64/x64/cl.exe",
  49. "cxx_std": "c++latest",
  50. "for_ide": "msvs2019",
  51. "match_root": "$platform",
  52. "type": "msvc",
  53. "version": "2019",
  54. "werror_mode": "compiler_specific"
  55. },
  56. "platform": {
  57. "host": {
  58. "arch": "$arch",
  59. "os": "$os",
  60. "toolchain": "default",
  61. "visible_name": "msvc2019"
  62. },
  63. "target": {
  64. "arch": "$arch",
  65. "os": "$os",
  66. "toolchain": "default",
  67. "visible_name": "msvc2019"
  68. }
  69. }
  70. }
  71. EOF
  72. if [[ $PLATFORM = win* ]]
  73. then
  74. TEMPLATE=$WIN_TEMPLATE
  75. else
  76. TEMPLATE=$UNIX_TEMPLATE
  77. fi
  78. DUMP_EXPORT_PATH="$TMP_FOLDER/ymake.$PLATFORM.conf"
  79. # generate params for ymake_conf.py
  80. python3 -c "import sys, string as s; v=sys.argv; p = v[1].replace('-', '_'); o, a = v[2].split('-'); print(s.Template(open('$TEMPLATE').read()).substitute(platform=p.upper(), arch=a, os=o.upper()))" $TARGET_PLATFORM $PLATFORM >$DUMP_EXPORT_PATH.params
  81. PARAMS=`base64 -w0 $DUMP_EXPORT_PATH.params`
  82. ARCADIA=`realpath .`
  83. python3 $ARCADIA/build/ymake_conf.py $ARCADIA release no --toolchain-params $PARAMS \
  84. -D NO_SVN_DEPENDS=yes -D REPORT_CONFIGURE_PROGRESS=yes -D EXPORT_CMAKE=yes -D TRAVERSE_RECURSE=yes -D TRAVERSE_RECURSE_FOR_TESTS=yes \
  85. -D BUILD_LANGUAGES=CPP -D EXPORTED_BUILD_SYSTEM_SOURCE_ROOT='${CMAKE_SOURCE_DIR}' -D EXPORTED_BUILD_SYSTEM_BUILD_ROOT='${CMAKE_BINARY_DIR}' \
  86. -D OPENSOURCE=yes -D OPENSOURCE_PROJECT=ydb -D HAVE_CUDA=no -D CUDA_VERSION=0.0 -D USE_PREBUILT_TOOLS=no >$DUMP_EXPORT_PATH
  87. # append new line
  88. echo >>$DUMP_EXPORT_PATH
  89. cat $DUMP_EXPORT_PATH
  90. # cp $DUMP_EXPORT_PATH .
  91. rm -rf $TMP_FOLDER