Skip to content

Commit

Permalink
remove USE_REGEX redefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
webisu committed Feb 9, 2024
1 parent 318e30d commit 6a612c1
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 17 deletions.
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ option(USE_REGEX "Use Regex?" on)
option(USE_TIGGE "Use tigge?" on)
option(USE_MYSQL "Use MySQL?" off)
# option(USE_IPOLATES "iplib=0,1,3?" 3)
set(USE_IPOLATES 3)
set(USE_IPOLATES 0)
option(USE_UDF "Use UDF?" off)
option(USE_OPENMP "Use OpenMP?" off)
option(USE_OPENMP "Use OpenMP?" on)
option(USE_PROJ4 "Use Proj4?" off)
option(USE_WMO_VALIDATION "Use WMO Validation?" off)
option(DISABLE_TIMEZONE "Disable posix Timezone?" off)
Expand All @@ -23,7 +23,8 @@ option(USE_PNG "Use PNG?" off)
option(USE_JASPER "Use Jasper?" off)
option(USE_OPENJPEG "Use OpenJPEG?" off)
option(USE_AEC "Use AEC?" off)
option(MAKE_FTN_API "add ftn api?" on)
# MAKE_FTN_API should only be on when building library
option(MAKE_FTN_API "add ftn api?" off)
option(DISABLE_STAT "disable posix feature" off)
set(BUILD_COMMENTS "stock build")

Expand Down Expand Up @@ -104,13 +105,17 @@ if(USE_OPENMP)
# endif()
endif()




if(USE_PNG)
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
endif()


# write config.h
FILE(WRITE "wgrib2/config.h" "/* config.h generated by cmake */\n")
FILE(APPEND "wgrib2/config.h" "#ifndef _CONFIG_H\n")
FILE(APPEND "wgrib2/config.h" "#define _CONFIG_H\n")

FOREACH(var IN ITEMS USE_NETCDF3 USE_NETCDF4 USE_HDF5 USE_REGEX USE_TIGGE USE_MYSQL
USE_IPOLATES USE_UDF USE_OPENMP USE_PROJ4 USE_WMO_VALIDATION DISABLE_TIMEZONE
DISABLE_ALARM USE_NAMES USE_G2CLIB USE_PNG USE_JASPER USE_OPENJPEG MAKE_FTN_API USE_AEC BUILD_COMMENTS)
Expand All @@ -134,6 +139,7 @@ FILE(APPEND "wgrib2/config.h" "#define FFLAGS \"${CMAKE_Fortran_FLAGS}\"\n")



FILE(APPEND "wgrib2/config.h" "#endif\n")



Expand All @@ -144,7 +150,6 @@ add_subdirectory(aux_progs)


if(BUILD_LIB)
add_subdirectory(ftn_api)

### Package config
include(CMakePackageConfigHelpers)
Expand Down
2 changes: 1 addition & 1 deletion ip2lib_d/config.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define USE_SPECTRAL 1
! config.h
11 changes: 5 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,8 @@ else
endif

# gctpc library
gctpcdir:=${cwd}/gctpc
gctpcsrc:=gctpc20a.tgz
gctpcdir:=${cwd}/wgrib2/gctpc
#gctpcsrc:=gctpc20a.tgz
gctpclib:=${lib}/libgeo.a
wLDFLAGS+=-lgeo
# wCPPFLAGS+=-I${gctpc}/source
Expand Down Expand Up @@ -1031,10 +1031,10 @@ ${gctpcdir}/source/makefile.gctpc:
rm tmpgctpc.tar
cp makefile.gctpc proj.h cproj.c sominv.c somfor.c ${gctpcdir}/source/

${gctpclib}: ${gctpcdir}/source/makefile.gctpc
cd "${gctpcdir}/source" && export CPPFLAGS="${wCPPFLAGS}" && ${MAKE} -f makefile.gctpc
${gctpclib}:
cd ${gctpcdir}/source && export CPPFLAGS="${wCPPFLAGS}" && ${MAKE} -f makefile.gctpc
cp ${gctpcdir}/source/libgeo.a ${lib}
cp ${gctpcdir}/source/proj.h ${cwd}/include/
cp ${gctpcdir}/source/include/proj.h ${cwd}/include/

${proj4lib}:
cp ${proj4src} tmpproj4.tar.gz
Expand Down Expand Up @@ -1122,7 +1122,6 @@ clean:
cd ${cwd}/aux_progs && ${MAKE} clean -f smallest_4.make

deep-clean:
[ -f ${gctpcdir}/source/makefile.gctpc ] && rm -r ${gctpcdir} || true
[ -f ${zdir}/Makefile ] && rm -r ${zdir} || true
[ -f ${pngdir}/Makefile ] && rm -r ${pngdir} || true
[ -f ${jasperdir}/Makefile ] && rm -r ${jasperdir} || true
Expand Down
6 changes: 5 additions & 1 deletion wgrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ Wrt_grib.c
wrtieee.c
wxtext.c
)
if(MAKE_FTN_API)
list(APPEND lib_src
ftn_api/fort_wgrib2.c ftn_api/wgrib2api.f90 ftn_api/wgrib2lowapi.f90 )
endif()

add_subdirectory(gctpc)
# make this an object lib so we can re-use most of object files
Expand All @@ -248,7 +252,7 @@ if(BUILD_LIB)

# library and executable have same name (wgrib2) but different target names
set_target_properties(wgrib2_lib PROPERTIES OUTPUT_NAME wgrib2)
target_compile_definitions(wgrib2_lib PRIVATE CALLABLE_WGRIB2 USE_REGEX)
target_compile_definitions(wgrib2_lib PRIVATE CALLABLE_WGRIB2)
endif()


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions wgrib2/gctpc/README.changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Changes added to gctpc after retrieving gctpc from USGS

cproj.c somfor.c sominv.c proj.h
2/2024 br_gctp.c
4 changes: 3 additions & 1 deletion wgrib2/gctpc/source/br_gctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ double *outparm;
long *outunit;
long *outspheroid;
long *iflg;

/* 2/2024 Wesley Ebisuzaki added 2 lines */
char *fn27;
char *fn83;
{
gctp(incoor,insys,inzone,inparm,inunit,inspheroid,ipr,efile,jpr,pfile,outcoor,
outsys,outzone,outparm,outunit,outspheroid,fn27,fn83,iflg);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion wgrib2/gctpc/source/makefile.gctpc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ objs=gctp.o alberfor.o alberinv.o alconfor.o alconinv.o azimfor.o aziminv.o eqco


.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) ${DEFS} $<
$(CC) -c $(CPPFLAGS) $(CFLAGS) ${DEFS} -Iinclude $<

$(LIB): $(objs)
ar $(ARFLAGS) ${LIB} $(objs)
Expand Down

0 comments on commit 6a612c1

Please sign in to comment.