2018-12-07 06:42:41 +08:00
|
|
|
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
|
|
|
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
|
|
|
# 2015, 2016, 2017, 2018
|
|
|
|
# University Corporation for Atmospheric Research/Unidata.
|
|
|
|
|
|
|
|
# See netcdf-c/COPYRIGHT file for more info.
|
2020-07-30 06:13:17 +08:00
|
|
|
SET(ncgen3_FILES main.c load.c escapes.c getfill.c init.c genlib.c ncgeny.c)
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2020-05-19 09:36:28 +08:00
|
|
|
IF(USE_X_GETOPT)
|
|
|
|
SET(ncgen3_FILES ${ncgen3_FILES} XGetopt.c)
|
|
|
|
ENDIF()
|
|
|
|
|
2012-08-11 04:55:07 +08:00
|
|
|
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
|
|
|
|
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
|
|
|
|
|
2020-07-30 06:13:17 +08:00
|
|
|
IF(NOT EXISTS ${netCDF_SOURCE_DIR}/ncgen3/ncgeny.c AND NOT EXISTS
|
|
|
|
${netCDF_SOURCE_DIR}/ncgen3/ncgeny.h)
|
2014-04-22 00:49:39 +08:00
|
|
|
ADD_CUSTOM_COMMAND(
|
2020-07-30 06:52:10 +08:00
|
|
|
OUTPUT ncgentab.h
|
2020-07-30 06:13:17 +08:00
|
|
|
COMMAND flex -Pncg -8 ncgen.l
|
|
|
|
COMMAND rm -f ncgenl.c
|
|
|
|
COMMAND mv lex.ncg.c ncgenl.c
|
|
|
|
COMMAND bison -pncg -t -d ncgen.y
|
|
|
|
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}
|
|
|
|
VERBATIM
|
2014-04-22 00:49:39 +08:00
|
|
|
)
|
2012-10-04 04:47:34 +08:00
|
|
|
ENDIF()
|
2015-01-28 04:57:51 +08:00
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
ADD_EXECUTABLE(ncgen3 ${ncgen3_FILES})
|
2014-04-22 00:49:39 +08:00
|
|
|
TARGET_LINK_LIBRARIES(ncgen3 netcdf ${ALL_TLL_LIBS})
|
2020-08-18 09:15:47 +08:00
|
|
|
|
2015-01-28 04:57:51 +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)
|
2018-12-07 06:42:41 +08:00
|
|
|
SET_TARGET_PROPERTIES(ncgen3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
2018-12-07 06:42:41 +08:00
|
|
|
SET_TARGET_PROPERTIES(ncgen3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG
|
2015-01-28 04:57:51 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(ncgen3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2012-08-11 04:55:07 +08:00
|
|
|
IF(ENABLE_TESTS)
|
2014-04-22 00:49:39 +08:00
|
|
|
SET(NCGEN3_TESTS run_tests)
|
2020-08-18 09:15:47 +08:00
|
|
|
IF(USE_HDF5)
|
2014-04-22 00:49:39 +08:00
|
|
|
SET(NCGEN3_TESTS ${NCGEN3_TESTS} run_nc4_tests)
|
|
|
|
ENDIF()
|
2018-12-07 06:42:41 +08:00
|
|
|
|
2014-04-22 00:49:39 +08:00
|
|
|
FOREACH(F ${NCGEN3_TESTS})
|
|
|
|
add_sh_test(ncgen3 ${F})
|
|
|
|
ENDFOREACH()
|
2012-08-11 04:55:07 +08:00
|
|
|
ENDIF()
|
2018-12-07 06:42:41 +08:00
|
|
|
INSTALL(TARGETS ncgen3 DESTINATION bin COMPONENT utilities)
|
2012-08-28 05:49:09 +08:00
|
|
|
|
2012-10-18 05:14:30 +08:00
|
|
|
SET(MAN_FILES ncgen3.1)
|
2012-12-21 05:50:45 +08:00
|
|
|
IF(NOT MSVC)
|
2014-04-22 00:49:39 +08:00
|
|
|
INSTALL(FILES ${MAN_FILES} DESTINATION "share/man/man1" COMPONENT documentation)
|
2012-12-21 05:50:45 +08:00
|
|
|
ENDIF()
|
2012-10-18 05:14:30 +08:00
|
|
|
|
2013-06-04 00:42:04 +08:00
|
|
|
## 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)
|
2020-05-19 09:36:28 +08:00
|
|
|
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am ncgen.y ncgenyy.c ncgen.l c0.cdl ncgen3.1)
|
2013-06-04 00:42:04 +08:00
|
|
|
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|
|
|
|
|
|
|
|
|
2018-12-07 06:42:41 +08:00
|
|
|
SET(CLEANFILES c0.nc c0_64.nc c0_4.nc c0_4c.nc)
|
2012-08-28 05:49:09 +08:00
|
|
|
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")
|