Mercurial > mxe-octave
comparison src/of-dicom-1-fixes.patch @ 4386:d28a54afe7e7
of-dicom: update patch to work for both stable and dev octave
* src/of-dicom-1-fixes.patch: update patch from dicom repo
* src/of-dicom.mk: call autoreconfig on src directory
author | John D |
---|---|
date | Tue, 16 May 2017 08:36:10 -0400 |
parents | 3606cb5973b5 |
children | f45182733409 |
comparison
equal
deleted
inserted
replaced
4385:722693b132ad | 4386:d28a54afe7e7 |
---|---|
1 diff -uNr a/src/dicomdict.cpp b/src/dicomdict.cpp | 1 diff -r c6fc977bc48a src/Makefile.in |
2 --- a/src/dicomdict.cpp 2011-12-20 15:52:53.000000000 -0500 | 2 --- a/src/Makefile.in Thu Feb 23 08:34:52 2017 +0100 |
3 +++ b/src/dicomdict.cpp 2017-04-27 09:05:53.295379421 -0400 | 3 +++ b/src/Makefile.in Tue May 16 08:25:04 2017 -0400 |
4 @@ -4,6 +4,8 @@ | |
5 GDCM_CPPFLAGS = @GDCM_CXXFLAGS@ | |
6 GDCM_LIBS = @GDCM_LIBS@ | |
7 | |
8 +OCTAVE_DEFS = -DHAVE_OCTAVE_LOAD_PATH=@HAVE_OCTAVE_LOAD_PATH@ | |
9 + | |
10 need_dict = dicominfo.oct dicomwrite.oct dicomlookup.oct | |
11 | |
12 test_files = dicominfo.cpp dicomdict.cpp dicomread.cpp dicomlookup.cpp isdicom.cpp dicomuid.oct | |
13 @@ -11,13 +13,13 @@ | |
14 all: $(need_dict) dicomdict.oct dicomread.oct _gendicomdict.oct isdicom.oct dicomuid.oct | |
15 | |
16 %.o: %.cpp | |
17 - $(MKOCTFILE) $(GDCM_CPPFLAGS) -c $< | |
18 + $(MKOCTFILE) $(OCTAVE_DEFS) $(GDCM_CPPFLAGS) -c $< | |
19 | |
20 $(need_dict): %.oct: %.cpp dicomdict.o | |
21 - $(MKOCTFILE) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $^ | |
22 + $(MKOCTFILE) $(OCTAVE_DEFS) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $^ | |
23 | |
24 %.oct: %.cpp | |
25 - $(MKOCTFILE) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $< | |
26 + $(MKOCTFILE) $(OCTAVE_DEFS) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $< | |
27 | |
28 clean: | |
29 $(RM) *.o *.oct *~ | |
30 diff -r c6fc977bc48a src/configure.ac | |
31 --- a/src/configure.ac Thu Feb 23 08:34:52 2017 +0100 | |
32 +++ b/src/configure.ac Tue May 16 08:25:04 2017 -0400 | |
33 @@ -6,9 +6,48 @@ | |
34 | |
35 AC_PROG_SED | |
36 | |
37 +AC_PATH_PROG([MKOCTFILE], [mkoctfile]) | |
38 +if test -z "$MKOCTFILE"; then | |
39 + AC_MSG_ERROR([*** 'mkoctfile' not found.]) | |
40 +fi | |
41 + | |
42 AC_PROG_CXX | |
43 AC_LANG(C++) | |
44 | |
45 +## octave API tests | |
46 +save_CXX="$CXX" | |
47 +save_CXXFLAGS="$CXXFLAGS" | |
48 +CXX=`${MKOCTFILE} -p CXX` | |
49 +CXXFLAGS="$CXXFLAGS -I`$MKOCTFILE -p OCTINCLUDEDIR`" | |
50 + | |
51 +# need to use interpreter->get_load_path in dev version of octave, | |
52 +# prior to that methods of load_path were static | |
53 +AC_CACHE_CHECK( | |
54 + [interpreter get_load_path], | |
55 + [octave_cv_interpreter_get_load_path], | |
56 + [AC_COMPILE_IFELSE( | |
57 + [AC_LANG_PROGRAM([ | |
58 + #include <oct.h> | |
59 + #include <octave.h> | |
60 + #include <interpreter.h> | |
61 + #include <load-path.h> | |
62 + ], | |
63 + [ | |
64 + octave::load_path &p = octave::application::the_interpreter ()->get_load_path (); | |
65 + ])], | |
66 + [octave_cv_interpreter_get_load_path=yes], | |
67 + [octave_cv_interpreter_get_load_path=no]) | |
68 + ]) | |
69 +if test "$octave_cv_interpreter_get_load_path" = "yes" ; then | |
70 + HAVE_OCTAVE_LOAD_PATH=1 | |
71 +else | |
72 + HAVE_OCTAVE_LOAD_PATH=0 | |
73 +fi | |
74 +AC_SUBST(HAVE_OCTAVE_LOAD_PATH) | |
75 + | |
76 +CC=$save_CXX | |
77 +CXXFLAGS=$save_CXXFLAGS | |
78 + | |
79 dnl | |
80 dnl GDCM headers are in a version specific path. They use CMake and | |
81 dnl provide a project.cmake config file which has the correct flags to | |
82 diff -r c6fc977bc48a src/dicomdict.cpp | |
83 --- a/src/dicomdict.cpp Thu Feb 23 08:34:52 2017 +0100 | |
84 +++ b/src/dicomdict.cpp Tue May 16 08:25:04 2017 -0400 | |
4 @@ -25,6 +25,8 @@ | 85 @@ -25,6 +25,8 @@ |
5 */ | 86 */ |
6 | 87 |
7 #include "octave/oct.h" | 88 #include "octave/oct.h" |
8 +#include "octave/octave.h" | 89 +#include "octave/octave.h" |
9 +#include "octave/interpreter.h" | 90 +#include "octave/interpreter.h" |
10 #include "octave/load-path.h" | 91 #include "octave/load-path.h" |
11 | 92 |
12 #include "gdcm-2.0/gdcmDict.h" | 93 #include "gdcmDict.h" |
13 @@ -256,12 +258,23 @@ | 94 @@ -263,13 +265,20 @@ |
14 } | 95 } |
15 | 96 |
16 // find dic if it is anywhere in the search path (same path as for m-files etc) | 97 // find dic if it is anywhere in the search path (same path as for m-files etc) |
17 + std::string resolved_filename(filename); | 98 + std::string resolved_filename(filename); |
18 + | |
19 #ifndef NOT_OCT | 99 #ifndef NOT_OCT |
20 - const std::string resolved_filename=load_path::find_file(std::string(filename)) ; | 100 - const std::string resolved_filename=load_path::find_file(std::string(filename)) ; |
21 -#else | 101 +#if HAVE_OCTAVE_LOAD_PATH == 1 |
102 + octave::interpreter *interp = octave::application::the_interpreter (); | |
103 + if (interp) { | |
104 + octave::load_path& lp = interp->get_load_path (); | |
105 + resolved_filename = lp.find_file (std::string (filename)); | |
106 + } | |
107 + else | |
108 + warning ("load_dicom_dict: interpreter context missing"); | |
109 #else | |
22 - // for debugging: if not running in octave, find_file always returns "" | 110 - // for debugging: if not running in octave, find_file always returns "" |
23 - // so we just use the original filename | 111 - // so we just use the original filename |
24 - const std::string resolved_filename(filename); | 112 - const std::string resolved_filename(filename); |
25 + // Temporary fix. Eventually, a pointer to the Octave | 113 -#endif |
26 + // interpreter should come from information passed to the | 114 + resolved_filename=load_path::find_file(std::string(filename)); |
27 + // DEFUN function that called us, not from global data. | 115 +#endif // HAVE_OCTAVE_LOAD_PATH |
28 + | 116 +#endif // NOT_OCT |
29 + octave::interpreter *interp = octave::application::the_interpreter (); | |
30 + | |
31 + if (interp) | |
32 + { | |
33 + octave::load_path& lp = interp->get_load_path (); | |
34 + | |
35 + resolved_filename = lp.find_file (std::string (filename)); | |
36 + } | |
37 + else | |
38 + warning ("load_dicom_dict: interpreter context missing"); | |
39 #endif | |
40 | 117 |
41 std::ifstream fin(resolved_filename.c_str()); | 118 std::ifstream fin(resolved_filename.c_str()); |
119 if (!fin) { |