.dir-locals.el 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ;;; Directory Local Variables
  2. ;;; For more information see (info "(emacs) Directory Variables")
  3. ;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
  4. (
  5. ;; Default variables for all directories and modes
  6. (nil
  7. .
  8. (
  9. ;; (eval ;https://emacs.stackexchange.com/a/35965
  10. ;; . (progn
  11. ;; (with-temp-buffer ;https://stackoverflow.com/a/16789182
  12. ;; (call-process "bash" nil t nil "-c"
  13. ;; "source /opt/moose/environments/moose_profile; env")
  14. ;; (goto-char (point-min))
  15. ;; (while (not (eobp))
  16. ;; (setq process-environment
  17. ;; (cons (buffer-substring (point) (line-end-position))
  18. ;; process-environment))
  19. ;; (forward-line 1)))
  20. ;; ;; (setenv "METHOD" "dbg")
  21. ;; ))
  22. ))
  23. ;; Default variables for C mode in all directories
  24. (c-mode
  25. .
  26. (( ; Use c-mode as c++
  27. mode ; https://stackoverflow.com/a/6912415
  28. .
  29. c++)
  30. (compile-command
  31. .
  32. (concat
  33. ;; Modify moose_profile manually to have
  34. ;; moose-dev-clang instaed of moose-dev-gcc
  35. ;; Check for OS name (if in Parabola or Arch)
  36. "cd .. && "
  37. "[[ $(python3 -c 'import platform; "
  38. "a = 1 if \"arch\" in platform.platform() else 0; "
  39. "print(a)') ]]" ; https://unix.stackexchange.com/a/195808
  40. " && source ./setmooseenv.sh"
  41. ;; (if not in Parabola or Arch)
  42. " || source /opt/moose/environments/moose_profile;"
  43. " make -j 4;"
  44. ;; ;; Compile with debugging symbols
  45. ;; "LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 METHOD=dbg make -j $MOOSE_JOBS -C ../"
  46. ))
  47. ))
  48. ;; Default variables for C++ mode in all directories
  49. (c++-mode
  50. .
  51. ((compile-command
  52. .
  53. (concat
  54. ;; Modify moose_profile manually to have
  55. ;; moose-dev-clang instaed of moose-dev-gcc
  56. ;; Check for OS name (if in Parabola or Arch)
  57. "cd .. && "
  58. "[[ $(python3 -c 'import platform; "
  59. "a = 1 if \"arch\" in platform.platform() else 0; "
  60. "print(a)') ]]" ; https://unix.stackexchange.com/a/195808
  61. " && source ./setmooseenv.sh"
  62. ;; (if not in Parabola or Arch)
  63. " || source /opt/moose/environments/moose_profile;"
  64. " make -j 4;"
  65. ))
  66. ))
  67. ;; Default variables for GetPot mode in all directories
  68. (getpot-mode
  69. .
  70. ((compile-command
  71. .
  72. (concat
  73. ;; Modify moose_profile manually to have
  74. ;; moose-dev-clang instaed of moose-dev-gcc
  75. ;; Check for OS name (if in Parabola or Arch)
  76. "[[ $(python3 -c 'import platform; "
  77. "a = 1 if \"arch\" in platform.platform() else 0; "
  78. "print(a)') ]]" ; https://unix.stackexchange.com/a/195808
  79. " && cd ../ && source ./setmooseenv.sh && cd -"
  80. ;; (if not in Parabola or Arch)
  81. " || source /opt/moose/environments/moose_profile;"
  82. ;; "mpirun -np $(lscpu | awk '/^CPU\\(s\\)/{print $2}')" ; set mpirun with max cpus
  83. ;; "mpirun -np $MOOSE_JOBS" ; set mpirun with MOOSE_JOBS
  84. " mpirun -np 4" ; set mpirun with suboptimal cpus
  85. " ../heron-opt -i " ;executable to use
  86. (if buffer-file-name
  87. (shell-quote-argument
  88. (buffer-file-name)))))))
  89. ;; Default variables for Gmsh mode in all directories
  90. (gmsh-mode
  91. .
  92. ((compile-command
  93. .
  94. (concat "gmsh -optimize_ho -format msh -3 -o "
  95. (if buffer-file-name
  96. (shell-quote-argument
  97. (file-name-sans-extension buffer-file-name)))
  98. ".msh "
  99. (if buffer-file-name
  100. (shell-quote-argument
  101. (buffer-file-name)))
  102. ))))
  103. )