File: CMakeLists.txt

package info (click to toggle)
tasmanian 8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,852 kB
  • sloc: cpp: 34,523; python: 7,039; f90: 5,080; makefile: 224; sh: 64; ansic: 8
file content (103 lines) | stat: -rw-r--r-- 6,104 bytes parent folder | download | duplicates (2)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
########################################################################
# MATLAB interface, examples and tests
########################################################################

set(Tasmanian_matlab_source_files tsgCancelRefine.m
                                  tsgCleanTempFiles.m
                                  tsgCopyGrid.m
                                  tsgDeleteGridByName.m
                                  tsgDeleteGrid.m
                                  tsgDifferentiate.m
                                  tsgEstimateAnisotropicCoefficients.m
                                  tsgEvaluateHierarchy.m
                                  tsgEvaluate.m
                                  tsgExample.m
                                  tsgGetCandidateConstructionAnisotropic.m
                                  tsgGetCandidateConstructionSurplus.m
                                  tsgGetHCoefficients.m
                                  tsgGetHSupport.m
                                  tsgGetInterpolationWeights.m
                                  tsgGetDifferentiationWeights.m
                                  tsgGetNeededIndexes.m
                                  tsgGetNeededPoints.m
                                  tsgGetPointsIndexes.m
                                  tsgGetPoints.m
                                  tsgGetPolynomialSpaces.m
                                  tsgGetQuadrature.m
                                  tsgIntegrate.m
                                  tsgListGridsByName.m
                                  tsgLoadConstructedPoints.m
                                  tsgLoadGridFromFile.m
                                  tsgLoadHCoefficients.m
                                  tsgLoadValues.m
                                  tsgMakeExoticQuadrature.m
                                  tsgMakeFilenames.m
                                  tsgMakeFourier.m
                                  tsgMakeGlobal.m
                                  tsgMakeGridFilename.m
                                  tsgMakeLocalPolynomial.m
                                  tsgMakeQuadrature.m
                                  tsgMakeSequence.m
                                  tsgMakeWavelet.m
                                  tsgMergeRefine.m
                                  tsgPlotPoints2D.m
                                  tsgReadCustomRuleFile.m
                                  tsgReadMatrix.m
                                  tsgRefineAnisotropic.m
                                  tsgRefineSurplus.m
                                  tsgReloadGrid.m
                                  tsgSummary.m
                                  tsgUsingConstruction.m
                                  tsgCoreTests.m
                                  tsgWriteCustomRuleFile.m
                                  tsgWriteMatrix.m)

# configure_file() command causes update to the entire CMake environment, if the file changes
# using copy will copy the files on change but will not reconfigure the environment
foreach(Tasmanian_matlab_source_file ${Tasmanian_matlab_source_files})
    add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/matlab/${Tasmanian_matlab_source_file}"
                       COMMAND "${CMAKE_COMMAND}"
                       ARGS -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${Tasmanian_matlab_source_file}" "${CMAKE_CURRENT_BINARY_DIR}/matlab/${Tasmanian_matlab_source_file}"
                       DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${Tasmanian_matlab_source_file}"
                       COMMENT "Copying ${CMAKE_CURRENT_SOURCE_DIR}/${Tasmanian_matlab_source_file}")
    list(APPEND Tasmanian_matlab_pre_install_files "${CMAKE_CURRENT_BINARY_DIR}/matlab/${Tasmanian_matlab_source_file}")
endforeach()
add_custom_target(Tasmanian_matlab_interface ALL DEPENDS "${Tasmanian_matlab_pre_install_files}")

# set MATLAB (tasgrid and temp folder) for the build folder (stage 1)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tempMATLAB/") # place for temp files if running matlab from the build location
set(Tasmanian_matlab_tasgrid "${CMAKE_CURRENT_BINARY_DIR}/../Tasgrid/tasgrid")
string(REPLACE " " "\\ " Tasmanian_matlab_tasgrid "${Tasmanian_matlab_tasgrid}")
set(Tasmanian_matlab_workdir "${CMAKE_CURRENT_BINARY_DIR}/tempMATLAB/")
string(REPLACE " " "\\ " Tasmanian_matlab_workdir "${Tasmanian_matlab_workdir}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tsgGetPaths.build.m" "${CMAKE_CURRENT_BINARY_DIR}/matlab/tsgGetPaths.m" @ONLY)

# set MATLAB (tasgrid and temp folder) for the install folder (stage 2)
set(Tasmanian_matlab_tasgrid "${Tasmanian_final_install_path}/bin/tasgrid")
string(REPLACE " " "\\ " Tasmanian_matlab_tasgrid "${Tasmanian_matlab_tasgrid}")
#message("${Tasmanian_matlab_tasgrid}") # sanity check, especially if spaces are present in folder names
set(Tasmanian_matlab_workdir "${Tasmanian_MATLAB_WORK_FOLDER}/")
string(REPLACE " " "\\ " Tasmanian_matlab_workdir "${Tasmanian_matlab_workdir}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tsgGetPaths.install.m" "${CMAKE_CURRENT_BINARY_DIR}/configured/tsgGetPaths.m" @ONLY)

# test if we can find the octave executable and we can get the version
# do not test with MATLAB to avoid potential license issues
find_program(Tasmanian_OCTAVE_EXECUABLE NAMES octave)
if (Tasmanian_OCTAVE_EXECUABLE)
    execute_process(COMMAND octave --version OUTPUT_QUIET RESULT_VARIABLE Tasmanian_octave_works)
    if ("${Tasmanian_octave_works}" STREQUAL 0)
        add_test(TasmanianOctave octave --eval "addpath('${CMAKE_CURRENT_BINARY_DIR}/matlab'); tsgCoreTests()")
    endif()
endif()

# create the MATLAB work-folder on install
install(CODE "file(MAKE_DIRECTORY \"${Tasmanian_MATLAB_WORK_FOLDER}\")")

# installed files
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
        DESTINATION "share/Tasmanian/matlab/"
        FILES_MATCHING PATTERN "*.m"
        PATTERN "tsgGetPaths.*" EXCLUDE)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/configured/tsgGetPaths.m"
        DESTINATION "share/Tasmanian/matlab/"
        PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)