-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild_uav_toolkit.pro
72 lines (58 loc) · 2.04 KB
/
build_uav_toolkit.pro
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
;h+
; Copyright (c) 2019 Harris Geospatial Solutions, Inc.
;
; Licensed under MIT. See LICENSE.txt for additional details and information.
;h-
;+
;
; :Private:
;
; IDL batch file that will compile the code present into a single IDL
; SAVE file called the UAV Toolkit. This will also place the task files next to
; the compiled source code.
;
; This is only necessary if you are trying to use the UAV Toolkit without IDL
; or with the enterprise version of ENVI/IDL.
;
; Just press compile + run in the IDL workbench to build the IDL SAVE file.
;
; The output directory will be called "UAVToolkit-build" in your system temporary
; folder. This helps avoid any conflicts on IDL's search path.
;
;
; :Author: Zachary Norman - GitLab: [znorman-harris](https://github.com/znorman-harris)
;-
;get this source directory
thisDir = file_dirname(routine_filepath())
;set up our output location
outDir = filepath('', /TMP) + 'UAVToolkit-build'
if ~file_test(outDir, /DIRECTORY) then file_mkdir, outDir
;search for PRO files
files = file_search(thisDir, '*.pro', COUNT = nPro)
;validate
if (nPro eq 0) then begin
message, 'No PRO files found in this source directory, where did they go?'
endif
;array of files to exclude form the build
exclude = ['build_uav_toolkit.pro']
;start child process
bdg = idl_idlbridge()
;compile each file
foreach file, files do begin
;skip condition
if (total(strlowcase(file_basename(file)) eq exclude) gt 0) then continue
bdg.execute, '.compile "' + file + '"'
endforeach
;resolve dependencies
bdg.execute, 'resolve_routine, "readexif__define"'
bdg.execute, 'resolve_routine, "exifmetadata__define"'
bdg.execute, 'resolve_all, /CONTINUE_ON_ERROR, SKIP_ROUTINES = ["envi", "envi_doit"]'
;save routines and clean up
bdg.execute, 'save, /ROUTINES, FILENAME = "' + outDir + path_sep() + 'uav_toolkit.sav"'
obj_destroy, bdg
;copy task files
taskFiles = file_search(thisDir, '*.task', COUNT = nTask)
if (nTask gt 0) then file_copy, taskFiles, outDir, /OVERWRITE
;alert user of output location
print, 'Build located at : ' + outDir
end