Skip to content

Commit 7830186

Browse files
GillesDuvertGiloo
andauthored
WIP adding the DLM (and LINKIMAGE) functionality. (#2043)
Co-authored-by: Giloo <gildas@localhost>
1 parent 7513ce1 commit 7830186

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+8489
-5020
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ jobs:
239239
run: |
240240
pacman -Q | tr ' ' '-' | sort > ~/snapshot1.txt
241241
scripts/build_gdl.sh prep
242-
ls MINGW-packages/mingw-w64-graphicsmagick/
243-
mv MINGW-packages/mingw-w64-graphicsmagick/mingw-w64-*-graphicsmagick-*.tar.* /var/cache/pacman/pkg
244242
pacman -Q | tr ' ' '-' | sort > ~/snapshot2.txt
245243
echo "Setting up cache..."
246244
mkdir -p /cache

CMakeLists.txt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,8 @@ check_include_file(strings.h HAVE_STRINGS_H)
197197
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
198198
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
199199
check_include_file(unistd.h HAVE_UNISTD_H)
200-
#check_include_file(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H)
201-
#sometimes it compiles but stdio_filebuf is only in gcc-x-y-z directory tree...
202-
# would be silly not to use this functionality if present, so recheck:
203-
if (HAVE_EXT_STDIO_FILEBUF_H)
204-
else (HAVE_EXT_STDIO_FILEBUF_H)
205-
check_cxx_source_compiles("
206-
#include <ext/stdio_filebuf.h>
207-
int main(int argc, char **argv) {
208-
int i=0;
209-
i+=1;
210-
}" REALLY_HAVE_EXT_STDIO_FILEBUF_H)
211-
endif (HAVE_EXT_STDIO_FILEBUF_H)
212-
if (REALLY_HAVE_EXT_STDIO_FILEBUF_H)
213-
message(STATUS "INFO: will use GNU extensions for STDIO (useful for compressed I/O) since it seems accepted by your c++ compiler.")
214-
set (HAVE_EXT_STDIO_FILEBUF_H 1)
215-
endif (REALLY_HAVE_EXT_STDIO_FILEBUF_H)
200+
#need to use check_include_file_cxx since this is a C++ only header!!!
201+
check_include_file_cxx(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H)
216202
# dlfcn.h
217203
check_include_file(dlfcn.h HAVE_DLFCN_H)
218204

CMakeModules/FindXdr.cmake

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
#
2-
# copyright : (c) 2012 Jeongbin Park
3-
#
4-
# 2012/Sep/18 Jeongbin Park added this file; to support Windows platform.
5-
#
6-
# This program is free software; you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation; either version 2 of the License, or
9-
# (at your option) any later version.
10-
#
11-
if(XDRDIR)
12-
set(CMAKE_PREFIX_PATH $XDRDIR)
13-
endif(XDRDIR)
14-
find_library(XDR_LIBRARY NAMES bsdxdr xdr)
15-
set(XDR_LIBRARIES ${XDR_LIBRARY})
16-
find_path(XDR_INCLUDE_DIR NAMES rpc/xdr.h)
17-
18-
unset( CMAKE_PREFIX_PATH)
19-
20-
include(FindPackageHandleStandardArgs)
21-
find_package_handle_standard_args(Xdr DEFAULT_MSG XDR_LIBRARIES XDR_INCLUDE_DIR)
22-
23-
mark_as_advanced(
24-
XDR_LIBRARY
25-
XDR_LIBRARIES
26-
XDR_INCLUDE_DIR
27-
)
1+
#
2+
# copyright : (c) 2012 Jeongbin Park
3+
#
4+
# 2012/Sep/18 Jeongbin Park added this file; to support Windows platform.
5+
#
6+
# This program is free software; you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation; either version 2 of the License, or
9+
# (at your option) any later version.
10+
#
11+
if(XDRDIR)
12+
set(CMAKE_PREFIX_PATH $XDRDIR)
13+
endif(XDRDIR)
14+
find_library(XDR_LIBRARY NAMES bsdxdr xdr)
15+
set(XDR_LIBRARIES ${XDR_LIBRARY})
16+
find_path(XDR_INCLUDE_DIR NAMES rpc/xdr.h)
17+
18+
unset( CMAKE_PREFIX_PATH)
19+
20+
include(FindPackageHandleStandardArgs)
21+
find_package_handle_standard_args(Xdr DEFAULT_MSG XDR_LIBRARIES XDR_INCLUDE_DIR)
22+
23+
mark_as_advanced(
24+
XDR_LIBRARY
25+
XDR_LIBRARIES
26+
XDR_INCLUDE_DIR
27+
)

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#define EXEC_PREFIX "@CMAKE_INSTALL_PREFIX@"
55
#define GDLDATADIR "@CMAKE_INSTALL_PREFIX@@GDL_DATA_DIR@"
6-
#define GDLLIBDIR "@GDL_LIB_DIR@"
76

87
#define _CRT_SECURE_NO_WARNINGS
98

scripts/build_gdl.sh

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,12 @@ function log { # log is needded just below!
8888
if [ ${BUILD_OS} == "Windows" ]; then
8989
BSDXDR_URL="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bsd-xdr/bsd-xdr-1.0.0.tar.gz"
9090
MSYS2_PACKAGES=(
91-
readline zlib libpng gsl wxWidgets libgd libtiff libgeotiff netcdf hdf4 hdf5 fftw proj msmpi udunits
92-
eigen3 eccodes glpk shapelib expat openssl qhull
91+
readline zlib libpng gsl wxwidgets3.2 libgd libtiff libgeotiff netcdf hdf4 hdf5 fftw proj msmpi udunits
92+
eigen3 eccodes glpk shapelib expat openssl qhull graphicsmagick
9393
)
94-
# GD: dunno why graphicsmagick has this special treatment????
9594
#if you add something in MSYS2_PACKAGES_REBUILD you may have to add special lines in main.yml to push the product in /var/cache/pacman/pkg
9695
MSYS2_PACKAGES_REBUILD=(
97-
graphicsmagick
96+
9897
)
9998
elif [ ${BUILD_OS} == "Linux" ]; then
10099
# JP: Note the seperator ',' between the package name candidates below. The leftmost one has the highest priority.
@@ -311,24 +310,17 @@ function prep_packages {
311310
eval "pacman --noconfirm --needed -S ${msys2_packages}"
312311
fi
313312

314-
for package_name in ${MSYS2_PACKAGES_REBUILD[@]}; do
315-
build_msys2_package $package_name
316-
done
313+
# for package_name in ${MSYS2_PACKAGES_REBUILD[@]}; do
314+
# build_msys2_package $package_name
315+
# done
317316

318-
# pushd ${ROOT_DIR}
319-
# download_file "https://github.com/qhull/qhull/archive/refs/tags/2020.2.zip"
320-
# decompress_file
321-
# log "Building qhull..."
322-
# pushd qhull-2020.2
323-
# make SO=dll || exit 1
324-
# popd
325-
# popd
326-
327317
download_file ${BSDXDR_URL}
328318
decompress_file
329319

330320
log "Building bsd-xdr..."
331321
pushd bsd-xdr-1.0.0
322+
# need a patch now with a new version of the mingw compiler... (GD)
323+
patch lib/xdr_rec.c ${GDL_DIR}/scripts/deps/windows/mingw-patches/bsdxdr_rec.patch
332324
sed -e 's/-Wall/-Wall -Wno-pointer-to-int-cast #/' -e 's/$(XDR_LIBRARIES) $(TEST_PROGS)/$(XDR_LIBRARIES)/' -e 's/libxdr/libbsdxdr/' -i Makefile
333325
mv lib/libxdr.def.in lib/libbsdxdr.def.in
334326
make || exit 1
@@ -359,15 +351,6 @@ function prep_packages {
359351
done
360352
done
361353

362-
# pushd ${ROOT_DIR}
363-
# download_file "https://github.com/qhull/qhull/archive/refs/tags/2020.2.zip"
364-
# decompress_file
365-
# log "Building qhull..."
366-
# pushd qhull-2020.2
367-
# make || exit 1
368-
# popd
369-
# popd
370-
371354
if [[ -z ${INSTALL_PACKAGES} ]]; then
372355
log "All required packages are already installed on your system."
373356
else
@@ -438,6 +421,9 @@ function configure_gdl {
438421
"-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++"
439422
"-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang" )
440423
else
424+
#patch to be tested: should avoid the error "tried including <stddef.h> but didn't find libc++'s <stddef.h> header."
425+
sudo xcode-select -s /Library/Developer/CommandLineTools
426+
#end patch
441427
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/llvm/lib
442428
CMAKE_ADDITIONAL_ARGS=( "-DMPI=OFF -DREADLINEDIR=/usr/local/opt/readline"
443429
"-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- /home/gildas/Downloads/bsd-xdr-1.0.0/lib/xdr_rec.c 2009-05-23 07:30:51.000000000 +0200
2+
+++ bsd-xdr-1.0.0/lib/xdr_rec.c 2025-07-12 23:09:18.543660836 +0200
3+
@@ -69,8 +69,6 @@
4+
XPRT_IDLE
5+
};
6+
7+
-static u_int fix_buf_size ();
8+
-
9+
static bool_t xdrrec_getlong (XDR *, long *);
10+
static bool_t xdrrec_putlong (XDR *, const long *);
11+
static bool_t xdrrec_getbytes (XDR *, char *, u_int);

src/CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ getfmtast.cpp
9292
graphicsdevice.cpp
9393
basic_pro.cpp
9494
basic_pro_jmg.cpp
95-
brent.cpp
95+
# brent.cpp #as DLM test
9696
grib.cpp
9797
gsl_fun.cpp
9898
gsl_matrix.cpp
@@ -219,6 +219,7 @@ set_source_files_properties(libinit_cl.cpp PROPERTIES COMPILE_FLAGS -Wno-depreca
219219
add_library(whereami STATIC ${CMAKE_SOURCE_DIR}/src/whereami/src/whereami.c)
220220
add_subdirectory(antlr)
221221
add_subdirectory(plplot)
222+
add_subdirectory(dlm)
222223

223224
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/antlr ${CMAKE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/src/whereami/src ${CMAKE_BINARY_DIR})
224225
link_directories(${LINK_DIRECTORIES})
@@ -276,6 +277,17 @@ else(PYTHON_MODULE)
276277
set_target_properties(gdl PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
277278
endif(PYTHON_MODULE)
278279

280+
#permit gdl.exe to export its symbols, necessary for linkimage and DLM
281+
if (NOT APPLE AND NOT OSX AND NOT MINGW)
282+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-dynamic")
283+
endif()
284+
if (APPLE OR OSX )
285+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fvisibility=protected") #-exported_symbols_list ${EXPORTED_SYMBOLS_LIST}")
286+
endif()
287+
if (MINGW )
288+
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")
289+
endif()
290+
279291
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/pro/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${GDL_DATA_DIR}/lib
280292
PATTERN CVS EXCLUDE
281293
PATTERN checks EXCLUDE
@@ -288,6 +300,8 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/resource DESTINATION ${CMAKE_INSTALL_PREFI
288300
PATTERN Makefile* EXCLUDE
289301
PATTERN UrgentNeed.txt EXCLUDE)
290302

303+
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_PREFIX}/${GDL_DATA_DIR}/dlm )
304+
291305
configure_file(
292306
${CMAKE_SOURCE_DIR}/scripts/quick_start_GDL.sh.in
293307
${CMAKE_BINARY_DIR}/quick_start_GDL.sh

0 commit comments

Comments
 (0)