source: trunk/bindings/swig/CMakeLists.txt @ 1822

Revision 1635, 4.7 KB checked in by Stephen Rankin, 8 months ago (diff)

First stab at a cmake build for the SWIG bindings (untested). ref#281

Line 
1## Process this file with cmake
2#====================================================================
3#  NeXus - Neutron & X-ray Common Data Format
4
5#  CMakeLists for building the NeXus library and applications.
6#
7#  Copyright (C) 2011 Stephen Rankin
8
9#  This library is free software; you can redistribute it and/or
10#  modify it under the terms of the GNU Lesser General Public
11#  License as published by the Free Software Foundation; either
12#  version 2 of the License, or (at your option) any later version.
13#
14#  This library is distributed in the hope that it will be useful,
15#  but WITHOUT ANY WARRANTY; without even the implied warranty of
16#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17#  Lesser General Public License for more details.
18#
19#  You should have received a copy of the GNU Lesser General Public
20#  License along with this library; if not, write to the Free
21#  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22#  MA  02111-1307  USA
23#             
24#  For further information, see <http://www.neutron.anl.gov/NeXus/>
25#
26#
27#====================================================================
28
29if (SWIG_FOUND AND TCL_FOUND)
30
31    set (SWIG_TCL_WRAP nxinter_wrap.c)
32
33    add_definitions(-DIN_NEXUS_LIBRARY ${HDF5_DEFINITIONS} ${HDF5_CPP} ${HDF4_CPP} ${MXML_CPP})
34
35    ADD_CUSTOM_COMMAND(
36        OUTPUT    ${SWIG_TCL_WRAP}
37        COMMAND   ${SWIG_EXECUTABLE}
38        ARGS      -I$(CMAKE_SOURCE_DIR)/bindings/swig -o ${SWIG_TCL_WRAP} -tcl -ltclsh.i nxinter.i
39        COMMENT   "Generating ${SWIG_TCL_WRAP}"
40    )
41
42    ADD_CUSTOM_TARGET(NexusSwingTCLBuild ALL echo
43        DEPENDS   ${SWIG_TCL_WRAP}
44    )
45
46    add_library (SWIG_TCL_Static_Library STATIC ${SWIG_TCL_WRAP})
47
48    set_target_properties(SWIG_TCL_Static_Library PROPERTIES OUTPUT_NAME libnxtcl)
49
50    target_link_libraries(SWIG_TCL_Static_Library NeXus_Static_Library ${TCL_LIBRARY})
51
52    add_executable (nxinter ${SWIG_TCL_WRAP} ${TCL_INCLUDE_PATH})
53
54    target_link_libraries(nxinter NeXus_Static_Library ${TCL_LIBRARY})
55
56endif (SWIG_FOUND AND TCL_FOUND)
57
58if (SWIG_FOUND AND GUILE_FOUND)
59
60    set (SWIG_GUILE_WRAP nxguile_wrap.c)
61
62    add_definitions(-DSWIGINIT="SCM scm_init_nxinter_module(void); scm_init_nxinter_module();")
63
64    ADD_CUSTOM_COMMAND(
65        OUTPUT    ${SWIG_GUILE_WRAP}
66        COMMAND   ${SWIG_EXECUTABLE}
67        ARGS      -I$(CMAKE_SOURCE_DIR)/bindings/swig -o ${SWIG_GUILE_WRAP} -guile -lguilemain.i nxinter.i
68        COMMENT   "Generating ${SWIG_GUILE_WRAP}"
69    )
70
71    ADD_CUSTOM_TARGET(NexusSwingGuileBuild ALL echo
72        DEPENDS   ${SWIG_GUILE_WRAP}
73    )
74
75    add_library (SWIG_GUILE_Static_Library STATIC ${SWIG_GUILE_WRAP})
76
77    set_target_properties(SWIG_GUILE_Static_Library PROPERTIES OUTPUT_NAME libnxguile)
78
79    target_link_libraries(SWIG_GUILE_Static_Library NeXus_Static_Library ${GUILE_LIB})
80
81    add_executable (nxguile ${SWIG_GUILE_WRAP} ${GUILE_INCLUDE})
82
83    target_link_libraries(nxguile NeXus_Static_Library ${GUILE_LIB})
84
85endif (SWIG_FOUND AND GUILE_FOUND)
86
87if (SWIG_FOUND AND MZScheme_FOUND)
88
89    set (SWIG_MZScheme_WRAP nxscheme_wrap.c)
90
91    add_definitions(-DSWIGINIT="SCM scm_init_nxinter_module(void); scm_init_nxinter_module();")
92
93    ADD_CUSTOM_COMMAND(
94        OUTPUT    ${SWIG_MZScheme_WRAP}
95        COMMAND   ${SWIG_EXECUTABLE}
96        ARGS      -I$(CMAKE_SOURCE_DIR)/bindings/swig -o ${SWIG_MZScheme_WRAP} -mzscheme nxinter.i
97        COMMENT   "Generating ${SWIG_MZScheme_WRAP}"
98    )
99
100    ADD_CUSTOM_TARGET(NexusSwingMZSchemeBuild ALL echo
101        DEPENDS   ${SWIG_MZScheme_WRAP}
102    )
103
104    add_library (SWIG_MZScheme_Static_Library STATIC ${SWIG_MZScheme_WRAP})
105
106    set_target_properties(SWIG_MZScheme_Static_Library PROPERTIES OUTPUT_NAME libnxscheme)
107
108    target_link_libraries(testmxml MXML_Static_Library ${PTHREAD_LINK})
109
110endif (SWIG_FOUND AND MZScheme_FOUND)
111
112set (DOC_SRC nxinter.tex)
113
114if (LATEX_FOUND)
115
116    ADD_CUSTOM_COMMAND(
117        OUTPUT    nxinter.aux
118        COMMAND   ${LATEX_COMPILER}
119        ARGS      ${DOC_SRC}
120        DEPENDS   nxinter.tex
121        COMMENT   "Generating SWIG INTER DVI"
122    )
123
124    ADD_CUSTOM_COMMAND(
125        OUTPUT    nxinter.dvi
126        COMMAND   ${LATEX_COMPILER}
127        ARGS      ${DOC_SRC}
128        DEPENDS   nxinter.aux
129        COMMENT   "Generating SWIG INTER DVI"
130    )
131
132    ADD_CUSTOM_COMMAND(
133        OUTPUT    nxinter.ps
134        COMMAND   ${DVIPS_CONVERTER}
135        ARGS      -o nxinter.ps nxinter.dvi
136        DEPENDS   nxinter.dvi
137        COMMENT   "Generating SWIG INTER PS"
138    )
139
140    ADD_CUSTOM_COMMAND(
141        OUTPUT    nxinter.pdf
142        COMMAND   ${PS2PDF_CONVERTER}
143        ARGS      nxinter.ps nxinter.pdf
144        DEPENDS   nxinter.ps
145        COMMENT   "Generating SWIG INTER PDF"
146    )
147
148    ADD_CUSTOM_TARGET(NexusSwingDOCBuild ALL echo
149        DEPENDS   nxinter.pdf
150    )
151
152endif (LATEX_FOUND)
Note: See TracBrowser for help on using the repository browser.