@@ -9,39 +9,40 @@ set (TOOLS_SRC_FILES pftappinit.c printdatabox.c readdatabox.c databox.c
99 toposlopes.c sum.c solidtools.c
1010 )
1111
12- add_library (pftools SHARED ${TOOLS_SRC_FILES} )
12+ if (PARFLOW_HAVE_TCL)
13+ add_library (pftools SHARED ${TOOLS_SRC_FILES} )
1314
14- target_include_directories (pftools PUBLIC ${TCL_INCLUDE_PATH} )
15- target_link_libraries (pftools ${TCL_LIBRARY} )
15+ target_include_directories (pftools PUBLIC ${TCL_INCLUDE_PATH} )
16+ target_link_libraries (pftools ${TCL_LIBRARY} )
1617
17- if (${PARFLOW_HAVE_SILO} )
18- target_include_directories (pftools PUBLIC "${SILO_INCLUDE_DIRS} " )
19- target_link_libraries (pftools ${SILO_LIBRARIES} )
20- endif (${PARFLOW_HAVE_SILO} )
18+ if (${PARFLOW_HAVE_SILO} )
19+ target_include_directories (pftools PUBLIC "${SILO_INCLUDE_DIRS} " )
20+ target_link_libraries (pftools ${SILO_LIBRARIES} )
21+ endif (${PARFLOW_HAVE_SILO} )
2122
22- if (${PARFLOW_HAVE_HDF5} )
23- target_include_directories (pftools PUBLIC "${HDF5_INCLUDE_DIRS} " )
24- target_link_libraries (pftools ${HDF5_LIBRARIES} )
25- endif (${PARFLOW_HAVE_HDF5} )
23+ if (${PARFLOW_HAVE_HDF5} )
24+ target_include_directories (pftools PUBLIC "${HDF5_INCLUDE_DIRS} " )
25+ target_link_libraries (pftools ${HDF5_LIBRARIES} )
26+ endif (${PARFLOW_HAVE_HDF5} )
2627
27- if (${PARFLOW_HAVE_ZLIB} )
28- target_link_libraries (pftools ${ZLIB_LIBRARIES} )
29- endif (${PARFLOW_HAVE_ZLIB} )
28+ if (${PARFLOW_HAVE_ZLIB} )
29+ target_link_libraries (pftools ${ZLIB_LIBRARIES} )
30+ endif (${PARFLOW_HAVE_ZLIB} )
3031
31- if (${PARFLOW_HAVE_SZLIB} )
32- target_link_libraries (pftools ${SZLIB_LIBRARIES} )
33- endif (${PARFLOW_HAVE_SZLIB} )
32+ if (${PARFLOW_HAVE_SZLIB} )
33+ target_link_libraries (pftools ${SZLIB_LIBRARIES} )
34+ endif (${PARFLOW_HAVE_SZLIB} )
3435
35- # Install to bin is for TCL which seem to prefer shared libraries
36- # there for some installs.
37- install (TARGETS pftools DESTINATION bin)
38- install (TARGETS pftools DESTINATION lib)
36+ # Install to bin is for Tcl, which expects shared libraries there on some systems.
37+ install (TARGETS pftools DESTINATION bin)
38+ install (TARGETS pftools DESTINATION lib)
3939
40- file (GLOB TCL_SRC *.tcl )
41- install (FILES ${TCL_SRC} DESTINATION bin)
40+ file (GLOB TCL_SRC *.tcl )
41+ install (FILES ${TCL_SRC} DESTINATION bin)
4242
43- set (SCRIPTS pfhelp pfmvio pfbtosa pfbtovis pfbtosilo pfsbtosa pfstrip)
44- install (PROGRAMS ${SCRIPTS} DESTINATION bin)
43+ set (SCRIPTS pfhelp pfmvio pfbtosa pfbtovis pfbtosilo pfsbtosa pfstrip)
44+ install (PROGRAMS ${SCRIPTS} DESTINATION bin)
45+ endif ()
4546
4647add_executable (pfwell_cat pfwell_cat.c well.c )
4748install (TARGETS pfwell_cat DESTINATION bin)
@@ -65,9 +66,25 @@ install(TARGETS projecttin DESTINATION bin)
6566#-----------------------------------------------------------------------------
6667# Mask utilities
6768#-----------------------------------------------------------------------------
68- add_executable (pfmask-to-pfsol pfmask-to-pfsol.cpp )
69+
70+ # This is first step at enabling building without TCL. The pfmask-to-pfsol utility was
71+ # originally written to link against the TCL library; this was changed to
72+ # compile allow compiling with the needed funtions directly. Should consider
73+ # reworking this utility using the Python library or seperating the TCL from the other
74+ # utilities into two libraries to link against.
75+ if (PARFLOW_HAVE_TCL)
76+ add_executable (pfmask-to-pfsol pfmask-to-pfsol.cpp )
77+ target_link_libraries (pfmask-to-pfsol pftools )
78+ else ()
79+ add_executable (pfmask-to-pfsol pfmask-to-pfsol.cpp readdatabox.c databox.c tools_io.c )
80+ endif ()
81+
6982target_include_directories (pfmask-to-pfsol PUBLIC third_party )
70- target_link_libraries (pfmask-to-pfsol pftools )
83+ if (${PARFLOW_HAVE_SILO} )
84+ target_include_directories (pfmask-to-pfsol PUBLIC "${SILO_INCLUDE_DIRS} " )
85+ target_link_libraries (pfmask-to-pfsol ${SILO_LIBRARIES} )
86+ endif (${PARFLOW_HAVE_SILO} )
87+
7188install (TARGETS pfmask-to-pfsol DESTINATION bin)
7289
7390add_executable (pfsol-to-vtk pfsol-to-vtk.c )
@@ -77,4 +94,6 @@ add_executable(pfmaskdownsize pfmaskdownsize.cpp)
7794target_include_directories (pfmaskdownsize PUBLIC third_party )
7895install (TARGETS pfmaskdownsize DESTINATION bin)
7996
80- add_subdirectory (test )
97+ if (PARFLOW_HAVE_TCL)
98+ add_subdirectory (test )
99+ endif ()
0 commit comments