-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (54 loc) · 1.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
project (version-controlled-paper)
cmake_minimum_required (VERSION 2.8)
set ( MANUSCRIPT_NAME fourpisky_hub_intro )
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set (FIGURE_OUTPUT_DIR ${PROJECT_BINARY_DIR}/figures)
find_package (LATEX REQUIRED)
find_package (LatexMk REQUIRED)
find_package (PythonInterp REQUIRED)
# Versioning
execute_process (
COMMAND git log -1 --date=short --pretty=\\newcommand{\\githash}{%h}\\newcommand{\\gitdate}{%ad}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_CMD
)
# We copy all the static figures from the source tree to a 'figures' folder
# under the build root.
file(GLOB STATIC_FIGURES
"${PROJECT_SOURCE_DIR}/figures/*.pdf"
)
foreach (figure ${STATIC_FIGURES})
get_filename_component(figure_basename ${figure} NAME)
MESSAGE( STATUS "Copying figure: " ${figure_basename} )
configure_file (
${figure}
${PROJECT_BINARY_DIR}/figures/${figure_basename}
COPYONLY
)
endforeach (figure)
# Likewise we copy all files from the 'manuscripts' folder to the build root
file(GLOB MANUSCRIPT_FILES
"${PROJECT_SOURCE_DIR}/manuscript/*"
)
foreach (manuscript ${MANUSCRIPT_FILES})
get_filename_component(manuscript_basename ${manuscript} NAME)
MESSAGE( STATUS "Copying manuscript: " ${manuscript_basename} )
configure_file (
${manuscript}
${PROJECT_BINARY_DIR}/${manuscript_basename}
@ONLY
)
endforeach (manuscript)
add_custom_command (
OUTPUT ${PROJECT_BINARY_DIR}/${MANUSCRIPT_NAME}.pdf
COMMAND ${LATEXMK_EXECUTABLE}
ARGS -pdf -pdflatex=\"pdflatex --shell-escape %O %S\" ${PROJECT_BINARY_DIR}/${MANUSCRIPT_NAME}.tex
DEPENDS
${PROJECT_BINARY_DIR}/${MANUSCRIPT_NAME}.tex
${PROJECT_BINARY_DIR}/${MANUSCRIPT_NAME}.bib
# #List of generated figures we also depend on:
# ${FIGURE_OUTPUT_DIR}/results/V_predictedVobserved.pdf
)
add_custom_target (paper ALL echo
DEPENDS ${PROJECT_BINARY_DIR}/${MANUSCRIPT_NAME}.pdf
)