org-Cmake.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. cmake_minimum_required(VERSION 2.8)
  2. project(thesis NONE)
  3. include(/usr/share/cmake-2.8/Modules/UseLATEX.cmake)
  4. # Set R executable
  5. set(R_COMPILE "/usr/bin/Rscript")
  6. # Set the location of data files
  7. ##set(DATA_DIR data)
  8. # Set the location of the directory for image files
  9. set(IMAGE_DIR graphicsauto)
  10. # Get a list of R files
  11. file(GLOB_RECURSE R_FILES "R/*.R")
  12. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/R DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
  13. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR})
  14. foreach(file ${R_FILES})
  15. message("processing ${file}")
  16. get_filename_component(basename "${file}" NAME_WE)
  17. # Command to run R
  18. if(R_COMPILE)
  19. message("Adding ........... ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R")
  20. add_custom_command(
  21. OUTPUT
  22. ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
  23. DEPENDS
  24. ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R
  25. # ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR}
  26. COMMAND
  27. ${R_COMPILE}
  28. ARGS
  29. ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R
  30. ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
  31. )
  32. message("Running ${R_COMPILE} ${CMAKE_CURRENT_BINARY_DIR}/R/${basename}.R ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps")
  33. endif(R_COMPILE)
  34. # Make a list of all R files (for ADD_LATEX_DOCUMENT depend)
  35. set(ALL_R_FILES ${ALL_R_FILES}
  36. ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
  37. )
  38. endforeach(file)
  39. # ------- export mainThesis.org -----------------------
  40. latex_get_output_path(OUTPUT_DIR)
  41. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/mainThesis.org DESTINATION ${OUTPUT_DIR}/ )
  42. file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/thesis.el DESTINATION ${OUTPUT_DIR}/ )
  43. add_custom_target( orgfile ALL
  44. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mainThesis.org )
  45. add_custom_target( elfile ALL
  46. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/thesis.el )
  47. add_custom_command(
  48. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mainThesis.tex
  49. COMMAND emacs -Q --batch --eval \"(progn
  50. (add-to-list 'load-path
  51. (expand-file-name \\"~/.emacs.d/plugins/org-mode/lisp/\\"))
  52. (add-to-list 'load-path
  53. (expand-file-name \\"~/.emacs.d/plugins/org-mode/contrib/lisp/\\" t))
  54. (require 'org)
  55. (require 'ox)
  56. (require 'org-exp)
  57. (require 'org-inlinetask)
  58. (require 'ob-plantuml)
  59. (setq org-plantuml-jar-path \\"/home/myles/Downloads/plantuml.jar\\")
  60. (org-babel-do-load-languages
  61. 'org-babel-load-languages
  62. '((emacs-lisp . t)
  63. (sh . t)
  64. (plantuml . t)))
  65. (setq org-confirm-babel-evaluate nil)
  66. (setq org-latex-listings 'minted)
  67. (setq org-latex-with-hyperref nil)
  68. (add-to-list 'org-latex-packages-alist '(\\"\\" \\"minted\\"))
  69. (add-to-list 'org-latex-classes
  70. '(\\"mynewthesis\\" \\"\\\\\\documentclass[11pt]{mythesis}\\"
  71. (\\"\\\\\\chapter{%s}\\" . \\"\\\\\\chapter*{%s}\\")
  72. (\\"\\\\\\section{%s}\\" . \\"\\\\\\section*{%s}\\")
  73. (\\"\\\\\\subsection{%s}\\" . \\"\\\\\\subsection*{%s}\\")
  74. (\\"\\\\\\subsubsection{%s}\\" . \\"\\\\\\subsubsection*{%s}\\")
  75. (\\"\\\\\\paragraph{%s}\\" . \\"\\\\\\paragraph*{%s}\\")))
  76. (setq org-export-with-todo-keywords nil)
  77. (load-library \\"/home/myles/lib/lisp/my-export.el\\")
  78. (add-to-list 'org-export-before-parsing-hook 'my-export-delete-headlines-tagged-noheading)
  79. (add-to-list 'org-export-filter-link-functions 'my-autoref-filter-link-func)
  80. (load-file \\"thesis.el\\")
  81. (find-file \\"${CMAKE_CURRENT_BINARY_DIR}/mainThesis.org\\")
  82. (org-latex-export-to-latex))\"
  83. DEPENDS orgfile elfile
  84. COMMENT "Exporting orgmode file to LaTeX using emacs")
  85. add_custom_target( mainfile ALL
  86. DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mainThesis.tex )
  87. # ------ end mainThesis.org ---------------------------
  88. # add_custom_command(
  89. # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/master.tex
  90. # COMMAND echo "\\\\input{mainThesis.tex}" > ${CMAKE_CURRENT_BINARY_DIR}/master.tex
  91. # DEPENDS orgfile
  92. # COMMENT "Writing file master.tex")
  93. # add_custom_target( masterfile ALL
  94. # DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/master.tex )
  95. add_latex_document(master.tex
  96. BIBFILES texlib/mybiblatex.bib
  97. INPUTS biber.conf
  98. phd_papers.bib
  99. tex/title.tex
  100. tex/titleBasic.tex
  101. tex/abstract.tex
  102. tex/sharedMemory_sec.tex
  103. texlib/mystyle.sty
  104. tex/linked_nodes_test.tex
  105. IMAGE_DIRS ${IMAGE_DIR} ../graphics/thirdParty ../graphics/VE
  106. DEPENDS ${ALL_R_FILES}
  107. DEFAULT_PDF
  108. USE_NOMENCL)