Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into new_peaks_cmds
Browse files Browse the repository at this point in the history
Conflicts:
	core/file/nifti_utils.h
	python/mrtrix3/commands/peakscheck
  • Loading branch information
Lestropie committed Sep 17, 2024
2 parents 81d10ef + 39d61f8 commit 68aa74b
Show file tree
Hide file tree
Showing 377 changed files with 13,150 additions and 39,816 deletions.
10 changes: 10 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,13 @@ cd8a6f1c2d0debcf3a6de185f8b92fc0be3e1401
#Author: MRtrixBot <[email protected]>
#Date: Fri, 5 Apr 2024 14:06:00 +0100
# Replace include guards with #pragma once

9b3de4d4defc3c7572bcd3ab9f214b72ce91abf3
#Author: MRtrixBot <[email protected]>
#Date: Sun Jun 9 20:33:33 2024 +1000
# population_template: Split source code between files

10c49930a63e6a2b0ce7d25d3f6d8dde290b2719
#Author: MRtrixBot <[email protected]>
#Date: Mon, 19 Aug 2024 16:18:12 +0100
# Remove core/file/json.h and core/half.hpp
10 changes: 3 additions & 7 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build python3-distutils python3-numpy
sudo apt-get install clang qt6-base-dev libglvnd-dev zlib1g-dev libfftw3-dev ninja-build python3-distutils python3-numpy
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install g++-9 qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build python3-numpy
sudo apt-get install g++-9 qt6-base-dev libglvnd-dev zlib1g-dev libfftw3-dev ninja-build python3-numpy
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
Expand Down Expand Up @@ -208,10 +208,8 @@ jobs:
${{env.MINGW_PACKAGE_PREFIX}}-bc
${{env.MINGW_PACKAGE_PREFIX}}-cmake
${{env.MINGW_PACKAGE_PREFIX}}-diffutils
${{env.MINGW_PACKAGE_PREFIX}}-eigen3
${{env.MINGW_PACKAGE_PREFIX}}-fftw
${{env.MINGW_PACKAGE_PREFIX}}-gcc
${{env.MINGW_PACKAGE_PREFIX}}-libtiff
${{env.MINGW_PACKAGE_PREFIX}}-ninja
${{env.MINGW_PACKAGE_PREFIX}}-pkg-config
${{env.MINGW_PACKAGE_PREFIX}}-qt6-base
Expand Down Expand Up @@ -268,7 +266,6 @@ jobs:

- name: pylint
run: |
echo "__version__ = 'pylint testing' #pylint: disable=unused-variable" > ./python/lib/mrtrix3/_version.py
./run_pylint || { cat pylint.log; false; }
- name: check copyright headers
Expand All @@ -284,5 +281,4 @@ jobs:
extensions: 'h,cpp'
clangFormatVersion: 16
# Ignore third party headers
exclude: './core/file/json.h ./core/file/nifti1.h ./core/file/nifti2.h'

exclude: './thirdparty ./_deps'
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: ZedThree/[email protected]
id: review
with:
apt_packages: g++,qt6-base-dev,libqt6opengl6-dev,libglvnd-dev,libeigen3-dev,zlib1g-dev,libfftw3-dev,ninja-build
apt_packages: g++,qt6-base-dev,libqt6opengl6-dev,libglvnd-dev,zlib1g-dev,libfftw3-dev,ninja-build
config_file: .clang-tidy

- uses: ZedThree/clang-tidy-review/[email protected]
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@
.check_syntax.tmp
.check_syntax2.tmp
build/
CMakeLists.txt.user
CMakeLists.txt.user
testing/data/tmp*
testing/data/*-tmp-*
8 changes: 0 additions & 8 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
[submodule "testing/data"]
path = testing/binaries/data
url = https://github.com/MRtrix3/test_data
ignore = dirty
[submodule "testing/script_data"]
path = testing/scripts/data
url = https://github.com/MRtrix3/script_test_data.git
ignore = dirty
57 changes: 42 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

set(CMAKE_OSX_DEPLOYMENT_TARGET 11.00 CACHE STRING "")
project(mrtrix3 LANGUAGES CXX VERSION 3.0.4)

if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
message(WARNING "It is recommended to use the Ninja generator to build MRtrix3. "
"To use it, run cmake with -G Ninja or set the CMAKE_GENERATOR "
"environment variable to Ninja.")
endif()

include(GNUInstallDirs)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand All @@ -15,6 +22,17 @@ option(MRTRIX_STL_DEBUGGING "Enable STL debug mode" OFF)
option(MRTRIX_BUILD_TESTS "Build tests executables" OFF)
option(MRTRIX_STRIP_CONDA "Strip ananconda/mininconda from PATH to avoid conflicts" ON)
option(MRTRIX_USE_PCH "Use precompiled headers" ON)
option(MRTRIX_PYTHON_SOFTLINK "Build directory softlink to Python source code rather than copying" ON)
option(MRTRIX_BUILD_NON_CORE_STATIC "Build MRtrix's non-core code as a static library" OFF)
option(MRTRIX_USE_LLD "Use lld as the linker" OFF)

set(MRTRIX_DEPENDENCIES_DIR "" CACHE PATH
"An optional local directory containing all thirdparty dependencies:\n \
- Eigen3 https://gitlab.com/libeigen/eigen (version 3.4.0 in .tar.gz format)\n \
- Json for Modern C++ https://github.com/nlohmann/json (version 3.11.3 in .tar.xz format)\n \
- Half https://half.sourceforge.net/ (version 2.1.0 in zip format)\n \
- NIfTI C headers https://nifti.nimh.nih.gov/pub/dist/src/nifti2/ (nifti1.h and nifti2.h stored in nifti/ subdirectory)\n"
)

if(MRTRIX_BUILD_TESTS)
if(CMAKE_VERSION VERSION_GREATER 3.17)
Expand Down Expand Up @@ -59,6 +77,10 @@ include(LinkerSetup)
include(FindFFTW)
include(CompilerCache)
include(ECMEnableSanitizers)
include(Dependencies)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
include(MacOSBundle)
endif()

use_compiler_cache()

Expand All @@ -69,30 +91,35 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git AND NOT EXISTS ${CMAKE_CURRENT_SOURCE
"and then run `pre-commit install` from the ${CMAKE_CURRENT_SOURCE_DIR} directory.")
endif()


add_compile_definitions(
add_library(mrtrix-common INTERFACE)
add_library(mrtrix::common ALIAS mrtrix-common)
target_compile_definitions(mrtrix-common INTERFACE
MRTRIX_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
$<$<PLATFORM_ID:Windows>:MRTRIX_WINDOWS>
$<$<PLATFORM_ID:Darwin>:MRTRIX_MACOSX>
$<$<PLATFORM_ID:FreeBSD>:MRTRIX_FREEBSD>
)

if(MRTRIX_STL_DEBUGGING AND $<NOT:$<CONFIG:Debug>>)
if(MSVC)
add_compile_definitions(_ITERATOR_DEBUG_LEVEL=1)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(_LIBCPP_DEBUG)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(_GLIBCXX_DEBUG _GLIBCXX_DEBUG_PEDANTIC)
endif()
if(MRTRIX_STL_DEBUGGING AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Enabling STL debug mode")
target_compile_definitions(mrtrix-common INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:_ITERATOR_DEBUG_LEVEL=1>
$<$<CXX_COMPILER_ID:GNU>:_GLIBCXX_DEBUG _GLIBCXX_DEBUG_PEDANTIC>
$<$<CXX_COMPILER_ID:Clang>:_LIBCPP_DEBUG=1>
)
endif()

if(MRTRIX_WARNINGS_AS_ERRORS)
if (MSVC)
add_compile_options(/WX)
else()
add_compile_options(-Werror)
endif()
message(STATUS "Enabling warnings as errors")
target_compile_options(mrtrix-common INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:/WX>
$<$<CXX_COMPILER_ID:GNU,Clang>:-Werror>
)
endif()

# Allow compilation of big object of files in debug mode on MINGW
if(MINGW AND CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_options(mrtrix-common INTERFACE -Wa,-mbig-obj)
endif()


Expand Down
2 changes: 1 addition & 1 deletion clang-format-all
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/env/python3
#!/usr/bin/env python3

# Copyright (c) 2008-2024 the MRtrix3 contributors.
#
Expand Down
7 changes: 4 additions & 3 deletions cmake/BashTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function(add_bash_test)
message(FATAL_ERROR "bash not found")
endif()

set(singleValueArgs FILE_PATH PREFIX WORKING_DIRECTORY)
set(singleValueArgs FILE_PATH PREFIX WORKING_DIRECTORY ENVIRONMENT)
set(multiValueArgs EXEC_DIRECTORIES LABELS)
cmake_parse_arguments(
ARG
Expand All @@ -20,6 +20,7 @@ function(add_bash_test)
set(prefix ${ARG_PREFIX})
set(working_directory ${ARG_WORKING_DIRECTORY})
set(exec_directories ${ARG_EXEC_DIRECTORIES})
set(environment ${ARG_ENVIRONMENT})
set(labels ${ARG_LABELS})

# Regenerate tests when the test script changes
Expand Down Expand Up @@ -47,11 +48,11 @@ function(add_bash_test)
)
set_tests_properties(${test_name}
PROPERTIES
ENVIRONMENT "PATH=${exec_directories}"
ENVIRONMENT "PATH=${exec_directories};${environment}"
)
if(labels)
set_tests_properties(${test_name} PROPERTIES LABELS "${labels}")
endif()

message(VERBOSE "Add bash tests commands for ${test_name}: ${line}")
message(VERBOSE "Added bash test command ${test_name}")
endfunction()
92 changes: 92 additions & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
include(FetchContent)

if(NOT ${MRTRIX_DEPENDENCIES_DIR} STREQUAL "")
message(STATUS "Using local dependencies at ${MRTRIX_DEPENDENCIES_DIR}")
set(MRTRIX_LOCAL_DEPENDENCIES ON)
else()
set(MRTRIX_LOCAL_DEPENDENCIES OFF)
endif()

# Eigen
# We avoid configuring the Eigen library via FetchContent_MakeAvaiable
# to avoid the verbosity of Eigen's CMake configuration output.
if(MRTRIX_LOCAL_DEPENDENCIES)
set(eigen_url ${MRTRIX_DEPENDENCIES_DIR}/eigen-3.4.0.tar.gz)
else()
set(eigen_url "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz")
endif()

FetchContent_Declare(
eigen3
DOWNLOAD_EXTRACT_TIMESTAMP ON
URL ${eigen_url}
)
FetchContent_GetProperties(Eigen3)
if(NOT eigen3_POPULATED)
FetchContent_Populate(Eigen3)
add_library(Eigen3 INTERFACE)
add_library(Eigen3::Eigen ALIAS Eigen3)
target_include_directories(Eigen3 INTERFACE "${eigen3_SOURCE_DIR}")
endif()

# Json for Modern C++
if(MRTRIX_LOCAL_DEPENDENCIES)
set(json_url ${MRTRIX_DEPENDENCIES_DIR}/json.tar.xz)
else()
set(json_url "https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz")
endif()
FetchContent_Declare(
json
DOWNLOAD_EXTRACT_TIMESTAMP ON
URL ${json_url}
)
FetchContent_MakeAvailable(json)


# Half-precision floating-point library
if(MRTRIX_LOCAL_DEPENDENCIES)
set(half_url ${MRTRIX_DEPENDENCIES_DIR}/half-2.1.0.zip)
else()
set(half_url "https://sourceforge.net/projects/half/files/half/2.1.0/half-2.1.0.zip/download")
endif()
FetchContent_Declare(
half
DOWNLOAD_EXTRACT_TIMESTAMP ON
URL ${half_url}
)
FetchContent_MakeAvailable(half)

add_library(half INTERFACE)
add_library(half::half ALIAS half)
target_include_directories(half INTERFACE "${half_SOURCE_DIR}/include")


# Nifti headers
add_library(nifti INTERFACE)
add_library(nifti::nifti ALIAS nifti)

if(MRTRIX_LOCAL_DEPENDENCIES)
target_include_directories(nifti INTERFACE "${MRTRIX_DEPENDENCIES_DIR}/nifti")
else()
include(ExternalProject)
ExternalProject_Add(
nifti1
PREFIX nifti
URL "https://raw.githubusercontent.com/NIFTI-Imaging/nifti_clib/master/nifti2/nifti1.h"
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
DOWNLOAD_NO_EXTRACT ON
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
)
ExternalProject_Add(
nifti2
PREFIX nifti
URL "https://raw.githubusercontent.com/NIFTI-Imaging/nifti_clib/master/nifti2/nifti2.h"
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
DOWNLOAD_NO_EXTRACT ON
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
)
target_include_directories(nifti INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/nifti/src/")
endif()

37 changes: 2 additions & 35 deletions cmake/FindFFTW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ if( FFTW_ROOT )
NO_DEFAULT_PATH
)

find_library(
FFTWF_LIB
NAMES "fftw3f"
PATHS ${FFTW_ROOT}
PATH_SUFFIXES "lib" "lib64"
NO_DEFAULT_PATH
)

find_library(
FFTWL_LIB
NAMES "fftw3l"
PATHS ${FFTW_ROOT}
PATH_SUFFIXES "lib" "lib64"
NO_DEFAULT_PATH
)

#find includes
find_path(
FFTW_INCLUDES
Expand All @@ -87,19 +71,6 @@ else()
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
)

find_library(
FFTWF_LIB
NAMES "fftw3f"
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
)


find_library(
FFTWL_LIB
NAMES "fftw3l"
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
)

find_path(
FFTW_INCLUDES
NAMES "fftw3.h"
Expand All @@ -108,17 +79,13 @@ else()

endif()

set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB})

if(FFTWL_LIB)
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB})
endif()
set(FFTW_LIBRARIES ${FFTW_LIB})

set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFTW DEFAULT_MSG
FFTW_INCLUDES FFTW_LIBRARIES)

mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)
mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB)

Loading

0 comments on commit 68aa74b

Please sign in to comment.