Skip to content

Commit 2b1fc5a

Browse files
committed
Add windows CI and build script
1 parent 853eab7 commit 2b1fc5a

File tree

6 files changed

+369
-25
lines changed

6 files changed

+369
-25
lines changed

.github/workflows/main.yml

Lines changed: 100 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ jobs:
121121
working-directory: ${{ github.workspace }}
122122

123123
- name: Start HSDS
124-
if: ${{ matrix.endpoint != 'http://127.0.0.1:5101'}}
125124
run: |
126125
cd ${{github.workspace}}/hsds
127126
mkdir ${{github.workspace}}/hsdsdata &&
@@ -135,7 +134,6 @@ jobs:
135134
working-directory: ${{github.workspace}}/hsds
136135

137136
- name: Test HSDS
138-
if: ${{matrix.endpoint != 'http://127.0.0.1:5101'}}
139137
run: |
140138
python tests/integ/setup_test.py
141139
working-directory: ${{github.workspace}}/hsds
@@ -181,7 +179,7 @@ jobs:
181179
-DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_SZIP_SUPPORT=OFF \
182180
-DHDF5_TEST_API=ON \
183181
-DHDF5_ENABLE_Z_LIB_SUPPORT=OFF \
184-
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DHDF5_ENABLE_THREADSAFE=OFF \
182+
-DCMAKE_BUILD_TYPE=Release -DHDF5_ENABLE_THREADSAFE=OFF \
185183
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/hdf5install \
186184
..
187185
make
@@ -194,7 +192,7 @@ jobs:
194192
mkdir ./build
195193
cd ./build
196194
CFLAGS="-D_POSIX_C_SOURCE=200809L" cmake -G "Unix Makefiles" -DHDF5_ROOT=${{github.workspace}}/hdf5install \
197-
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install \
195+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install -DCMAKE_BUILD_TYPE=Release \
198196
..
199197
shell: bash
200198
working-directory: ${{github.workspace}}/vol-rest
@@ -242,7 +240,6 @@ jobs:
242240
working-directory: ${{ github.workspace }}
243241

244242
- name: Start HSDS
245-
if: ${{ matrix.endpoint != 'http://127.0.0.1:5101'}}
246243
run: |
247244
cd ${{github.workspace}}/hsds
248245
mkdir ${{github.workspace}}/hsdsdata &&
@@ -256,7 +253,6 @@ jobs:
256253
working-directory: ${{github.workspace}}/hsds
257254

258255
- name: Test HSDS
259-
if: ${{matrix.endpoint != 'http://127.0.0.1:5101'}}
260256
run: |
261257
python tests/integ/setup_test.py
262258
working-directory: ${{github.workspace}}/hsds
@@ -276,3 +272,101 @@ jobs:
276272
# run: |
277273
# valgrind --leak-check=full -s ctest -R "vol-rest" -VV
278274
# working-directory: ${{github.workspace}}/hdf5/build/
275+
276+
build_and_test_windows:
277+
strategy:
278+
fail-fast: false
279+
matrix:
280+
os: [windows-latest]
281+
python-version: ["3.10"]
282+
hdf5-branch: ["hdf5_1_14", "develop"]
283+
284+
runs-on: ${{matrix.os}}
285+
steps:
286+
- name: Get HDF5
287+
uses: actions/checkout@v4
288+
with:
289+
repository: HDFGroup/hdf5
290+
ref: ${{matrix.hdf5-branch}}
291+
path: ${{github.workspace}}/hdf5
292+
293+
- name: Get REST VOL
294+
uses: actions/checkout@v3
295+
with:
296+
path: ${{github.workspace}}/vol-rest
297+
298+
- name: Get curl from source
299+
uses: actions/checkout@v4
300+
with:
301+
repository: curl/curl
302+
path: ${{github.workspace}}/curl
303+
304+
- name: Install curl
305+
working-directory: ${{github.workspace}}/curl
306+
run: |
307+
mkdir build
308+
mkdir install
309+
cd build
310+
cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/curl/install `
311+
-DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=ON `
312+
-DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="/DCURL_STATICLIB" `
313+
-DCURL_STATIC_CRT=ON -DBUILD_STATIC_CURL=ON ..
314+
cmake --build . --config Release
315+
cmake --install . --config Release
316+
317+
- name: Get yajl from source
318+
uses: actions/checkout@v4
319+
with:
320+
repository: lloyd/yajl
321+
path: ${{github.workspace}}/yajl
322+
323+
- name: Install yajl
324+
working-directory: ${{github.workspace}}/yajl
325+
run: |
326+
mkdir build
327+
mkdir install
328+
cd build
329+
cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/yajl/install `
330+
-DCMAKE_BUILD_TYPE=Release ..
331+
cmake --build . --config Release
332+
cmake --install . --config Release
333+
334+
- name: CMake Configure + Build HDF5
335+
run: |
336+
mkdir build
337+
cd build
338+
cmake `
339+
-DHDF5_BUILD_HL_LIB=ON `
340+
-DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_SZIP_SUPPORT=OFF `
341+
-DHDF5_TEST_API=ON `
342+
-DHDF5_ENABLE_Z_LIB_SUPPORT=OFF `
343+
-DCMAKE_BUILD_TYPE=Release -DHDF5_ENABLE_THREADSAFE=OFF `
344+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/hdf5install `
345+
..
346+
cmake --build . -j --config Release
347+
cmake --install . --config Release
348+
working-directory: ${{github.workspace}}/hdf5
349+
350+
- name: CMake Configure + Build REST VOL
351+
working-directory: ${{github.workspace}}/vol-rest
352+
run: |
353+
mkdir build
354+
cd build
355+
cmake -DHDF5_ROOT=${{github.workspace}}/hdf5install `
356+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install `
357+
-DCURL_ROOT=${{github.workspace}}/curl/install/ -DCMAKE_C_FLAGS="/DCURL_STATICLIB" `
358+
-DCURL_USE_STATIC_LIBRARIES=ON `
359+
-DYAJL_ROOT=${{github.workspace}}/yajl/install/ `
360+
-DCMAKE_BUILD_TYPE=Release ..
361+
cmake --build . -j --config Release
362+
cmake --install . --config Release
363+
364+
- name: Set HDF5 Plugin path
365+
run: |
366+
echo "HDF5_PLUGIN_PATH=${{github.workspace}}/vol-rest/build/bin/" >> $GITHUB_ENV
367+
echo "HDF5_VOL_CONNECTOR=REST" >> $GITHUB_ENV
368+
369+
- name: Test REST VOL
370+
working-directory: ${{github.workspace}}/vol-rest/install/bin/
371+
run: |
372+
test_rest_vol-shared.exe

CMakeLists.txt

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ set (HDF5_VOL_REST_LIBSH_TARGET "${HDF5_VOL_REST_LIB_CORENAME}-shared")
8787
set (HDF5_VOL_REST_TEST_LIB_TARGET "${HDF5_VOL_REST_TEST_LIB_CORENAME}-static")
8888
set (HDF5_VOL_REST_TEST_LIBSH_TARGET "${HDF5_VOL_REST_TEST_LIB_CORENAME}-shared")
8989

90-
9190
#-----------------------------------------------------------------------------
9291
# Define some CMake variables for use later in the project
9392
#-----------------------------------------------------------------------------
@@ -118,19 +117,29 @@ if (HDF5_ENABLE_THREADSAFE AND NOT Threads_FOUND)
118117
find_package(Threads)
119118
endif ()
120119

120+
set (CURL_TARGET_LIBTYPE shared)
121+
122+
121123
find_package (CURL 7.61 REQUIRED)
122124
if (CURL_FOUND)
125+
# FindCURL module is not always found on windows; set paths manually
126+
if (WIN32)
127+
set (CURL_INCLUDE_DIRS "${CURL_ROOT}\\include")
128+
set (LINK_LIBS ${LINK_LIBS} Ws2_32.lib Wldap32.lib)
129+
130+
if (CURL_USE_STATIC_LIBRARIES)
131+
set (CURL_LIBRARIES "${CURL_ROOT}\\lib\\libcurl.lib")
132+
else ()
133+
set (CURL_LIBRARIES "${CURL_ROOT}\\bin\\libcurl.dll")
134+
endif()
135+
endif()
136+
123137
include_directories(${CURL_INCLUDE_DIRS})
124-
set (LINK_LIBS ${LINK_LIBS} CURL::libcurl)
125-
set_target_properties(CURL::libcurl PROPERTIES
126-
IMPORTED_LOCATION ${CURL_ROOT}/lib/libcurl.lib)
138+
set (LINK_LIBS ${LINK_LIBS} ${CURL_LIBRARIES})
127139
else ()
128-
message (FATAL_ERROR "cURL not found; please check CURL_INCLUDE_DIR")
140+
message (FATAL_ERROR "cURL not found; please check CURL_ROOT")
129141
endif ()
130142

131-
if (WIN32)
132-
set (LINK_LIBS ${LINK_LIBS} Ws2_32.lib)
133-
endif ()
134143
# Include custom module for finding YAJL
135144
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${HDF5_VOL_REST_RESOURCES_MOD_DIR}")
136145

@@ -369,6 +378,10 @@ if (NOT BUILD_SHARED_LIBS)
369378
endif ()
370379
if (BUILD_SHARED_LIBS)
371380
set (HDF5_VOL_REST_LIBRARIES_TO_EXPORT ${HDF5_VOL_REST_LIBRARIES_TO_EXPORT} ${HDF5_VOL_REST_LIBSH_TARGET} CACHE INTERNAL "Store which libraries should be exported" FORCE)
381+
# Value is not automatically inherited from cache on Windows
382+
if (WIN32)
383+
set (HDF5_VOL_REST_LIBRARIES_TO_EXPORT ${HDF5_VOL_REST_LIBRARIES_TO_EXPORT} ${HDF5_VOL_REST_LIBSH_TARGET})
384+
endif()
372385
endif ()
373386

374387
option (BUILD_STATIC_LIBS "Build Static Libraries" OFF)
@@ -377,6 +390,10 @@ if (BUILD_STATIC_LIBS)
377390
set (HDF5_VOL_REST_ENABLE_STATIC_LIB YES)
378391
set (LINK_STATIC_LIBS ${LINK_LIBS})
379392
set (HDF5_VOL_REST_LIBRARIES_TO_EXPORT ${HDF5_VOL_REST_LIBRARIES_TO_EXPORT} ${HDF5_VOL_REST_LIB_TARGET} CACHE INTERNAL "Store which libraries should be exported" FORCE)
393+
# Value is not automatically inherited from cache on Windows
394+
if (WIN32)
395+
set (HDF5_VOL_REST_LIBRARIES_TO_EXPORT ${HDF5_VOL_REST_LIBRARIES_TO_EXPORT} ${HDF5_VOL_REST_LIB_TARGET})
396+
endif()
380397
endif ()
381398

382399
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ and can directly be obtained from:
9696

9797
`git clone https://github.com/HDFGroup/vol-rest`
9898

99-
For building with the 1.12 or later version of the HDF5 library, use the hdf5_1_12_update branch of this repository.
100-
10199
A source distribution of the HDF5 library has been included in the REST VOL connector
102100
source in the `/src/hdf5` directory.
103101

@@ -141,9 +139,6 @@ The following configuration options are available to all of the build scripts:
141139
mostly useful in helping to diagnose any possible memory leaks or other
142140
memory errors within the connector.
143141

144-
-g Enables symbolic debugging of the REST VOL code. (Only available for
145-
`build_vol_autotools.sh`)
146-
147142
-P DIR Specifies where the REST VOL connector should be installed. The default
148143
installation prefix is `rest_vol_build` inside the REST VOL connector source
149144
root directory.
@@ -158,7 +153,15 @@ The following configuration options are available to all of the build scripts:
158153
-Y DIR Specifies the top-level directory where YAJL is installed. Used if YAJL is
159154
not installed to a system path or used to override
160155

161-
Additionally, the CMake build scripts have the following configuration options:
156+
The following configuration options are specific to `build_vol_autotools.sh`:
157+
158+
-g Enables symbolic debugging of the REST VOL code.
159+
160+
The following configuration options are specific to the CMake build scripts:
161+
162+
-u Specifies that a static cURL library should be used as a dependency.
163+
164+
-t Specifies that a static YAJL library should be used as a dependency.
162165

163166
-B DIR Specifies the directory that CMake should use as the build tree location.
164167
The default build tree location is `rest_vol_cmake_build_files` inside the
@@ -291,7 +294,8 @@ components mentioned previously cannot be found within the system path.
291294
* `HDF5_VOL_REST_ENABLE_MEM_TRACKING` - Enables/Disables memory tracking within the REST VOL connector. This option is mostly useful in helping to diagnose any possible memory leaks or other memory errors within the connector. The default value is `OFF`.
292295
* `HDF5_VOL_REST_THREAD_SAFE` - Enables/Disables linking to HDF5 statically compiled with thread safe option. The default value is `OFF`.
293296
* `YAJL_USE_STATIC_LIBRARIES` - Indicate if the static YAJL libraries should be used for linking. The default value is `OFF`.
294-
297+
* `CURL_USE_STATIC_LIBRARIES` - Indicate if the static CURL libraries should be used for linking. The default value is `OFF`.
298+
295299
Note, when setting BUILD_SHARED_LIBS=ON and YAJL_USE_STATIC_LIBRARIES=ON, the static YAJL libraries have be build with the position independent code (PIC) option enabled. In the static YAJL build,
296300
this PIC option has been turned off by default.
297301

@@ -301,7 +305,7 @@ It is also possible to build the REST VOL as part of the build process for the H
301305

302306
### II.B.v. Build Results
303307

304-
If the build is successful, the following files will be written into the installation directory:
308+
If the build is successful, the following files will be written into the installation directory on a Linux or OSX machine:
305309

306310
```
307311
bin/
@@ -327,6 +331,8 @@ share/
327331
hdf5_vol_rest-targets-<build mode>.cmake
328332
```
329333

334+
On a Windows system, the installation directory will have a few differences. If shared libraries are built, the resulting `hdf5_vol_rest.dll` will be found in the `bin` directory. If tests are enabled, `test_rest_vol(-shared).exe` will also be in the `bin` directory. If static libraries are built, `lib` will contain `libhdf5_vol_rest.lib`.
335+
330336
If the REST VOL connector was built using one of the included build scripts, all of the usual files
331337
from an HDF5 source build should appear in the respective `bin`, `include`, `lib` and `share`
332338
directories in the install directory. Notable among these is `bin/h5cc`, a special-purpose compiler wrapper script that streamlines the process of building HDF5 applications.

0 commit comments

Comments
 (0)