Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,47 @@ jobs:
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ github.workspace }}/build

windows:
# Twelve source files carry WIN32 or _MSC_VER guards and nothing has
# compiled them for as long as the workflows have existed, so a change
# that breaks the Windows path is invisible until a consumer reports
# it. zlib comes from vcpkg because the project requires it.
name: windows-latest msvc ${{ matrix.linkage }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- linkage: static
shared: "OFF"
triplet: x64-windows-static
- linkage: shared
shared: "ON"
triplet: x64-windows
steps:
- uses: actions/checkout@v4
- name: Install zlib and expat
run: vcpkg install zlib:${{ matrix.triplet }} expat:${{ matrix.triplet }}
- name: Configure CMake
shell: pwsh
run: |
$toolchain = Join-Path $env:VCPKG_INSTALLATION_ROOT 'scripts/buildsystems/vcpkg.cmake'
Write-Host "vcpkg toolchain: $toolchain"
if (-not (Test-Path $toolchain)) { throw "toolchain file not found: $toolchain" }
cmake -B "${{ github.workspace }}/build" `
-DCMAKE_TOOLCHAIN_FILE="$toolchain" `
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} `
-DBUILD_SHARED_LIBS=${{ matrix.shared }} `
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY="${{ github.workspace }}/build/bin" `
-DNIFTI_BUILD_APPLICATIONS=ON `
-DUSE_NIFTI2_CODE=ON `
-DUSE_CIFTI_CODE=ON `
-S "${{ github.workspace }}"
- name: Build
run: cmake --build ${{ github.workspace }}/build --config Release
- name: Test
working-directory: ${{ github.workspace }}/build
# A test that cannot find a DLL can raise a modal dialog and block the
# runner rather than exit, so every test carries a timeout.
run: ctest --build-config Release --output-on-failure --no-tests=ignore --timeout 120
68 changes: 46 additions & 22 deletions cifti/afni_xml.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,38 +70,62 @@ typedef struct {
} afni_xml_control;


#ifndef CIF_API
#if defined(_WIN32) || defined(__CYGWIN__)
#if defined(CIFTI_BUILD_SHARED)
#ifdef __GNUC__
#define CIF_API __attribute__ ((dllexport))
#else
#define CIF_API __declspec( dllexport )
#endif
#elif defined(CIFTI_USE_SHARED)
#ifdef __GNUC__
#define CIF_API __attribute__ ((dllimport))
#else
#define CIF_API __declspec( dllimport )
#endif
#else
#define CIF_API
#endif
#elif (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)
#define CIF_API __attribute__ ((visibility ("default")))
#else
#define CIF_API
#endif
#endif

/* --------------------------- prototypes --------------------------------- */

/* main interface */
afni_xml_list axml_read_buf (const char * buf_in, int64_t bin_len);
afni_xml_list axml_read_file(const char * fname, int read_data);
CIF_API afni_xml_list axml_read_buf (const char * buf_in, int64_t bin_len);
CIF_API afni_xml_list axml_read_file(const char * fname, int read_data);

int axml_disp_xlist( const char *mesg, afni_xml_list * axlist, int verb);
int axml_disp_xml_t( const char *mesg, afni_xml_t * ax, int indent, int verb);
CIF_API int axml_disp_xlist( const char *mesg, afni_xml_list * axlist, int verb);
CIF_API int axml_disp_xml_t( const char *mesg, afni_xml_t * ax, int indent, int verb);


/* create/free */
afni_xml_t * new_afni_xml (const char * name);
int axml_add_attrs (afni_xml_t * ax, const char ** attr);
int axml_free_xml_t(afni_xml_t * ax);
int axml_free_xlist(afni_xml_list * axlist);

char * axml_attr_value(afni_xml_t * ax, const char * name);
int axml_recur(int(*func)(FILE*,afni_xml_t*,int), afni_xml_t * ax);
afni_xml_t * axml_recur_find_xml(int (*func)(afni_xml_t *, int), afni_xml_t * ax,
CIF_API afni_xml_t * new_afni_xml (const char * name);
CIF_API int axml_add_attrs (afni_xml_t * ax, const char ** attr);
CIF_API int axml_free_xml_t(afni_xml_t * ax);
CIF_API int axml_free_xlist(afni_xml_list * axlist);

CIF_API char * axml_attr_value(afni_xml_t * ax, const char * name);
CIF_API int axml_recur(int(*func)(FILE*,afni_xml_t*,int), afni_xml_t * ax);
CIF_API afni_xml_t * axml_recur_find_xml(int (*func)(afni_xml_t *, int), afni_xml_t * ax,
int depth, int max_depth);


/* control API */
int axml_set_verb ( int val );
int axml_get_verb ( void );
int axml_set_dstore ( int val );
int axml_get_dstore ( void );
int axml_set_indent ( int val );
int axml_get_indent ( void );
int axml_set_buf_size ( int val );
int axml_get_buf_size ( void );
int axml_set_wstream ( FILE *fp );
FILE * axml_get_wstream ( void );
CIF_API int axml_set_verb ( int val );
CIF_API int axml_get_verb ( void );
CIF_API int axml_set_dstore ( int val );
CIF_API int axml_get_dstore ( void );
CIF_API int axml_set_indent ( int val );
CIF_API int axml_get_indent ( void );
CIF_API int axml_set_buf_size ( int val );
CIF_API int axml_get_buf_size ( void );
CIF_API int axml_set_wstream ( FILE *fp );
CIF_API FILE * axml_get_wstream ( void );

#endif /* AFNI_XML_H */
23 changes: 0 additions & 23 deletions cifti/afni_xml_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,6 @@
- convert as in SUMA_Create_Fake_CIFTI()
* ----------------------------------------------------------------------*/

#ifndef CIF_API
#if defined(_WIN32) || defined(__CYGWIN__)
#if defined(CIFTI_BUILD_SHARED)
#ifdef __GNUC__
#define CIF_API __attribute__ ((dllexport))
#else
#define CIF_API __declspec( dllexport )
#endif
#elif defined(CIFTI_USE_SHARED)
#ifdef __GNUC__
#define CIF_API __attribute__ ((dllimport))
#else
#define CIF_API __declspec( dllimport )
#endif
#else
#define CIF_API
#endif
#elif (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)
#define CIF_API __attribute__ ((visibility ("default")))
#else
#define CIF_API
#endif
#endif

/* --------------------------- structures --------------------------------- */

Expand Down