Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ for:
- job_name: win

build_script:
- cmake -Wno-dev -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_OPENJPEG=GitHub -DUSE_JPEGLS=ON -B build
- cmake -Wno-dev -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B build
- cmake --build build --config %configuration%

after_build:
Expand All @@ -53,7 +53,7 @@ for:

build_script:
- export CC=gcc-8 CXX=g++-8
- cmake -Wno-dev -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_OPENJPEG=GitHub -DUSE_JPEGLS=ON -B build
- cmake -Wno-dev -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B build
- cmake --build build

after_build:
Expand All @@ -68,10 +68,10 @@ for:

build_script:
- sudo xcode-select -s /Applications/Xcode-11.3.1.app
- cmake -Wno-dev -DCMAKE_OSX_ARCHITECTURES=x86_64 -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_OPENJPEG=GitHub -DUSE_JPEGLS=ON -B intel
- cmake -Wno-dev -DCMAKE_OSX_ARCHITECTURES=x86_64 -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B intel
- cmake --build intel
- sudo xcode-select -s /Applications/Xcode-12.3.app
- cmake -Wno-dev -DCMAKE_OSX_ARCHITECTURES=arm64 -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_OPENJPEG=GitHub -DUSE_JPEGLS=ON -B apple
- cmake -Wno-dev -DCMAKE_OSX_ARCHITECTURES=arm64 -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B apple
- cmake --build apple

after_build:
Expand Down
129 changes: 129 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Build

on:
push:
pull_request:

jobs:
build:
strategy:
fail-fast: true # Stop all builds if one fails
matrix:
include:
- os: windows-latest
name: win
artifact: dcm2niix_win.zip
- os: ubuntu-latest
name: linux
artifact: dcm2niix_lnx.zip
- os: macos-latest
name: mac
artifact_intel: dcm2niix_mac_intel.zip
artifact_arm: dcm2niix_mac_arm.zip

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set version
id: version
shell: bash
run: |
DATE=$(date +'%d-%b-%Y')
GITHASH=$(git rev-parse --short=7 HEAD)
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
GITTAG="_${{ github.ref_name }}"
else
GITTAG=""
fi
VERSION="${DATE}_g${GITHASH}${GITTAG}"
RELEASE_VERSION=$(date +'%d-%B-%Y')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "release_version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT
echo "Build version: ${VERSION}"

# Windows build
- name: Build (Windows)
if: matrix.name == 'win'
shell: cmd
run: |
cmake -Wno-dev -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B build
cmake --build build --config Release

- name: Package (Windows)
if: matrix.name == 'win'
shell: cmd
run: 7z a dcm2niix_win.zip .\build\bin\*

# Linux build
- name: Setup GCC (Linux)
if: matrix.name == 'linux'
run: |
sudo apt-get update
sudo apt-get install build-essential

- name: Build (Linux)
if: matrix.name == 'linux'
run: |
export CC=gcc
export CXX=g++
cmake -Wno-dev -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B build
cmake --build build

- name: Package (Linux)
if: matrix.name == 'linux'
run: |
strip -sx build/bin/*
7z a dcm2niix_lnx.zip ./build/bin/*

# macOS build
- name: Build (macOS)
if: matrix.name == 'mac'
run: |
# Build Intel version
cmake -Wno-dev -DCMAKE_OSX_ARCHITECTURES=x86_64 -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B intel
cmake --build intel

# Build ARM version
cmake -Wno-dev -DCMAKE_OSX_ARCHITECTURES=arm64 -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON -B apple
cmake --build apple

- name: Package (macOS)
if: matrix.name == 'mac'
run: |
# Package Intel version
mkdir -p build_intel/bin
cp intel/bin/dcm2niix build_intel/bin/
strip -Sx build_intel/bin/*
7z a dcm2niix_mac_intel.zip ./build_intel/bin/*

# Package ARM version
mkdir -p build_arm/bin
cp apple/bin/dcm2niix build_arm/bin/
strip -Sx build_arm/bin/*
7z a dcm2niix_mac_arm.zip ./build_arm/bin/*

- name: Upload artifact (Windows/Linux)
if: matrix.name != 'mac'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-artifact
path: ${{ matrix.artifact }}

- name: Upload artifact (macOS Intel)
if: matrix.name == 'mac'
uses: actions/upload-artifact@v4
with:
name: mac-intel-artifact
path: ${{ matrix.artifact_intel }}

- name: Upload artifact (macOS ARM)
if: matrix.name == 'mac'
uses: actions/upload-artifact@v4
with:
name: mac-arm-artifact
path: ${{ matrix.artifact_arm }}
32 changes: 26 additions & 6 deletions SuperBuild/External-OPENJPEG.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
set(OPENJPEG_TAG openjpeg-2.5)
set(OPENJPEG_TAG v2.5.3)

# Set MSVC runtime flags only on Windows
if(WIN32 AND MSVC)
set(OPENJPEG_C_FLAGS_RELEASE /MT)
set(OPENJPEG_C_FLAGS_DEBUG /MTd)
else()
set(OPENJPEG_C_FLAGS_RELEASE "")
set(OPENJPEG_C_FLAGS_DEBUG "")
endif()

ExternalProject_Add(openjpeg
GIT_REPOSITORY "https://github.com/ningfei/openjpeg.git"
GIT_REPOSITORY "https://github.com/uclouvain/openjpeg.git"
GIT_TAG "${OPENJPEG_TAG}"
SOURCE_DIR openjpeg
BINARY_DIR openjpeg-build
CMAKE_ARGS
-Wno-dev
--no-warn-unused-cli
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>
-DCMAKE_C_FLAGS_RELEASE=${OPENJPEG_C_FLAGS_RELEASE}
-DCMAKE_C_FLAGS_DEBUG=${OPENJPEG_C_FLAGS_DEBUG}
-DOPJ_USE_THREAD=OFF
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
# Compiler settings
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
# Install directories
-DBUILD_SHARED_LIBS=OFF
# disable optional dependencies not needed for dcm2niix
-DBUILD_CODEC=OFF
-DBUILD_JPIP=OFF
-DBUILD_JPWL=OFF
-DBUILD_VIEWER=OFF
-DBUILD_JAVA=OFF
-DBUILD_MJ2=OFF
-DBUILD_THIRDPARTY=OFF
-DCMAKE_INSTALL_PREFIX:PATH=${DEP_INSTALL_DIR}
)

include(GNUInstallDirs)
set(OpenJPEG_DIR ${DEP_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${OPENJPEG_TAG})
set(OpenJPEG_DIR ${DEP_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/openjpeg-2.5)