Skip to content

Commit 97fec4c

Browse files
authored
Add Windows CI and build script (#127)
* Use gettimeofday if clock_gettime not defined * Test REST VOL in Windows workflow * Bump CMake min to 3.12, remove max * Remove manual root dir creation Since HDFGroup/hsds#357, the 'data' directory already exists. * Implement RV_strtok_r
1 parent 82f89c3 commit 97fec4c

File tree

16 files changed

+525
-49
lines changed

16 files changed

+525
-49
lines changed

.github/workflows/main.yml

Lines changed: 143 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ env:
2020
HSDS_USERNAME: test_user1
2121
HSDS_PASSWORD: test
2222
HSDS_PATH: /home/test_user1/
23-
HDF5_API_TEST_PATH_PREFIX: /home/test_user1/
2423
HSDS_ENDPOINT: http+unix://%2Ftmp%2Fhs%2Fsn_1.sock
24+
HDF5_API_TEST_PATH_PREFIX: /home/test_user1/
2525
HDF5_VOL_CONNECTOR: REST
2626
ROOT_DIR: ${{github.workspace}}/hsdsdata
2727
BUCKET_NAME: hsdstest
@@ -178,7 +178,7 @@ jobs:
178178
ROOT_DIR=${{github.workspace}}/hsdadata ./runall.sh --no-docker 1 &
179179
sleep 10
180180
working-directory: ${{github.workspace}}/hsds
181-
181+
182182
- name: Test HSDS
183183
run: |
184184
python tests/integ/setup_test.py
@@ -211,3 +211,144 @@ jobs:
211211
# run: |
212212
# ctest -R "vol-rest" -VV
213213
# working-directory: ${{github.workspace}}/hdf5/build/
214+
215+
build_and_test_windows:
216+
strategy:
217+
fail-fast: false
218+
matrix:
219+
os: [windows-latest]
220+
python-version: ["3.10"]
221+
hdf5-branch: ["hdf5_1_14", "develop"]
222+
env:
223+
HSDS_ENDPOINT: http://127.0.0.1:5101
224+
runs-on: ${{matrix.os}}
225+
steps:
226+
- name: Get HDF5
227+
uses: actions/checkout@v4
228+
with:
229+
repository: HDFGroup/hdf5
230+
ref: ${{matrix.hdf5-branch}}
231+
path: ${{github.workspace}}/hdf5
232+
233+
- name: Get REST VOL
234+
uses: actions/checkout@v3
235+
with:
236+
path: ${{github.workspace}}/vol-rest
237+
238+
- name: Get HSDS
239+
uses: actions/checkout@v3
240+
with:
241+
repository: HDFGroup/hsds
242+
path: ${{github.workspace}}/hsds
243+
244+
- name: Set up Python ${{ matrix.python-version }}
245+
uses: actions/setup-python@v5
246+
with:
247+
python-version: ${{ matrix.python-version }}
248+
249+
- name: Install HSDS dependencies
250+
working-directory: ${{github.workspace}}/hsds
251+
shell: bash
252+
run: |
253+
python -m pip install --upgrade pip
254+
python -m pip install pytest
255+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
256+
257+
- name: Install HSDS package
258+
working-directory: ${{github.workspace}}/hsds
259+
shell: bash
260+
run: |
261+
pip install -e .
262+
263+
- name: Start HSDS
264+
shell: bash
265+
working-directory: ${{github.workspace}}/hsds
266+
run: |
267+
cp admin/config/groups.default admin/config/groups.txt
268+
cp admin/config/passwd.default admin/config/passwd.txt
269+
hsds --root_dir data --host localhost --port 5101 --password_file admin/config/passwd.txt --logfile hs.log --loglevel DEBUG --config_dir=admin/config --count=4 &
270+
sleep 10
271+
272+
- name: Test HSDS + Setup Folders
273+
run: |
274+
python tests/integ/setup_test.py
275+
working-directory: ${{github.workspace}}/hsds
276+
277+
- name: Get curl from source
278+
uses: actions/checkout@v4
279+
with:
280+
repository: curl/curl
281+
path: ${{github.workspace}}/curl
282+
283+
- name: Install curl
284+
working-directory: ${{github.workspace}}/curl
285+
run: |
286+
mkdir build
287+
mkdir install
288+
cd build
289+
cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/curl/install `
290+
-DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=ON `
291+
-DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="/DCURL_STATICLIB" `
292+
-DCURL_STATIC_CRT=ON -DBUILD_STATIC_CURL=ON `
293+
-DCURL_USE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF ..
294+
cmake --build . --config Release
295+
cmake --install . --config Release
296+
297+
- name: Get yajl from source
298+
uses: actions/checkout@v4
299+
with:
300+
repository: lloyd/yajl
301+
path: ${{github.workspace}}/yajl
302+
303+
- name: Install yajl
304+
working-directory: ${{github.workspace}}/yajl
305+
run: |
306+
mkdir build
307+
mkdir install
308+
cd build
309+
cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/yajl/install `
310+
-DCMAKE_BUILD_TYPE=Release ..
311+
cmake --build . --config Release
312+
cmake --install . --config Release
313+
314+
- name: CMake Configure + Build HDF5
315+
run: |
316+
mkdir build
317+
cd build
318+
cmake `
319+
-DHDF5_BUILD_HL_LIB=ON `
320+
-DBUILD_SHARED_LIBS=ON -DHDF5_ENABLE_SZIP_SUPPORT=OFF `
321+
-DHDF5_TEST_API=ON `
322+
-DHDF5_ENABLE_Z_LIB_SUPPORT=OFF `
323+
-DCMAKE_BUILD_TYPE=Release -DHDF5_ENABLE_THREADSAFE=OFF `
324+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/hdf5install `
325+
..
326+
cmake --build . -j --config Release
327+
cmake --install . --config Release
328+
working-directory: ${{github.workspace}}/hdf5
329+
330+
- name: CMake Configure + Build REST VOL
331+
working-directory: ${{github.workspace}}/vol-rest
332+
run: |
333+
mkdir build
334+
cd build
335+
cmake -DHDF5_ROOT=${{github.workspace}}/hdf5install `
336+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/vol-rest/install `
337+
-DCURL_ROOT=${{github.workspace}}/curl/install/ -DCMAKE_C_FLAGS="/DCURL_STATICLIB" `
338+
-DCURL_USE_STATIC_LIBS=ON `
339+
-DYAJL_ROOT=${{github.workspace}}/yajl/install/ `
340+
-DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON `
341+
-DCMAKE_BUILD_TYPE=Release ..
342+
cmake --build . -j --config Release
343+
cmake --install . --config Release
344+
345+
- name: Test REST VOL
346+
working-directory: ${{github.workspace}}\vol-rest\build
347+
env:
348+
HDF5_PLUGIN_PATH: ${{github.workspace}}\vol-rest\install\bin
349+
# Manually append lib to PATH here, since env can change between steps on the runner
350+
run: |
351+
$env:PATH="$env:PATH;${{github.workspace}}\vol-rest\install\bin;${{github.workspace}}\hdf5install\bin;${{github.workspace}}\yajl\install\lib"
352+
ctest . -C Release -VV --output-on-failure
353+
354+

CMake/FindYAJL.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ if (YAJL_FOUND)
4747
endif ()
4848
set_target_properties(yajl-shared PROPERTIES
4949
IMPORTED_LOCATION "${YAJL_SHARED_LIBRARY}"
50+
IMPORTED_IMPLIB "${YAJL_SHARED_LIBRARY}"
5051
INTERFACE_INCLUDE_DIRECTORIES "${YAJL_INCLUDE_DIR}"
5152
)
5253
set_target_properties(yajl-static PROPERTIES
5354
IMPORTED_LOCATION "${YAJL_STATIC_LIBRARY}"
55+
IMPORTED_IMPLIB "${YAJL_STATIC_LIBRARY}"
5456
INTERFACE_INCLUDE_DIRECTORIES "${YAJL_INCLUDE_DIR}"
5557
)
5658

CMakeLists.txt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# CMake Build Script for the HDF5 REST VOL connector #
33
#----------------------------------------------------#
44

5-
cmake_minimum_required (VERSION 3.10)
5+
cmake_minimum_required (VERSION 3.12)
66
project (HDF5_VOL_REST C)
77

88
# Setup CMake policies.
@@ -14,7 +14,6 @@ foreach (policy
1414
endif ()
1515
endforeach ()
1616

17-
1817
#-----------------------------------------------------------------------------
1918
# Instructions for use : Normal Build
2019
#
@@ -87,7 +86,6 @@ set (HDF5_VOL_REST_LIBSH_TARGET "${HDF5_VOL_REST_LIB_CORENAME}-shared")
8786
set (HDF5_VOL_REST_TEST_LIB_TARGET "${HDF5_VOL_REST_TEST_LIB_CORENAME}-static")
8887
set (HDF5_VOL_REST_TEST_LIBSH_TARGET "${HDF5_VOL_REST_TEST_LIB_CORENAME}-shared")
8988

90-
9189
#-----------------------------------------------------------------------------
9290
# Define some CMake variables for use later in the project
9391
#-----------------------------------------------------------------------------
@@ -118,12 +116,15 @@ if (HDF5_ENABLE_THREADSAFE AND NOT Threads_FOUND)
118116
find_package(Threads)
119117
endif ()
120118

121-
find_package (CURL 7.61 REQUIRED)
119+
set (CURL_TARGET_LIBTYPE shared)
120+
121+
find_package (CURL 7.61 MODULE REQUIRED)
122+
122123
if (CURL_FOUND)
123124
include_directories(${CURL_INCLUDE_DIRS})
124125
set (LINK_LIBS ${LINK_LIBS} CURL::libcurl)
125126
else ()
126-
message (FATAL_ERROR "cURL not found; please check CURL_INCLUDE_DIR")
127+
message (FATAL_ERROR "cURL not found; please check CURL_ROOT")
127128
endif ()
128129

129130
# Include custom module for finding YAJL
@@ -283,11 +284,7 @@ endmacro (HDF5_VOL_REST_SET_LIB_OPTIONS)
283284

284285
#-------------------------------------------------------------------------------
285286
macro (RV_TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags)
286-
if (MSVC)
287-
TARGET_MSVC_PROPERTIES (${wintarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
288-
else ()
289-
set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}")
290-
endif ()
287+
set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}")
291288
endmacro ()
292289

293290
#-------------------------------------------------------------------------------
@@ -344,7 +341,7 @@ set (EXTERNAL_LIBRARYDLL_LIST "")
344341
#-----------------------------------------------------------------------------
345342
# Run all the CMake configuration tests for our build environment
346343
#-----------------------------------------------------------------------------
347-
#include (${HDF5_VOL_REST_RESOURCES_DIR}/ConfigureChecks.cmake)
344+
include (${HDF5_VOL_REST_RESOURCES_DIR}/ConfigureChecks.cmake)
348345

349346
set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
350347

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)