netcdf-c/ncgen/CMakeLists.txt

85 lines
3.2 KiB
CMake
Raw Normal View History

Primary change: add dap4 support Specific changes: 1. Add dap4 code: libdap4 and dap4_test. Note that until the d4ts server problem is solved, dap4 is turned off. 2. Modify various files to support dap4 flags: configure.ac, Makefile.am, CMakeLists.txt, etc. 3. Add nc_test/test_common.sh. This centralizes the handling of the locations of various things in the build tree: e.g. where is ncgen.exe located. See nc_test/test_common.sh for details. 4. Modify .sh files to use test_common.sh 5. Obsolete separate oc2 by moving it to be part of netcdf-c. This means replacing code with netcdf-c equivalents. 5. Add --with-testserver to configure.ac to allow override of the servers to be used for --enable-dap-remote-tests. 6. There were multiple versions of nctypealignment code. Try to centralize in libdispatch/doffset.c and include/ncoffsets.h 7. Add a unit test for the ncuri code because of its complexity. 8. Move the findserver code out of libdispatch and into a separate, self contained program in ncdap_test and dap4_test. 9. Move the dispatch header files (nc{3,4}dispatch.h) to .../include because they are now shared by modules. 10. Revamp the handling of TOPSRCDIR and TOPBUILDDIR for shell scripts. 11. Make use of MREMAP if available 12. Misc. minor changes e.g. - #include <config.h> -> #include "config.h" - Add some no-install headers to /include - extern -> EXTERNL and vice versa as needed - misc header cleanup - clean up checking for misc. unix vs microsoft functions 13. Change copyright decls in some files to point to LICENSE file. 14. Add notes to RELEASENOTES.md
2017-03-09 08:01:10 +08:00
IF(BUILD_SHARED_LIBS AND WIN32)
remove_definitions(-DDLL_EXPORT)
remove_definitions(-DDLL_NETCDF)
ENDIF()
SET(ncgen_FILES generate.c main.c cdata.c bindata.c genchar.c cvt.c data.c debug.c escapes.c genc.c genbin.c generr.c genlib.c getfill.c odom.c semantics.c ncgeny.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c ncgen.h)
# don't add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
2012-08-04 06:24:29 +08:00
2012-09-14 06:07:35 +08:00
IF(USE_X_GETOPT)
SET(ncgen_FILES ${ncgen_FILES} XGetopt.c)
2012-09-14 06:07:35 +08:00
ENDIF()
2012-08-04 06:24:29 +08:00
ADD_EXECUTABLE(ncgen ${ncgen_FILES})
2012-08-11 05:44:00 +08:00
TARGET_LINK_LIBRARIES(ncgen netcdf ${ALL_TLL_LIBS})
2012-08-04 06:24:29 +08:00
####
# We have to do a little tweaking
# to remove the Release/ and Debug/ directories
# in MSVC builds. This is required to get
# test scripts to work.
####
IF(MSVC)
2015-11-25 06:16:23 +08:00
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
2015-11-25 06:16:23 +08:00
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(ncgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
INSTALL(TARGETS ncgen DESTINATION bin COMPONENT utilities)
2012-08-04 06:24:29 +08:00
# Copy the input for the flex file (ncgen.l)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.l ${CMAKE_CURRENT_SOURCE_DIR}/*.y)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
# Stuff to build if tests are enabled.
2012-08-08 06:42:42 +08:00
IF(ENABLE_TESTS)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
2015-11-25 06:16:23 +08:00
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
add_sh_test(ncgen run_tests)
IF(USE_NETCDF4)
add_sh_test(ncgen run_nc4_tests)
ENDIF()
2012-08-08 06:42:42 +08:00
ENDIF()
2012-08-04 06:24:29 +08:00
2012-10-18 05:14:30 +08:00
SET(MAN_FILES ncgen.1)
IF(NOT MSVC)
INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1"
COMPONENT documentation)
ENDIF()
2012-08-28 05:49:09 +08:00
SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
2015-11-20 04:44:07 +08:00
# These rules are used if someone wants to rebuild ncgeny.c or ncgenl.c
2014-12-29 06:54:02 +08:00
# Otherwise never invoked, but records how to do it.
# BTW: note that renaming is essential because otherwise
# autoconf will forcibly delete files of the name *.tab.*
ADD_CUSTOM_COMMAND(
OUTPUT ncgentab.h
COMMAND flex -Pncg -8 ncgen.l
2015-11-20 04:44:07 +08:00
COMMAND rm -f ncgenl.c
COMMAND mv lex.ncg.c ncgenl.c
2016-05-12 05:31:17 +08:00
COMMAND bison -pncg -t -d ncgen.y
2015-11-20 04:44:07 +08:00
COMMAND rm -f ncgeny.c ncgeny.h
COMMAND mv ncgen.tab.c ncgeny.c
COMMAND mv ncgen.tab.h ncgeny.h
COMMAND mv ncgeny.h ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND mv ncgeny.c ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND mv ncgenl.c ${CMAKE_CURRENT_SOURCE_DIR}
)
2015-11-25 06:16:23 +08:00
ADD_CUSTOM_TARGET(makeparser DEPENDS ncgentab.h)
## Specify files to be distributed by 'make dist'
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
2017-03-21 04:28:38 +08:00
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ncgen.y ncgenl.c ncgen.l internals.html c0.cdl c0_4.cdl ref_camrun.cdl ncf199.cdl tst_gattenum.cdl CMakeLists.txt Makefile.am ncgen.1)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")