Skip to content

Commit

Permalink
Add Conda CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Apr 14, 2024
1 parent b94f558 commit 786cb60
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 61 deletions.
9 changes: 9 additions & 0 deletions .ci/build/conda.py
@@ -0,0 +1,9 @@
import subprocess
import sys

conda = sys.argv[1] if len(sys.argv) >= 2 else "conda"

subprocess.check_call([
conda, "install", "--yes", "-c", "conda-forge",
"boost", "cmake", "dcmtk", "icu", "jsoncpp", "ninja", "pkg-config",
"pybind11", "zlib"])
9 changes: 4 additions & 5 deletions .ci/build/post_build.py
Expand Up @@ -35,11 +35,10 @@
os.environ["PYTHONPATH"] = os.pathsep.join([
*os.environ.get("PYTHONPATH", "").split(os.pathsep), python_lib_dir])

os.environ |= {
"ODIL_OWN_AET": "LOCAL",
"ODIL_PEER_HOST_NAME": "127.0.0.1",
"ODIL_PEER_PORT": "11112",
"ODIL_PEER_AET": "REMOTE"}
os.environ["ODIL_OWN_AET"] = "LOCAL"
os.environ["ODIL_PEER_HOST_NAME"] = "127.0.0.1"
os.environ["ODIL_PEER_PORT"] = "11112"
os.environ["ODIL_PEER_AET"] = "REMOTE"
os.environ["PATH"] = os.pathsep.join([
*os.environ["PATH"].split(os.pathsep),
os.path.join(workspace, "tests/tools")])
Expand Down
38 changes: 0 additions & 38 deletions .ci/deb/post_build

This file was deleted.

20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Expand Up @@ -10,16 +10,20 @@ jobs:
fail-fast: false
matrix:
include:
- { os: "ubuntu-latest", container: "debian:bullseye", packaging: "apt", python: "python3" }
- { os: "ubuntu-latest", container: "debian:bookworm", packaging: "apt", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python3" }
- { os: "ubuntu-latest", container: "ubuntu:focal", packaging: "apt", python: "python3" }
- { os: "ubuntu-latest", container: "ubuntu:jammy", packaging: "apt", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python3" }
- { os: "ubuntu-latest", container: "debian:bullseye", packaging: "apt", python: "python3" }
- { os: "ubuntu-latest", container: "debian:bookworm", packaging: "apt", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python3" }
- { os: "ubuntu-latest", container: "ubuntu:focal", packaging: "apt", python: "python3" }
- { os: "ubuntu-latest", container: "ubuntu:jammy", packaging: "apt", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python3" }
- { os: "ubuntu-latest", packaging: "conda", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python" }
# - name: "macOS 11 (Big Sur) + Homebrew"
# os: macos-11
# ci_type: brew
env:
WORKSPACE: "${{ github.workspace }}"
CMAKE_OPTIONS: "${{ matrix.cmake_options }}"
defaults:
run:
shell: ${{ contains(matrix.os, 'windows') && 'pwsh' || 'bash -l {0}' }}
steps:
- name: Provision (Debian, Ubuntu)
# Install Python and Git. macOS workers already have this, however for
Expand All @@ -29,6 +33,14 @@ jobs:
DEBIAN_FRONTEND=noninteractive apt-get install -y git python3
if: ${{ contains(matrix.packaging, 'apt') }}

- name: Provision (Micromamba)
uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash powershell
environment-name: dicomifier
create-args: python=3.11
if: ${{ contains(matrix.packaging, 'conda') }}

- name: Checkout latest revision
uses: actions/checkout@v4

Expand Down
12 changes: 7 additions & 5 deletions src/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@ find_package(ICU REQUIRED COMPONENTS uc)
find_package(JsonCpp REQUIRED)
if(WITH_DCMTK)
find_package(DCMTK REQUIRED)
find_package(ZLIB REQUIRED)
endif()

file(GLOB_RECURSE Header_Files "*.h")
Expand All @@ -24,7 +25,7 @@ add_library(libodil ${Source_Files} ${Header_Files} ${templates})
target_compile_definitions(
libodil
PUBLIC
BOOST_ASIO_SEPARATE_COMPILATION ${DCMTK_DEFINITIONS}
BOOST_ASIO_SEPARATE_COMPILATION
ODIL_VERSION_MAJOR=${Odil_VERSION_MAJOR}
$<$<BOOL:BUILD_SHARED_LIBS>:BOOST_ALL_DYN_LINK>
$<$<PLATFORM_ID:Windows>:BOOST_UUID_FORCE_AUTO_LINK>
Expand All @@ -34,21 +35,22 @@ target_compile_definitions(
target_include_directories(
libodil
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/> $<INSTALL_INTERFACE:>
"$<$<BOOL:${WITH_DCMTK}>:${DCMTK_INCLUDE_DIRS}>")
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/> $<INSTALL_INTERFACE:>)

target_link_libraries(
libodil
PUBLIC
Boost::date_time Boost::exception Boost::filesystem Boost::log
"$<$<BOOL:${WITH_DCMTK}>:${DCMTK_LIBRARIES}>"
ICU::uc JsonCpp::JsonCpp
$<$<PLATFORM_ID:Windows>:netapi32>
# WARNING Need to link with bcrypt explicitly,
# cf. https://github.com/boostorg/uuid/issues/68#issuecomment-430173245
# Not sure why iphlpapi is not linked.
"$<$<BOOL:${VCPKG_TOOLCHAIN}>:bcrypt;iphlpapi>")

if(WITH_DCMTK)
target_link_libraries(libodil PUBLIC DCMTK::DCMTK ZLIB::ZLIB)
endif()

if(APPLE)
# WARNING: Boost::log may add -licudata -licui18n -licuu, which cause
# problems with macOS/brew
Expand Down
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
@@ -1,6 +1,7 @@
find_package(
Boost COMPONENTS exception filesystem log unit_test_framework REQUIRED)
find_package(DCMTK REQUIRED)
find_package(ZLIB REQUIRED)
find_package(JsonCpp REQUIRED)

add_subdirectory(tools)
Expand Down Expand Up @@ -36,17 +37,16 @@ foreach(test_file ${tests})
target_compile_definitions(
test_${test}
PRIVATE
BOOST_ASIO_SEPARATE_COMPILATION ${DCMTK_DEFINITIONS}
BOOST_ASIO_SEPARATE_COMPILATION
ODIL_VERSION_MAJOR=${Odil_VERSION_MAJOR}
$<$<BOOL:BUILD_SHARED_LIBS>:BOOST_ALL_DYN_LINK>)

target_include_directories(
test_${test} PRIVATE ${CMAKE_SOURCE_DIR}/src ${DCMTK_INCLUDE_DIRS})
target_include_directories(test_${test} PRIVATE ${CMAKE_SOURCE_DIR}/src)

target_link_libraries(
test_${test}
PRIVATE
Boost::unit_test_framework ${DCMTK_LIBRARIES} JsonCpp::JsonCpp
Boost::unit_test_framework DCMTK::DCMTK JsonCpp::JsonCpp ZLIB::ZLIB
libodil
$<$<PLATFORM_ID:Windows>:Ws2_32>)

Expand Down
7 changes: 2 additions & 5 deletions tests/tools/CMakeLists.txt
@@ -1,14 +1,11 @@
find_package(DCMTK REQUIRED)

add_definitions(${DCMTK_DEFINITIONS})
include_directories(${DCMTK_INCLUDE_DIRS})
link_directories(${DCMTK_LIBRARY_DIRS})
find_package(ZLIB REQUIRED)

file(GLOB headers *.h)
file(GLOB files "*.cc")

if(USE_BUILTIN_DCMTK_GETSCU)
add_executable(dcmtk_getscu ${files} ${headers})
target_link_libraries(dcmtk_getscu ${DCMTK_LIBRARIES})
target_link_libraries(dcmtk_getscu DCMTK::DCMTK ZLIB::ZLIB)
set_target_properties(dcmtk_getscu PROPERTIES OUTPUT_NAME getscu)
endif()

0 comments on commit 786cb60

Please sign in to comment.