2012-08-04 06:24:29 +08:00
|
|
|
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
INCLUDE_DIRECTORIES(".")
|
|
|
|
|
2013-03-01 05:03:02 +08:00
|
|
|
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 offsets.c semantics.c ncgentab.c dump.c util.c bytebuffer.c list.c genf77.c f77data.c genj.c jdata.c nc_iter.c ConvertUTF.c )
|
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)
|
|
|
|
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
|
|
|
|
2012-11-20 05:43:12 +08:00
|
|
|
INSTALL(TARGETS ncgen DESTINATION bin COMPONENT utilities)
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2013-01-16 06:43:09 +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}/)
|
|
|
|
|
2012-08-09 00:25:37 +08:00
|
|
|
# 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)
|
|
|
|
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
2012-09-15 00:15:18 +08:00
|
|
|
add_sh_test(ncgen run_tests)
|
|
|
|
#ADD_TEST(run_ncgen_tests sh ${CMAKE_CURRENT_BINARY_DIR}/run_tests.sh)
|
2012-08-08 06:42:42 +08:00
|
|
|
IF(USE_NETCDF4)
|
2012-09-20 05:32:28 +08:00
|
|
|
#ADD_TEST(run_ncgen_nc4_tests sh ${CMAKE_CURRENT_BINARY_DIR}/run_nc4_tests.sh)
|
2012-09-21 07:26:02 +08:00
|
|
|
add_sh_test(ncgen run_nc4_tests)
|
2012-08-08 06:42:42 +08:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2012-08-04 06:24:29 +08:00
|
|
|
|
2012-10-18 05:14:30 +08:00
|
|
|
SET(MAN_FILES ncgen.1)
|
2012-12-21 05:50:45 +08:00
|
|
|
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}")
|
|
|
|
|
2013-01-16 06:43:09 +08:00
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ncgentab.h
|
|
|
|
COMMAND flex -Pncg -B ncgen.l
|
|
|
|
COMMAND rm -f ncgenyy.c
|
|
|
|
COMMAND mv lex.ncg.c ncgenyy.c
|
|
|
|
COMMAND bison -pncg -t -d ncgen.y
|
|
|
|
COMMAND rm -f ncgentab.c ncgentab.h
|
|
|
|
COMMAND mv ncgen.tab.c ncgentab.c
|
|
|
|
COMMAND mv ncgen.tab.h ncgentab.h
|
|
|
|
)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(makeparser DEPENDS ncgentab.h)
|
|
|
|
|
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)
|
|
|
|
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} ncgen.y ncgenyy.c ncgen.l internals.html c0.cdl ref_camrun.cdl ncf199.cdl CMakeLists.txt Makefile.am ncgen.1)
|
|
|
|
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")
|