diff --git a/.github/workflows/build-and-test-linux.yml b/.github/workflows/build-and-test-linux.yml new file mode 100644 index 000000000..928e8c400 --- /dev/null +++ b/.github/workflows/build-and-test-linux.yml @@ -0,0 +1,51 @@ +name: Build daisy and run tests on linux + +on: + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + + - name: Install build dependencies + run: sudo apt install cmake libsuitesparse-dev libboost-filesystem-dev python3-pybind11 + + - name: Install uv for testing + uses: astral-sh/setup-uv@v7 + with: + version: "0.9.18" + + - name: Install python + run: uv python install 3.13 + + - name: Create build dir + run: mkdir ci-build + + - name: Configure CMake + working-directory: ci-build + run: cmake .. --preset linux-gcc-portable + + - name: Build + working-directory: ci-build + run: cmake --build . -j 4 + + - name: Test environment + working-directory: ci-build + run: | + uv venv + uv pip install git+https://github.com/daisy-model/daisypy-test + + - name: Test + working-directory: ci-build + run: ctest --output-on-failure + + - name: Upload test log + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: test-output-ubuntu + path: build/Testing diff --git a/.github/workflows/build-and-test-macos.yml b/.github/workflows/build-and-test-macos.yml new file mode 100644 index 000000000..fa5766c42 --- /dev/null +++ b/.github/workflows/build-and-test-macos.yml @@ -0,0 +1,62 @@ +name: Build daisy and run tests on MacOS + +on: + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v5 + + - name: Install build dependencies using brew + run: brew install cmake boost suite-sparse pybind11 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + version: "0.9.18" + + - name: Install python + run: uv python install 3.13 + + - name: Create build dir + run: mkdir ci-build + + - name: Configure CMake + working-directory: ci-build + run: > + cmake .. + -DUV_INSTALLED_PYTHON_ROOT_DIR=$( ls -d $( uv python dir )/* | grep 3.13 ) + --preset macos-clang-portable + + - name: Build + working-directory: ci-build + run: cmake --build . -j 4 + + - name: Pack + working-directory: ci-build + run: cpack -G ZIP + + - name: Install + working-directory: ci-build + run: unzip $( ls | grep -e "daisy.*Darwin-python.*zip" ) + + - name: Setup test environment + working-directory: ci-build + run: | + uv venv + uv pip install git+https://github.com/daisy-model/daisypy-test + + - name: Test + working-directory: ci-build + run: ctest --output-on-failure + + - name: Upload test log + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: test-output-macos + path: ci-build/Testing diff --git a/.github/workflows/build-and-test-windows.yml b/.github/workflows/build-and-test-windows.yml index dae4cc819..ba94dd455 100644 --- a/.github/workflows/build-and-test-windows.yml +++ b/.github/workflows/build-and-test-windows.yml @@ -3,66 +3,71 @@ name: Build daisy and run tests on windows on: pull_request: branches: [ "main" ] - + jobs: build: - runs-on: ${{ matrix.os }} + runs-on: windows-latest - strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. - # Consider changing this to true when your workflow is stable. - fail-fast: false - matrix: - os: [windows-latest] - include: - - { sys: ucrt64, env: ucrt-x86_64 } defaults: run: shell: msys2 {0} + steps: - uses: msys2/setup-msys2@v2 with: - msystem: ${{matrix.sys}} + msystem: UCRT64 update: true install: >- git - mingw-w64-${{matrix.env}}-cmake - mingw-w64-${{matrix.env}}-gcc - mingw-w64-${{matrix.env}}-ninja - mingw-w64-${{matrix.env}}-suitesparse - mingw-w64-${{matrix.env}}-boost - mingw-w64-${{matrix.env}}-pybind11 - mingw-w64-${{matrix.env}}-python - mingw-w64-${{matrix.env}}-python-pip - mingw-w64-${{matrix.env}}-python-pandas + mingw-w64-ucrt-x86_64-cmake + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-ninja + mingw-w64-ucrt-x86_64-suitesparse + mingw-w64-ucrt-x86_64-boost + mingw-w64-ucrt-x86_64-pybind11 + mingw-w64-ucrt-x86_64-uv unzip - - name: Install python dependencies - run: pip install pint daisypy-test@git+https://github.com/daisy-model/daisypy-test + - uses: actions/checkout@v5 + + - name: Install python + run: uv python install 3.13 - - uses: actions/checkout@v4 + - name: Create build dir + run: mkdir ci-build - - name: Get embeddable python - run: mkdir -p python/python && - wget https://www.python.org/ftp/python/3.12.10/python-3.12.10-embed-amd64.zip -O python/python.zip && - unzip python/python.zip -d python/python && - cp python/python/python312.dll python/python/libpython3.12.dll - - name: Configure CMake + working-directory: ci-build run: > - cmake -B build --preset mingw-gcc-portable + cmake .. + -DUV_INSTALLED_PYTHON_ROOT_DIR=$( ls -d $( uv python dir | tr \\\\ / )/* | grep 3.13 ) + --preset mingw-gcc-portable - name: Build - run: cmake --build build - - - name: Test - working-directory: build + working-directory: ci-build + run: cmake --build . + + - name: Pack + working-directory: ci-build + run: cpack -G ZIP + + - name: Install + working-directory: ci-build + run: unzip $( ls | grep -e "daisy-.*-Windows-python.*zip" ) + + - name: Setup test environment + working-directory: ci-build run: | - ctest --output-on-failure + uv venv + uv pip install git+https://github.com/daisy-model/daisypy-test + + - name: Test + working-directory: ci-build + run: ctest --output-on-failure - name: Upload test logs if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: - name: test-output-win - path: build/Testing \ No newline at end of file + name: test-output-windows + path: ci-build/Testing diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml deleted file mode 100644 index 59d408451..000000000 --- a/.github/workflows/build-and-test.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Build daisy and run tests - -on: - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. - # Consider changing this to true when your workflow is stable. - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] - python-version: ["3.11"] - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip install pandas pint daisypy-test@git+https://github.com/daisy-model/daisypy-test - - - name: Install macOS dependencies - if: ${{ startsWith(matrix.os, 'macos') }} - run: brew install cmake boost suite-sparse pybind11 - - - name: Install ubuntu dependencies - if: ${{ startsWith(matrix.os, 'ubuntu') }} - run: sudo apt install cmake libsuitesparse-dev libboost-filesystem-dev libboost-system-dev python3-pybind11 - - - name: Set reusable strings - id: strings - shell: bash - run: | - echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" - - - name: Configure CMake ubuntu - if: ${{ startsWith(matrix.os, 'ubuntu') }} - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -S ${{ github.workspace }} - --preset linux-gcc-portable - - - name: Configure CMake macos - if: ${{ startsWith(matrix.os, 'macos') }} - run: > - cmake -B ${{ steps.strings.outputs.build-output-dir }} - -S ${{ github.workspace }} - --preset macos-clang-portable - - - name: Build - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} -j 4 - - - name: Test - working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: | - ctest --output-on-failure - - - name: Upload test log macos - if: ${{ startsWith(matrix.os, 'macos') && !cancelled() }} - uses: actions/upload-artifact@v4 - with: - name: test-output-macos - path: build/Testing - - - name: Upload test log ubuntu - if: ${{ startsWith(matrix.os, 'ubuntu') && !cancelled() }} - uses: actions/upload-artifact@v4 - with: - name: test-output-ubuntu - path: build/Testing diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b5c7a25f..5f762003b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,6 @@ option(MAKE_PORTABLE "Set to ON to make a generic build" OFF) if (${BUILD_PYTHON}) add_definitions( -DBUILD_PYTHON ) include(cmake/python.cmake) -else() - set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}-no-python") endif() if (NOT CMAKE_BUILD_TYPE) @@ -53,7 +51,11 @@ if (${OS} STREQUAL "macos") message("Using HOMEBREW_PREFIX = ${HOMEBREW_PREFIX}") endif() -find_package(Boost 1.74 REQUIRED CONFIG COMPONENTS filesystem system) +if (${OS} STREQUAL "macos") + find_package(Boost 1.90 REQUIRED CONFIG COMPONENTS filesystem) +else() + find_package(Boost 1.83 REQUIRED CONFIG COMPONENTS filesystem system) +endif() message(STATUS "Boost version: ${Boost_VERSION}") SET(COMPILE_OPTIONS @@ -69,11 +71,12 @@ SET(LINKER_OPTIONS "$<$:${LINKER_OPTIONS_PORTABLE}>" ) -if (${OS} STREQUAL "macos" AND ${BUILD_PYTHON}) +if (${OS} STREQUAL "macos") set(DAISY_BIN_NAME daisy-bin) else() set(DAISY_BIN_NAME daisy) endif() + add_executable(${DAISY_BIN_NAME}) if (${OS} STREQUAL "mingw") include(cmake/MinGW.cmake) @@ -86,10 +89,6 @@ endif() # Sources are added with target_sources in CMakeLists in the source tree add_subdirectory(src) -# Test -include(CTest) -add_subdirectory(test) - # Packaging # lib/ and sample/ contain .dai files that define functionality that should be installed add_subdirectory(lib) @@ -113,3 +112,8 @@ include(CPack) # Documentation include(cmake/Doc.cmake) + +# Test +# We do it last so we have access to variables set during build and packaging +include(CTest) +add_subdirectory(test) diff --git a/CMakePresets.json b/CMakePresets.json index aff983415..1eac60321 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -21,7 +21,7 @@ "generator" : "Unix Makefiles", "cacheVariables" : { "__comment" : "Homebrew uses different locations for library symlinks depending on hardware. '/usr/local/lib' on Intel and '/opt/homebrew/lib on Apple'", - "EXTRA_SYSTEM_INCLUDE_DIRECTORIES" : "/usr/local/lib;/opt/homebrew/lib", + "EXTRA_SYSTEM_INCLUDE_DIRECTORIES" : "/usr/local/lib;/opt/homebrew/lib", "OS_OPTIONS" : "-D__unix", "OS" : "macos" } @@ -127,18 +127,34 @@ "name" : "mingw-gcc-native", "inherits" : [ "gcc", "mingw", "release" ] }, - { + { "name" : "mingw-gcc-portable", "inherits" : [ "gcc", "mingw", "release", "portable" ] }, + { + "name" : "mingw-clang-native", + "inherits" : [ "clang", "mingw", "release" ] + }, + { + "name" : "mingw-clang-portable", + "inherits" : [ "clang", "mingw", "release", "portable" ] + }, { "name" : "macos-clang-native", "inherits" : [ "clang", "macos", "release" ] }, - { + { "name" : "macos-clang-portable", "inherits" : [ "clang", "macos", "release", "portable" ] + }, + { + "name" : "macos-gcc-native", + "inherits" : [ "gcc", "macos", "release" ] + }, + { + "name" : "macos-gcc-portable", + "inherits" : [ "gcc", "macos", "release", "portable" ] } ] } diff --git a/Makefile b/Makefile index c878624e0..5980fe705 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,151 @@ -uv_python_root = +daisy_version := $(shell scripts/get_version_from_cmake.sh) +current_dir := $(shell pwd) +has_gcovr := $(shell command -v gcovr 2> /dev/null) +python_version = 3.13 +python_root := $(shell scripts/find_python_root_dir.sh ${PYTHON_VERSION}) +nproc := 6 -macos: macos-python macos-no-python +# Python +.PHONY: uv-python +uv-python: + uv python install $(python_version) -macos-python: - mkdir -p build/portable-python - cd build/portable-python; \ - cmake ../.. --preset macos-clang-portable -DUV_INSTALLED_PYTHON_ROOT_DIR=$(uv_python_root); \ - cmake --build . -j 6; \ + +# Windows +## Windows: Default build installer and zip +windows_build_dir=build/mingw-gcc-portable +.PHONY: windows +windows: windows-nsis windows-zip + +## Windows: Standard build +.PHONY: windows-build +windows-build: uv-python + mkdir -p ${windows_build_dir} + cmake . -B ${windows_build_dir} --preset mingw-gcc-portable -DUV_INSTALLED_PYTHON_ROOT_DIR=${python_root} + cmake --build ${windows_build_dir} + +## Windows: Installer +.PHONY: windows-nsis +windows-nsis: windows-build + cd ${windows_build_dir} && cpack -G NSIS + +## Windows: Zip +.PHONY: windows-zip +windows-zip: windows-build + cd ${windows_build_dir} && cpack -G ZIP + +## Windows: Test +.PHONY: windows-test +windows-test: windows-zip + cd ${windows_build_dir} && \ + uv venv --allow-existing && \ + uv pip install git+https://github.com/daisy-model/daisypy-test && \ + unzip -qo `ls | grep -e "daisy-.*-Windows-python.*zip"` && \ + ctest --output-on-failure + +# Linux +## Linux: Default build both debian and flatpak +linux_build_dir=build/linux-gcc-portable +.PHONY: linux +linux: debian flatpak + +## Linux: Standard build +.PHONY: linux-build +linux-build: + mkdir -p ${linux_build_dir} + cmake . -B ${linux_build_dir} --preset linux-gcc-portable + cmake --build ${linux_build_dir} -j ${nproc} + +## Linux: Coverage build +linux_coverage_build_dir=build/linux-gcc-coverage +.PHONY: linux-coverage-build +linux-coverage-build: + mkdir -p ${linux_coverage_build_dir} + cmake . -B ${linux_coverage_build_dir} --preset linux-gcc-coverage + cmake --build ${linux_coverage_build_dir} -j ${nproc} + +## Linux: Debian package +.PHONY: debian +debian: linux-build + cd ${linux_build_dir} && pack -G DEB + +## Linux: Flatpak package +.PHONY: flatpak +flatpak: + cd flatpak && \ + flatpak-builder --force-clean --install-deps-from=flathub --repo=repo build dk.ku.daisy.yml && \ + flatpak build-bundle repo daisy-$(version).flatpak dk.ku.daisy + + +## Linux test using standard build +$(linux_build_dir)/daisy: linux-build + +.PHONY: linux-test +linux-test: $(linux_build_dir)/daisy + cd $(linux_build_dir) && \ + uv venv --allow-existing && \ + uv pip install git+https://github.com/daisy-model/daisypy-test && \ + ctest -j 20 + +## Linux test using coverage build +$(linux_coverage_build_dir)/daisy: linux-coverage-build + +.PHONY: linux-coverage +linux-coverage: $(linux_coverage_build_dir)/daisy +# The test suite will most likely fail some cases so we ignore the output + - cd $(linux_coverage_build_dir) && \ + uv venv --allow-existing && \ + uv pip install git+https://github.com/daisy-model/daisypy-test && \ + ctest -j 20 +ifndef has_gcovr + @echo "\ngcovr is not available, no coverage report generated\nInstall gcovr with\n pip install gcovr" +else + cd $(linux_coverage_build_dir) && gcovr -r ../../ . --html ../../test/coverage.html + @echo Coverage report: file://$(current_dir)/test/coverage.html +endif + + +## Linux: Documentation +.PHONY: linux-doc +linux-doc: + cmake -B $(linux_build_dir) --preset linux-gcc-portable -DBUILD_DOC=ON + cmake --build $(linux_build_dir) --target docs + + +# MacOS +## MacOS: Standard build with python support +macos_build_dir=build/macos-clang-portable +.PHONY: macos +macos: uv-python + mkdir -p ${macos_build_dir} && \ + cd ${macos_build_dir} && \ + rm -f daisy-bin && \ + rm -rf _staging && \ + cmake ../../ --preset macos-clang-portable -DUV_INSTALLED_PYTHON_ROOT_DIR=${python_root} && \ + cmake --build . -j ${nproc} && \ + otool -L daisy-bin && \ + otool -L _staging/bin/lib/libsuitesparseconfig.7.dylib && \ cpack +## MacOS: Build without python support +macos_no_python_build_dir=build/macos-clang-portable-no-python +.PHONY: macos-no-python macos-no-python: - mkdir -p build/portable-no-python - cd build/portable-no-python; \ - cmake ../.. --preset macos-clang-portable -DBUILD_PYTHON=OFF; \ - cmake --build . -j 6; \ + mkdir -p ${macos_no_python_build_dir} && \ + cd ${macos_no_python_build_dir} && \ + rm -f daisy-bin && \ + rm -r _staging && \ + cmake ../.. --preset macos-clang-portable -DBUILD_PYTHON=OFF && \ + cmake --build . -j ${nproc} && \ + otool -L daisy-bin && \ + otool -L _staging/bin/lib/libsuitesparseconfig.7.dylib && \ cpack + +## MacOS test. We only use version with python +.PHONY: macos-test +macos-test: macos + cd ${macos_build_dir} && \ + unzip -qo `ls | grep -e "daisy.*Darwin-python.*zip"` && \ + uv venv --allow-existing && \ + uv pip install git+https://github.com/daisy-model/daisypy-test && \ + ctest --output-on-failure diff --git a/README.md b/README.md index 1444a48d0..acf9fc404 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ See [https://daisy.ku.dk/](https://daisy.ku.dk/) for more information. ## Getting started * [MacOS](doc/getting-started-macos.md) * [Windows](doc/getting-started-windows.md) +* [Linux](doc/getting-started-linux.md) ## Building [doc/build-daisy.md](doc/build-daisy.md) diff --git a/cmake/DebianPackaging.cmake b/cmake/DebianPackaging.cmake index 4267ae55c..2c1658ab1 100644 --- a/cmake/DebianPackaging.cmake +++ b/cmake/DebianPackaging.cmake @@ -1,9 +1,7 @@ set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") -set(CPACK_DEBIAN_PACKAGE_DEPENDS - "libsuitesparse-dev, libboost-filesystem-dev, libboost-system-dev" -) +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "ON") ## Find dependencies automatically set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postrm;" ) set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Silas Ørting") -set(CPACK_GENERATOR DEB) +set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB") diff --git a/cmake/MacOS.cmake b/cmake/MacOS.cmake index fbc3a4c47..ba1ec8180 100644 --- a/cmake/MacOS.cmake +++ b/cmake/MacOS.cmake @@ -17,38 +17,24 @@ install(TARGETS ${DAISY_BIN_NAME} COMPONENT runtime ) -if (${BUILD_PYTHON}) - # Install the wrapper script that ensures python is present - install(PROGRAMS # Ensure executable permission - ${CMAKE_CURRENT_SOURCE_DIR}/scripts/run_daisy_macos.sh - DESTINATION ${DAISY_PACKAGE_INSTALL_DIRECTORY}/bin - RENAME daisy - COMPONENT runtime - ) -endif() - # When making an installer we want to be able to redistribute the dylibs and find them. # # Copy dylibs so we can redistribute. First copy to a directory in the build tree. CMake will # handle symlinks. Then install all the files we just copied. # We put them in bin/lib, then we dont need to update the rpath of the shared library files # because they look in @loader_path/../lib, which becomes lib/ +set(_staging_dir "${CMAKE_CURRENT_BINARY_DIR}/_staging") set(_boost_path_prefix "") -set(_dylib_target_dir "${CMAKE_CURRENT_BINARY_DIR}/bin/lib") +set(_dylib_target_dir "${_staging_dir}/bin/lib") file(INSTALL "${HOMEBREW_PREFIX}/lib/libcxsparse.4.dylib" "${HOMEBREW_PREFIX}/lib/libsuitesparseconfig.7.dylib" "${HOMEBREW_PREFIX}/${_boost_path_prefix}lib/libboost_filesystem.dylib" - "${HOMEBREW_PREFIX}/${_boost_path_prefix}lib/libboost_system.dylib" "${HOMEBREW_PREFIX}/${_boost_path_prefix}lib/libboost_atomic.dylib" "${HOMEBREW_PREFIX}/opt/libomp/lib/libomp.dylib" DESTINATION ${_dylib_target_dir} FOLLOW_SYMLINK_CHAIN ) -install(DIRECTORY ${_dylib_target_dir} - DESTINATION ${DAISY_PACKAGE_INSTALL_DIRECTORY}/bin - COMPONENT runtime -) # Update daisy binary so it knows to look in @executable_path for dylibs # First update the rpath. @@ -68,9 +54,7 @@ set(_boost_id_prefix "boost/") set(_dylibs_rel_path "suite-sparse/lib/libcxsparse.4.dylib" "${_boost_id_prefix}lib/libboost_filesystem.dylib" - "${_boost_id_prefix}lib/libboost_system.dylib" "${_boost_id_prefix}lib/libboost_atomic.dylib" - "${_boost_id_prefix}lib/libboost_process.dylib" ) foreach(_dylib_rel_path ${_dylibs_rel_path}) set(_old_lib_id "${HOMEBREW_PREFIX}/opt/${_dylib_rel_path}") @@ -89,7 +73,7 @@ endforeach() # We also need to update the path of libomp in libsuitesparseconfig set(_old_lib_id "${HOMEBREW_PREFIX}/opt/libomp/lib/libomp.dylib") set(_new_lib_id "@rpath/libomp.dylib") -set(_suitesparseconfig "bin/lib/libsuitesparseconfig.7.dylib") +set(_suitesparseconfig "${_dylib_target_dir}/libsuitesparseconfig.7.dylib") message("-- In ${_suitesparseconfig}: Change ${_old_lib_id} -> ${_new_lib_id}") add_custom_command(TARGET ${DAISY_BIN_NAME} POST_BUILD @@ -99,12 +83,34 @@ add_custom_command(TARGET ${DAISY_BIN_NAME} ) if (${BUILD_PYTHON}) - # We also need to update path of python dylib so we can symlink it - # Note that we dont redistribute python. The user have to install python themselves + # We add python version to distribution name, so people can see the version they get set(DAISY_PYTHON_VERSION "${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}") + + # Get the old libpython id and filename set(_old_lib_id "${Python_LIBRARIES}") - cmake_path(GET _old_lib_id FILENAME _python_so_name) - set(_new_lib_id "@rpath/lib/python/lib/${_python_so_name}") + cmake_path(GET _old_lib_id FILENAME _python_dylib_name) + + # Copy python installation to build tree + set(_python_dir "${_staging_dir}/python") + file(COPY ${UV_INSTALLED_PYTHON_ROOT_DIR}/ + DESTINATION ${_python_dir} + PATTERN "EXTERNALLY-MANAGED" EXCLUDE # The environment is no longer uv maintained + PATTERN "include" EXCLUDE # We dont need header files + ) + + # Replace the id of the python dylib to avoid leaking info about build + # Not necesary for running, because we will never link new objects against + # the dylib. + set(_python_dylib_relpath "${_staging_dir}/python/lib/${_python_dylib_name}") + message("-- In ${_python_dylib_relpath}: Change id to ${_python_dylib_name}") + add_custom_command(TARGET ${DAISY_BIN_NAME} + POST_BUILD + COMMAND "install_name_tool" + ARGS "-id" "${_python_dylib_name}" "${_python_dylib_relpath}" + ) + + # Update the python dylib path in daisy binary + set(_new_lib_id "@executable_path/../python/lib/${_python_dylib_name}") message("-- In ${DAISY_BIN_NAME}: Change ${_old_lib_id} -> ${_new_lib_id}") add_custom_command(TARGET ${DAISY_BIN_NAME} POST_BUILD @@ -112,4 +118,28 @@ if (${BUILD_PYTHON}) ARGS "-change" "${_old_lib_id}" "${_new_lib_id}" "${DAISY_BIN_NAME}" ) + + # Install the wrapper script that calls daisy with python + install(PROGRAMS # Ensure executable permission + ${CMAKE_CURRENT_SOURCE_DIR}/scripts/run_daisy_macos.sh + DESTINATION ${DAISY_PACKAGE_INSTALL_DIRECTORY}/bin + RENAME daisy + COMPONENT runtime + ) +else() + # Install the wrapper script that calls daisy without python + install(PROGRAMS # Ensure executable permission + ${CMAKE_CURRENT_SOURCE_DIR}/scripts/run_daisy_macos_no_python.sh + DESTINATION ${DAISY_PACKAGE_INSTALL_DIRECTORY}/bin + RENAME daisy + COMPONENT runtime + ) endif() + + +# Install the staged stuff +install(DIRECTORY ${_staging_dir}/ + DESTINATION ${DAISY_PACKAGE_INSTALL_DIRECTORY} + USE_SOURCE_PERMISSIONS + COMPONENT runtime +) diff --git a/cmake/MacOSPackaging.cmake b/cmake/MacOSPackaging.cmake index 4fd9d2865..14eb74b5b 100644 --- a/cmake/MacOSPackaging.cmake +++ b/cmake/MacOSPackaging.cmake @@ -1,4 +1,7 @@ set(CPACK_GENERATOR "ZIP") if (${BUILD_PYTHON}) set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-python${DAISY_PYTHON_VERSION}") +else() + set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-no-python") endif() +set(DAISY_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) diff --git a/cmake/MinGW.cmake b/cmake/MinGW.cmake index f821a0cf8..584647c3c 100644 --- a/cmake/MinGW.cmake +++ b/cmake/MinGW.cmake @@ -2,6 +2,8 @@ set(DAISY_SAMPLE_DESTINATION "sample") set(DAISY_LIB_DESTINATION "lib") set(DAISY_CORE_NAME core) +set(_staging_dir "${CMAKE_CURRENT_BINARY_DIR}/_staging") + target_include_directories(${DAISY_BIN_NAME} PUBLIC include) # On Windows we build everything except main as a shared library (core) @@ -40,23 +42,20 @@ install(FILES COMPONENT runtime ) -# Also copy stuff to the build dir so we can run daisy from there -file(INSTALL - $ENV{MINGW_PREFIX}/bin/libstdc++-6.dll - $ENV{MINGW_PREFIX}/bin/libwinpthread-1.dll - $ENV{MINGW_PREFIX}/bin/libgcc_s_seh-1.dll - $ENV{MINGW_PREFIX}/bin/libgomp-1.dll - $ENV{MINGW_PREFIX}/bin/libcxsparse.dll - $ENV{MINGW_PREFIX}/bin/libsuitesparseconfig.dll - $ENV{MINGW_PREFIX}/bin/libboost_filesystem-mt.dll - DESTINATION ${CMAKE_CURRENT_BINARY_DIR} -) -file(INSTALL - ${CMAKE_SOURCE_DIR}/sample - DESTINATION ${CMAKE_CURRENT_BINARY_DIR} -) +# We add python version to distribution name, so people can see the version they get +set(DAISY_PYTHON_VERSION "${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}") -file(INSTALL - ${CMAKE_SOURCE_DIR}/lib - DESTINATION ${CMAKE_CURRENT_BINARY_DIR} +# Copy python installation to build tree +set(_python_dir "${_staging_dir}/python") +file(COPY ${UV_INSTALLED_PYTHON_ROOT_DIR}/ + DESTINATION ${_python_dir} + PATTERN "EXTERNALLY-MANAGED" EXCLUDE # The environment is no longer uv maintained + PATTERN "include" EXCLUDE # We dont need header files + PATTERN "Scripts" EXCLUDE + PATTERN "tcl" EXCLUDE + PATTERN "LICENSE" EXCLUDE + PATTERN "BUILD" EXCLUDE + PATTERN "pythonw.exe" EXCLUDE ) +# and install it +install(DIRECTORY ${_python_dir}/ TYPE BIN COMPONENT runtime) diff --git a/cmake/MinGWPackaging.cmake b/cmake/MinGWPackaging.cmake index 269e6d8cb..34ac9cc0b 100644 --- a/cmake/MinGWPackaging.cmake +++ b/cmake/MinGWPackaging.cmake @@ -1,3 +1,5 @@ # Windows package set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) -set(CPACK_GENERATOR NSIS) \ No newline at end of file +set(CPACK_GENERATOR NSIS) +set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-python${DAISY_PYTHON_VERSION}") +set(DAISY_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) diff --git a/cmake/debian/postrm b/cmake/debian/postrm index cce0b95a0..40275f2f0 100644 --- a/cmake/debian/postrm +++ b/cmake/debian/postrm @@ -1,4 +1,4 @@ #!/bin/sh set -e -rm /opt/daisy -exit 0 \ No newline at end of file +rm -f /opt/daisy +exit 0 diff --git a/cmake/python.cmake b/cmake/python.cmake index bce766565..a78dbad9e 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -1,11 +1,4 @@ -if (${OS} STREQUAL "mingw") - # This needs to be set such that it matches the location of the downloaded python distribution - set(Python_ROOT_DIR "${CMAKE_SOURCE_DIR}/python/python") - install(DIRECTORY ${Python_ROOT_DIR}/ TYPE BIN COMPONENT python) - file(INSTALL ${Python_ROOT_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -endif() - -if (${OS} STREQUAL "macos") +if (${OS} STREQUAL "mingw" OR ${OS} STREQUAL "macos") if (NOT DEFINED UV_INSTALLED_PYTHON_ROOT_DIR) message(FATAL_ERROR "You must set UV_INSTALLED_PYTHON_ROOT_DIR to ensure building against specific python version") endif() diff --git a/doc/build-documentation.md b/doc/build-documentation.md index 2df9e3017..d2ef2d573 100644 --- a/doc/build-documentation.md +++ b/doc/build-documentation.md @@ -3,7 +3,7 @@ TODO: Add prerequisites and dependencies Documentation can be built by running - cmake ../../ --preset -DBUILD_DOC=ON cmake --build . --target docs This will generate `exercises.pdf`, `reference.pdf` and `tutorial.pdf` in the directory `doc` under the build directory. diff --git a/doc/build-instructions-linux.md b/doc/build-instructions-linux.md index b7218c415..02248dd13 100644 --- a/doc/build-instructions-linux.md +++ b/doc/build-instructions-linux.md @@ -1,49 +1,70 @@ # Build Daisy on Linux +Daisy can either be built with [CMake](#cmake) or [Flatpak](#flatpak). ## Dependencies Install dependencies * cmake -* boost (filesystem and system) +* boost (filesystem) * suitesparse * g++ * pybind11 Using apt - apt install g++ cmake libsuitesparse-dev libboost-filesystem-dev libboost-system-dev python3-pybind11 + apt install g++ cmake libsuitesparse-dev libboost-filesystem-dev python3-pybind11 -## Build Daisy -[CMakePresets.json](CMakePresets.json) define setups for building with gcc and clang on linux. +### Flatpak dependencies +Install dependencies + +* flatpak +* flatpak-builder + +Using apt -Download the source code and setup a build dir + apt install flatpak flatpak-builder + + +## Build Daisy +Download the source code and change to to repository root directory git clone git@github.com:daisy-model/daisy.git - mkdir -p daisy/build/release - cd daisy/build/release + cd daisy -To build with gcc using release options +### Default build for release +The Makefile defines some convenience targets - cmake ../../ --preset linux-gcc-native - cmake --build . -j - + make debian -### Build for distribution -To build a portable binary for distribution +Will build daisy in `build/linux-gcc-portable` and make a `deb` package. - cmake ../../ --preset linux-gcc-portable - cmake --build . -j + make flatpak -## Make an installer -To build .deb package +Will build daisy in `./flatpak` and make a `flatpak` package. Note that this will take some time on first run because dependencies have to be downloaded and built. The flatpak build is controlled from `flatpak/dk.ku.daisy.yml`. - cpack -G DEB -To build a generic linux installer + make linux - cpack -G STGZ +Will build both `deb` and `flatpak` packages. -For the generic linux installer it is necesary to set the environment variable `DAISYHOME` to the install directory. For example, if daisy was installed in `/home/user-name/daisy`, you would do - export DAISYHOME=/home/user-name/daisy + make linux-test + +Will run the test suite. + + + make linux-coverage + +Will make a build for coverage analysis, run the test suite and, if `gcovr` is installed, create a coverage report in html format. + +### Non-standard builds +[CMakePresets.json](CMakePresets.json) define setups for various builds using gcc or clang. For example, to build a native optimized version using clang + + mkdir -p build/linux-clang-native + cd build/linux-clang-native + cmake ../../ --preset linux-clang-native + cmake --build . -j - + +To see a list of presets -TODO: Need to figure out static linking vs specifying depends in the package. The deb package and similar should probably be dynamically linked with depends, and the generic installer should probably be statically linked. + cmake --list-presets diff --git a/doc/build-instructions-macos.md b/doc/build-instructions-macos.md index 9b93b49ad..cfe9402cd 100644 --- a/doc/build-instructions-macos.md +++ b/doc/build-instructions-macos.md @@ -1,6 +1,4 @@ # Build Daisy on MacOS -The guide assumes that Daisy is built with Python support. If this is not the case, then ignore all the python related things. - ## Prerequisites * [brew](https://brew.sh) @@ -14,60 +12,35 @@ Install dependencies with brew Install python with uv - uv install python 3.13 - -Find the path to the installed python. - - uv python list - -Should produce something similar to - -```{bash} -cpython-3.15.0a2-macos-x86_64-none -... -cpython-3.13.11-macos-x86_64-none /Users//.local/share/uv/python/cpython-3.13.11-macos-x86_64-none/bin/python3.13 -... -``` - -Record the path to your python 3.13 install. We will refer to this as `` in the following - + uv python install 3.13 ## Build Daisy - -Download the source code and setup a build dir +Download the source code and change to to repository root directory git clone git@github.com:daisy-model/daisy.git - mkdir -p daisy/build/portable - cd daisy/build/portable - -Configure with cmake. Remember to substitute your `` - - cmake ../.. --preset macos-clang-portable -DUV_INSTALLED_PYTHON_ROOT_DIR= + cd daisy -If everything went well, build with cmake +### Default build for release +The Makefile defines some convenience targets - cmake --build . -j + make macos -Check that dynamic library paths have been updated to relative paths +Will build daisy in `build/macos-clang-portable` and make a zip archive. - otool -L ./daisy -Should yield something similar to + make macos-no-python -```{bash} -daisy: - @rpath/lib/libcxsparse.4.dylib (compatibility version 4.0.0, current version 4.4.1) - @rpath/lib/libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0) - @rpath/lib/python/lib/libpython3.13.dylib (compatibility version 3.13.0, current version 3.13.0)x - @rpath/lib/libboost_atomic.dylib (compatibility version 0.0.0, current version 0.0.0) - @rpath/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0) - /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1900.180.0) - /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1351.0.0) -``` +Will build a version of daisy without python support in `build/macos-clang-portable-no-python` and make a zip archive. -The cxsparse, boost and python libraries should start with `@rpath`. If not then you need to update cmake/MacOS.cmake and rerun both cmake steps. +### Non-standard builds +[CMakePresets.json](CMakePresets.json) define setups for various builds using gcc or clang. For example, to build a native optimized version using gcc + mkdir -p build/macos-gcc-native + cd build/macos-gcc-native + cmake ../../ --preset macos-gcc-native + cmake --build . -j `nproc` + cpack -G ZIP -## Make an installer +To see a list of presets - cpack + cmake --list-presets diff --git a/doc/build-instructions-windows.md b/doc/build-instructions-windows.md index 45ca487ae..b6ac902aa 100644 --- a/doc/build-instructions-windows.md +++ b/doc/build-instructions-windows.md @@ -1,54 +1,65 @@ # Build Daisy on Windows +The [Makefile](../Makefile) provides convenience targets for building, packing and testing. + ## Prerequisites * [MSYS2](https://www.msys2.org/). +All commands below are executed from an MSYS2 shell. + ## Dependencies Install build environment - pacman -S git mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-ninja unzip + pacman -S git mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-nsis unzip make Install daisy dependencies - pacman -S mingw-w64-ucrt-x86_64-suitesparse mingw-w64-ucrt-x86_64-boost mingw-w64-ucrt-x86_64-pybind11 mingw-w64-ucrt-x86_64-python + pacman -S mingw-w64-ucrt-x86_64-suitesparse mingw-w64-ucrt-x86_64-boost mingw-w64-ucrt-x86_64-pybind11 mingw-w64-ucrt-x86_64-uv -Download a python distribution from https://www.python.org/downloads/windows/ and unpack to `daisy/python/python`. For example, +Install python with uv -```{bash} -wget https://www.python.org/ftp/python/3.12.10/python-3.12.10-embed-amd64.zip -O python/python.zip -unzip python/python.zip -d python/python -``` + uv python install 3.13 -At time of writing, it was not possible to use the latest python (3.13.2) because the development module was not found. Version 3.12.10 works fine. +## Build Daisy +Download the source code -For some reason Daisy ends up looking for `libpython3.12.dll`, but the embeddable python distribution contains `python312.dll`. A workaround for now is to make a copy of `python312.dll` called `libpython3.12.dll` and place it in the `daisy/python/python` directory. We cannot just rename, because "Find_Python" looks for "python312.dll`. + git clone git@github.com:daisy-model/daisy.git + cd daisy -## Build Daisy +### Default build for release +The Makefile defines some convenience targets -Download the source code and setup a build dir + make windows-nsis - git clone git@github.com:daisy-model/daisy.git - mkdir -p daisy/build/portable - cd daisy/build/portable +Will build daisy in `build/mingw-gcc-portable` and make an installer. + + + make windows-zip +Will build daisy in `build/mingw-gcc-portable` and make a zip archive. -Convifure with cmake - cmake ../../ --preset mingw-gcc-portable + make windows +Will build both installer and zip archive. -## Make an installer -Install dependencies - pacman -S mingw-w64-ucrt-x86_64-nsis + make windows-test -Make the installer +Will build the zip archive and run the test suite. - cpack -Make a zip file that does not require installation +### Non-standard builds +[CMakePresets.json](CMakePresets.json) define setups for various builds using gcc or clang. For example, to build a native optimized version using clang + mkdir -p build/mingw-clang-native + cmake . -B build/mingw-clang-native --preset mingw-clang-native -DUV_INSTALLED_PYTHON_ROOT_DIR=$( scripts/find_python_root_dir.sh 3.13 ) + cmake --build build/mingw-clang-native + cd build/mingw-clang-native cpack -G ZIP -´ + +To see a list of presets + + cmake --list-presets diff --git a/doc/code-coverage.md b/doc/code-coverage.md deleted file mode 100644 index 310caee15..000000000 --- a/doc/code-coverage.md +++ /dev/null @@ -1,16 +0,0 @@ -# Code coverage -To get code coverage you need to set the build type to `Coverage`. This will disable some optimizations. -There is a coverage preset defined for gcc. - - git clone git@github.com:daisy-model/daisy.git - mkdir -p daisy/build/coverage - cd daisy/build/coverage - cmake ../.. --preset linux-gcc-coverage - make -j 8 - ctest - -Use https://gcovr.com/en/stable/ to summarize coverage - - pip install gcovr - cd - gcovr -r ../../ . --html ../../test/coverage.html diff --git a/doc/getting-started-linux.md b/doc/getting-started-linux.md new file mode 100644 index 000000000..5aa5a0ab9 --- /dev/null +++ b/doc/getting-started-linux.md @@ -0,0 +1,87 @@ +# Getting started on Linux +Download the latest release of Daisy from [https://github.com/daisy-model/daisy/releases/latest](https://github.com/daisy-model/daisy/releases/latest). + +We provide the following packages + - `deb` + - `flatpak` + +## Install `deb` package +Assuming you have downloaded `daisy_7.1.3_amd64.deb` to the current working directory +``` +# apt install ./daisy_7.1.3._amd64.deb +``` +You should now be able to run Daisy +``` +$ daisy -v +Daisy crop/soil simulation version 7.1.3. (Dec 11 2025) +Copyright 1996 - 2016 Per Abrahamsen, Søren Hansen and KU. +Storing 'daisy.log' in ... +``` + +## Install `flatpak` package +Follow instructions from https://flatpak.org/ to setup flatpak. + +Assuming you have downloaded `daisy-7.1.3.flatpak` to the current working directory +``` +flatpak install --user daisy-7.1.3.flatpak +``` +It requires +- network permissions to enable installing additional python packages into the environment using pip +- access to home to read input and write output + +You should now be able to run Daisy +``` +$ flatpak run dk.ku.daisy --info +Installing lib and sample +Daisy crop/soil simulation version 7.1.3. (Dec 17 2025) +Python 3.13.9 +``` + +You can create a convenience script that calls daisy through flatpak. Assuming `~/.local/bin` is on your path +``` +printf "#%s/bin/sh\nflatpak run dk.ku.daisy \$@\n" "!" > ~/.local/bin/daisy && chmod +x ~/.local/bin/daisy +``` + +You should now be able to run Daisy +``` +$ daisy --info +Daisy crop/soil simulation version 7.1.3. (Dec 17 2025) +Python 3.13.9 +``` + +The following assumes you have created this convenience script. + +## Managing Daisy's python environment +Daisy can be extended with functions implemented in python. + +### deb package +If you installed the `deb` package Daisy will use your environment's python and you should refer to the documentation for your environment for how to manage it. + +### flatpak package +If you installed the `flatpak` package, then Daisy comes with a python environment. If you need to run Daisy's python interpreter, for example to debug scripts, you can start it using +``` +daisy --python +``` + +You can install additional packages by passing `--pip` to daisy. To install `numpy` +``` +daisy --pip install numpy +``` + +Anything after `--pip` is passed to `pip`, so to upgrade `numpy` +``` +daisy --pip install --upgrade numpy +``` + +To uninstall `numpy` +``` +daisy --pip uninstall numpy +``` + +If you want to inspect the python environment it *should* be stored under `~/.var/app/dk.ku.daisy/data/python/lib/` but it might change depending on flatpak. + + +## Setting up an environment for running Daisy +You can run Daisy from the commandline, but we recommend that you use an editor like [VSCode](https://code.visualstudio.com). See [instructions for setting up VSCode](setup-vscode.md). + +Once you have set up an editor you can try [running your first daisy program](running-your-first-daisy-program.md). diff --git a/doc/getting-started-macos.md b/doc/getting-started-macos.md index b617490aa..390376743 100644 --- a/doc/getting-started-macos.md +++ b/doc/getting-started-macos.md @@ -1,43 +1,50 @@ # Getting started on MacOS -Download the latest release of Daisy from [https://github.com/daisy-model/daisy/releases/latest](https://github.com/daisy-model/daisy/releases/latest). Note that there are two versions, the standard version that includes python support and a version without python support. Pick the latter if you do not want python support and want to avoid installing a python runtime on your machine. +Download the latest release of Daisy from [https://github.com/daisy-model/daisy/releases/latest](https://github.com/daisy-model/daisy/releases/latest). Note that there are two versions, the standard version that includes python support and a version without python support. Pick the latter if you do not want python support. Unzip the archive you just downloaded and place it somewhere you can remember. In the following we will refer to this location as ``. +## Test that it works +Open a terminal and execute the following, remember to replace `` with the path from above +``` +cd /Daisy +bin/daisy --version +``` +that should display something similar to -## Setup Python on MacOS -To use python with Daisy on MacOS it is necesary to install python manually. There are several options for installing python on MacOS. We recommend you use the package manager `uv` to manage your python installation. See [instructions for installing python with uv](install-python-with-uv.md). The requried python version can be seen from the installer name, e.g. `daisy-7.1.3-Darwin-python3.13.pkg` requires python 3.13. +``` +Daisy % bin/daisy --info +Daisy crop/soil simulation version 7.1.3. (Dec 15 2025) +Python 3.13.11 +Sample dir: +``` +where `` will be a directory containing sample files illustrating the use of Daisy. -The first time you run Daisy you will be prompted for the path to your python installation, like this +## Managing Daisy's python environment +Daisy comes with a python environment that allows you to extend Daisy with functions implemented in python. If you need to run Daisy's python interpreter, for example to debug scripts, you can start it using +``` +daisy --python +``` - Please provide path to python root directory: +You can install additional packages into the environment by calling daisy with `--pip`. To install `numpy` +``` +daisy --pip install numpy +``` -You should then enter the full path. If you have used `uv` to install python 3.13 it might look like +Anything after `--pip` is passed to `pip`, so to upgrade `numpy` +``` +daisy --pip install --upgrade numpy +``` - /Users/user-name/.local/share/uv/python/cpython-3.13.11-macos-x86_64-none +To uninstall `numpy` +``` +daisy --pip uninstall numpy +``` + +If you want to inspect the python environment it is stored under `/Daisy/python`. -where `user-name` is your user name. ## Setting up an environment for running Daisy You can run Daisy from the commandline, but we recommend that you use an editor like [VSCode](https://code.visualstudio.com). See [instructions for setting up VSCode](setup-vscode.md). - -## Running your first Daisy program -Several sample programs are included in the Daisy distribution. These are located in the folder `sample` under ``. - -1. Create a new folder named `daisy` on your Desktop -2. Copy the file `test.dai` from the `sample` folder to the newly created `daisy` folder -3. Open the `test.dai` file from the `daisy` folder in your editor -4. Run the `test.dai` file. This should produce the following files in the `daisy` folder - - `checkpoint-1987-8-7+6.dai`. - the state of the simulation. Can be used to hot start the simulation. - - `daisy.log` - Log of the simulation that was just run - - `field_nitrogen.dlf` - - `field_water.dlf` - - `harvest.dlf` - - `sbarley.dlf` - - `soil_nitrogen.dlf` - - `soil_water.dlf` - -The `.dlf` files are the output of the simulation. These are tab separated files with a custom header that can be read into spreadsheet applications or with you favorite programming language. We recommend using RStudio with the [daisyrVis](https://github.com/daisy-model/daisyrVis) package or Python with the [daispy-vis](https://github.com/daisy-model/daisypy-vis) package. +Once you have set up an editor you can try [running your first daisy program](running-your-first-daisy-program.md). diff --git a/doc/running-your-first-daisy-program.md b/doc/running-your-first-daisy-program.md new file mode 100644 index 000000000..e514c81ba --- /dev/null +++ b/doc/running-your-first-daisy-program.md @@ -0,0 +1,36 @@ +# Running your first Daisy program +Several sample programs are included in the Daisy distribution. These are located in the directory `sample` in the directory where you installed Daisy. + +1. Create a new folder named `daisy` on your Desktop +2. Copy the file `test.dai` from the `sample` folder to the newly created `daisy` folder +3. Open the `test.dai` file from the `daisy` folder in your editor +4. Run the `test.dai` file. This should produce the following files in the `daisy` folder + - `checkpoint-1987-8-7+6.dai`. + the state of the simulation. Can be used to hot start the simulation. + - `daisy.log` + Log of the simulation that was just run + - `field_nitrogen.dlf` + - `field_water.dlf` + - `harvest.dlf` + - `sbarley.dlf` + - `soil_nitrogen.dlf` + - `soil_water.dlf` + +The `.dlf` files are the output of the simulation. These are tab separated files with a custom header that can be read into spreadsheet applications or with you favorite programming language. We recommend using RStudio with the [daisyrVis](https://github.com/daisy-model/daisyrVis) package or Python with the [daispy-vis](https://github.com/daisy-model/daisypy-vis) package. + + +## Running your first spawn program +Daisy has builtin support for simulating multiple scenarios in parallel using the spawn program . To test it + +1. Create a new folder named `daisy` on your Desktop +2. Copy the file `test-spawn.dai` from the `sample` folder to the newly created `daisy` folder +3. Open the `test-spawn.dai` file from the `daisy` folder in your editor +4. Run the `test-spawn.dai` file. Depending on you hardware, this might take some time. Once it is done you should see the following directories, each containing the output from a single scenario. +``` +N-A-P N-F-S N-J-W W-F-P W-J-S +N-A-S N-F-W W-A-P W-F-S W-J-W +N-A-W N-J-P W-A-S W-F-W +N-F-P N-J-S W-A-W W-J-P +``` + +See more info on [spawn usage](spawn-usage.md) for how to control the `spawn` program. diff --git a/doc/setup-vscode.md b/doc/setup-vscode.md index b523dfcf7..ac5d265c6 100644 --- a/doc/setup-vscode.md +++ b/doc/setup-vscode.md @@ -21,6 +21,13 @@ Download and install VSCode from https://code.visualstudio.com/ ## Install Daisy extension Follow the instructions at https://marketplace.visualstudio.com/items?itemName=daisy-model.daisy +## Running Daisy with flatpak +flatpak cannot find user installed packages when run from VSCode. To solve this, you must add +``` +"Daisy.env" : { "XDG_DATA_HOME": "" } +``` +to your `settings.json` file. + ### Basic usage 1. Open the `sample.dai` file from the `sample` directory in your Daisy installation. diff --git a/flatpak/.gitignore b/flatpak/.gitignore new file mode 100644 index 000000000..a2a75c1b0 --- /dev/null +++ b/flatpak/.gitignore @@ -0,0 +1,4 @@ +build +repo +.flatpak-builder +*.flatpak diff --git a/flatpak/dk.ku.daisy.yml b/flatpak/dk.ku.daisy.yml new file mode 100644 index 000000000..bd60f2fa7 --- /dev/null +++ b/flatpak/dk.ku.daisy.yml @@ -0,0 +1,85 @@ +id: dk.ku.daisy +runtime: org.freedesktop.Platform +runtime-version: '25.08' +sdk: org.freedesktop.Sdk +command: start-daisy.sh +modules: + - name: pybind11 + buildsystem: cmake + config-opts: + - -DPYBIND11_TEST=OFF + cleanup: + - '*' + sources: + - type: archive + url: https://github.com/pybind/pybind11/archive/refs/tags/v3.0.1.tar.gz + sha256: 741633da746b7c738bb71f1854f957b9da660bcd2dce68d71949037f0969d0ca + x-checker-data: + type: anitya + project-id: 13384 + stable-only: true + url-template: https://github.com/pybind/pybind11/archive/refs/tags/v${major}.${minor}.${patch}.tar.gz + + - name: Boost + buildsystem: simple + build-commands: + - ./bootstrap.sh --prefix=/app --with-libraries=filesystem,system + - ./b2 install link=static runtime-link=static cxxflags="-fPIC" -j $FLATPAK_BUILDER_N_JOBS + cleanup: + - '*' + sources: + - type: archive + url: https://archives.boost.io/release/1.90.0/source/boost_1_90_0.tar.bz2 + sha256: 49551aff3b22cbc5c5a9ed3dbc92f0e23ea50a0f7325b0d198b705e8ee3fc305 + x-checker-data: + type: anitya + project-id: 6845 + stable-only: true + url-template: https://archives.boost.io/release/$version/source/boost_${major}_${minor}_${patch}.tar.bz2 + + - name: openblas + buildsystem: autotools + no-autogen: true + make-install-args: + - PREFIX=/app + cleanup: + - '*' + sources: + - type: git + url: https://github.com/OpenMathLib/OpenBLAS.git + tag: v0.3.30 + + - name: cxsparse + buildsystem: cmake + config-opts: + - -DSUITESPARSE_ENABLE_PROJECTS=cxsparse;suitesparse_config + - -DBUILD_SHARED_LIBS=ON # Cant get it to work with static linkage against cxsparse + - -DBUILD_STATIC_LIBS=OFF + cleanup: + - '/include' + sources: + - type: git + url: https://github.com/DrTimothyAldenDavis/SuiteSparse.git + tag: v7.12.1 + + - name: daisy + buildsystem: cmake + config-opts: + - --preset linux-gcc-portable + - -DBoost_USE_STATIC_RUNTIME=ON + sources: + - type: git + url: https://github.com/daisy-model/daisy.git + branch: main + + - name: launcher + buildsystem: simple + build-commands: + - install -Dm755 start-daisy.sh /app/bin/start-daisy.sh + sources: + - type: file + path: start-daisy.sh + +finish-args: + - --filesystem=home + - --share=network # To enable pip install through start_daisy.sh diff --git a/flatpak/start-daisy.sh b/flatpak/start-daisy.sh new file mode 100755 index 000000000..1cac79742 --- /dev/null +++ b/flatpak/start-daisy.sh @@ -0,0 +1,44 @@ +#!/bin/bash +APP_ID="dk.ku.daisy" +DATA_DIR="${XDG_DATA_HOME}" # Flatpak always sets XDG_DATA_HOME + +# Create user data dir if missing +mkdir -p "$DATA_DIR" + +# Copy bundled defaults if not already present +if [ ! -d "$DATA_DIR/lib" ] || [ ! -d "$DATA_DIR/sample" ]; then + echo "Installing lib and sample" + cp -r /app/share/daisy/lib "$DATA_DIR" + cp -r /app/share/daisy/sample "$DATA_DIR" +fi + +if [[ "$1" == "--info" ]]; then + # Print Daisy and python info + DAISYHOME="$DATA_DIR" /app/bin/daisy -v 2>&1 | head -n 1 && rm daisy.log + python --version + echo "Sample dir: $DATA_DIR/sample" + +elif [[ "$1" == "--pip" ]]; then + # Manage python environment + python -m ensurepip + if [ $# -ge 2 ]; then + exec python -m pip "${@:2}" + fi + +elif [[ "$1" == "--python" ]]; then + # Run python interpreter + exec python "${@:2}" + +else + # Run Daisy + # First ensure paths are absolute + params=() + for arg in "$@"; do + if [ -f "$arg" ]; then + params+=($(realpath "$arg")) + else + params+=("$arg") + fi + done + DAISYHOME="$DATA_DIR" exec /app/bin/daisy "${params[@]}" +fi diff --git a/scripts/find_macos_package_archive.sh b/scripts/find_macos_package_archive.sh new file mode 100755 index 000000000..b3699b1f0 --- /dev/null +++ b/scripts/find_macos_package_archive.sh @@ -0,0 +1,4 @@ +#!/bin/sh +echo `ls | grep -e "daisy.*Darwin-python.*zip"` + + diff --git a/scripts/find_python_root_dir.sh b/scripts/find_python_root_dir.sh new file mode 100755 index 000000000..6ce90c63e --- /dev/null +++ b/scripts/find_python_root_dir.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [[ "$#" -ne 1 ]]; then + version=3.13 +else + version="$1" +fi +echo $( ls -d $( uv python dir | tr \\\\ / )/* | grep $version | sort -V | tail -n1 ) diff --git a/scripts/find_windows_package_archive.sh b/scripts/find_windows_package_archive.sh new file mode 100644 index 000000000..c5a45feb6 --- /dev/null +++ b/scripts/find_windows_package_archive.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo `ls | grep -e "daisy-.*-Windows-python3.*zip"` diff --git a/scripts/get_version_from_cmake.sh b/scripts/get_version_from_cmake.sh new file mode 100755 index 000000000..daf9c8978 --- /dev/null +++ b/scripts/get_version_from_cmake.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo `grep -E '^[[:blank:]]+VERSION' CMakeLists.txt | grep -Eo '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+'` diff --git a/scripts/run_dai_system_test.sh b/scripts/run_dai_system_test.sh new file mode 100755 index 000000000..4ee241018 --- /dev/null +++ b/scripts/run_dai_system_test.sh @@ -0,0 +1,2 @@ +#!/bin/sh +uv run test_daisy "$@" diff --git a/scripts/run_dai_unit_test.sh b/scripts/run_dai_unit_test.sh new file mode 100755 index 000000000..267c182f6 --- /dev/null +++ b/scripts/run_dai_unit_test.sh @@ -0,0 +1,2 @@ +#!/bin/sh +uv run check_daisy "$@" diff --git a/scripts/run_daisy_macos.sh b/scripts/run_daisy_macos.sh index 32b4db5c5..a74062fcb 100755 --- a/scripts/run_daisy_macos.sh +++ b/scripts/run_daisy_macos.sh @@ -1,29 +1,39 @@ -#!/bin/sh -# Run Daisy with PYTHONHOME set -# This requries that there is a symlink in /bin/lib/python to a python installation -# If it is not present, then we prompt the user for a path -# Once we have the path we create the symlink and then run daisy - -reldir=$(dirname -- "${BASH_SOURCE[0]}") +#!/bin/zsh +# Run Daisy with PYTHONHOME and DAISYHOME set +reldir=$(dirname -- "$0") absdir=$(cd -- "$reldir" && pwd) -daisy="$absdir"/daisy-bin -libdir=lib +sampledir=$(cd -- "$reldir/../sample" && pwd) +daisy="$absdir/daisy-bin" +pythonhome="$absdir/../python" -# This script is intended for use with an installed daisy -# If you want to run daisy directly from the build directory, you should uncomment the following line -# libdir=bin/lib +# Check if user already set DAISYHOME, otherwise set it relative to the script +if [[ -v DAISYHOME ]]; then + daisyhome="$DAISYHOME" +else + daisyhome="$absdir/.." +fi -pythonhome="$absdir"/"$libdir"/python +if [[ "$1" == "--info" ]]; then + # Print Daisy and python info + PYTHONHOME="$pythonhome" "$daisy" -v 2>&1 | head -n 1 && rm daisy.log + "$absdir"/python --version + echo "Sample dir: $sampledir" -while [[ ! -f "$pythonhome"/bin/python ]] -do - read -e -p "Please provide path to python root directory: " python_dir - if [[ -f "$python_dir/bin/python" && -d "$python_dir/lib" ]] - then - cd ${absdir}/"$libdir" && rm -f python && ln -s ${python_dir} python - cd ${absdir} - else - echo "Could not locate python binary and/or library" +elif [[ "$1" == "--pip" ]]; then + # Manage python environment + "$absdir/python" -m ensurepip + if [ $# -ge 2 ]; then + if [[ "$2" == "install" ]]; then + exec "$absdir/python" -m pip "${@:2}" --no-warn-script-location + else + exec "$absdir/python" -m pip "${@:2}" + fi fi -done -PYTHONHOME="$pythonhome" "$daisy" "$@" + +elif [[ "$1" == "--python" ]]; then + # Run the python interpreter + exec "$absdir/python" "${@:2}" + +else + PYTHONHOME="$pythonhome" DAISYHOME="$daisyhome" exec "$daisy" "$@" +fi diff --git a/scripts/run_daisy_macos_no_python.sh b/scripts/run_daisy_macos_no_python.sh new file mode 100644 index 000000000..364ff6edd --- /dev/null +++ b/scripts/run_daisy_macos_no_python.sh @@ -0,0 +1,21 @@ +#!/bin/zsh +# Run Daisy with DAISYHOME set +reldir=$(dirname -- "$0") +absdir=$(cd -- "$reldir" && pwd) +sampledir=$(cd -- "$reldir/../sample" && pwd) +daisy="$absdir/daisy-bin" + +# Check if user already set DAISYHOME, otherwise set it relative to the script +if [[ -v DAISYHOME ]]; then + daisyhome="$DAISYHOME" +else + daisyhome="$absdir/.." +fi + +if [[ "$1" == "--info" ]]; then + "$daisy" -v 2>&1 | head -n 1 && rm daisy.log + echo "No python" + echo "Sample dir: $sampledir" +else + DAISYHOME="$daisyhome" exec "$daisy" "$@" +fi diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5e9c74d77..f628c662e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,10 @@ +if (${OS} STREQUAL "macos") + set(_daisy_test_exe "${CMAKE_BINARY_DIR}/${DAISY_PACKAGE_FILE_NAME}/Daisy/bin/daisy") +elseif(${OS} STREQUAL "mingw") + set(_daisy_test_exe "${CMAKE_BINARY_DIR}/${DAISY_PACKAGE_FILE_NAME}/bin/daisy") +else() + set(_daisy_test_exe "${CMAKE_BINARY_DIR}/daisy") +endif() add_subdirectory(cxx-unit-tests) add_subdirectory(dai-unit-tests) add_subdirectory(dai-system-tests) diff --git a/test/dai-system-tests/CMakeLists.txt b/test/dai-system-tests/CMakeLists.txt index 4bdaed7d9..3c5f0386b 100644 --- a/test/dai-system-tests/CMakeLists.txt +++ b/test/dai-system-tests/CMakeLists.txt @@ -1,19 +1,40 @@ -function(dai_system_test name dir) - add_test(NAME dai_system_test.${dir}.${name} - COMMAND - test_daisy - ${CMAKE_BINARY_DIR}/daisy - ${CMAKE_SOURCE_DIR}/test/dai-system-tests/tests/${dir}/test-${name}.dai - ${CMAKE_SOURCE_DIR}/test/dai-system-tests/baseline/${dir}/${name} - ${CMAKE_SOURCE_DIR}/test/dai-system-tests/errors/${dir}/${name} - --path ${CMAKE_SOURCE_DIR}/test/dai-system-tests/tests/common - ) - set_tests_properties( - dai_system_test.${dir}.${name} - PROPERTIES - ENVIRONMENT_MODIFICATION - "DAISYHOME=set:${CMAKE_SOURCE_DIR};PYTHONPATH=string_prepend:${CMAKE_SOURCE_DIR}/sample/python" - ) -endfunction() +if(${OS} STREQUAL "mingw") + function(dai_system_test name dir) + add_test(NAME dai_system_test.${dir}.${name} + COMMAND + C:/msys64/usr/bin/bash.exe + ${CMAKE_SOURCE_DIR}/scripts/run_dai_system_test.sh + ${_daisy_test_exe} + ${CMAKE_SOURCE_DIR}/test/dai-system-tests/tests/${dir}/test-${name}.dai + ${CMAKE_SOURCE_DIR}/test/dai-system-tests/baseline/${dir}/${name} + ${CMAKE_SOURCE_DIR}/test/dai-system-tests/errors/${dir}/${name} + --path ${CMAKE_SOURCE_DIR}/test/dai-system-tests/tests/common + ) + set_tests_properties( + dai_system_test.${dir}.${name} + PROPERTIES + ENVIRONMENT_MODIFICATION + "DAISYHOME=set:${CMAKE_SOURCE_DIR};PYTHONPATH=string_prepend:${CMAKE_SOURCE_DIR}/sample/python" + ) + endfunction() +else() + function(dai_system_test name dir) + add_test(NAME dai_system_test.${dir}.${name} + COMMAND + ${CMAKE_SOURCE_DIR}/scripts/run_dai_system_test.sh + ${_daisy_test_exe} + ${CMAKE_SOURCE_DIR}/test/dai-system-tests/tests/${dir}/test-${name}.dai + ${CMAKE_SOURCE_DIR}/test/dai-system-tests/baseline/${dir}/${name} + ${CMAKE_SOURCE_DIR}/test/dai-system-tests/errors/${dir}/${name} + --path ${CMAKE_SOURCE_DIR}/test/dai-system-tests/tests/common + ) + set_tests_properties( + dai_system_test.${dir}.${name} + PROPERTIES + ENVIRONMENT_MODIFICATION + "DAISYHOME=set:${CMAKE_SOURCE_DIR};PYTHONPATH=string_prepend:${CMAKE_SOURCE_DIR}/sample/python" + ) + endfunction() +endif() add_subdirectory(tests) diff --git a/test/dai-system-tests/baseline/lib/colloid-tracer/content_Tracer.dlf b/test/dai-system-tests/baseline/lib/colloid-tracer/content_Tracer.dlf index e27b10605..1de296ac4 100644 --- a/test/dai-system-tests/baseline/lib/colloid-tracer/content_Tracer.dlf +++ b/test/dai-system-tests/baseline/lib/colloid-tracer/content_Tracer.dlf @@ -1,8 +1,8 @@ dlf-0.0 -- Chemical Content (defined in 'log.dai'). -VERSION: 7.0.13 +VERSION: 7.1.3 LOGFILE: content_Tracer.dlf -RUN: Tue Jun 3 14:08:49 2025 +RUN: Mon Jan 5 11:36:59 2026 COLUMN: * CHEMICAL: Tracer @@ -15,17 +15,17 @@ SIM: Test colloid tracer -------------------- year month mday hour M @ -1.25 M @ -3.75 M @ -7.5 M @ -14 M @ -22.5 M @ -30.5 M @ -38 M @ -45.5 M @ -53 M @ -60.5 M @ -68 M @ -76 M @ -84 M @ -92 M @ -100 M @ -108 M @ -116 M @ -124 M @ -132 M @ -140 M @ -148 M @ -156 M @ -164 M @ -172 M @ -180 M @ -188 M @ -196.5 M @ -205 M @ -213 M @ -221 M @ -229 M @ -237 M @ -245.5 - ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil + ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 1986 12 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1987 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1987 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1987 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1987 4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1987 5 1 0 0.425539 0.32387 0.245922 0.198638 0.125513 0.0603018 0.021239 0.00705645 0.00182972 0.00041393 6.5138e-05 7.10857e-06 5.79253e-07 3.89489e-08 2.33192e-09 1.37556e-10 8.60902e-12 5.79282e-13 4.05929e-14 2.85854e-15 1.98031e-16 1.33743e-17 8.78062e-19 5.60145e-20 3.47248e-21 2.09551e-22 1.06512e-23 5.84791e-25 3.22717e-26 1.72903e-27 8.99485e-29 4.55187e-30 1.98386e-31 -1987 6 1 0 0.233775 0.201676 0.183734 0.178917 0.164555 0.117807 0.0606474 0.0269079 0.00941685 0.00305381 0.000868945 0.000231381 6.43816e-05 1.7424e-05 4.38636e-06 1.0183e-06 2.18038e-07 4.31794e-08 7.93477e-09 1.3573e-09 2.16743e-10 3.23934e-11 4.54165e-12 5.98603e-13 7.43199e-14 8.73253e-15 8.49226e-16 8.62059e-17 8.58738e-18 8.13892e-19 7.35751e-20 6.37622e-21 4.80114e-22 -1987 7 1 0 0.0553758 0.0598934 0.0754483 0.103458 0.133233 0.146539 0.132048 0.103194 0.0690653 0.041695 0.0213634 0.00915796 0.00355394 0.00120163 0.000343255 8.39909e-05 1.80265e-05 3.50959e-06 6.46855e-07 1.17717e-07 2.17183e-08 4.08407e-09 7.76958e-10 1.47894e-10 2.78778e-11 5.17738e-12 8.32657e-13 1.4136e-13 2.4046e-14 3.96185e-15 6.31921e-16 9.79669e-17 1.39076e-17 -1987 8 1 0 0.0184578 0.0214358 0.0248348 0.0352596 0.0545988 0.0749624 0.0877456 0.0900467 0.0827055 0.0684719 0.0513202 0.0359027 0.0289968 0.0259612 0.0239832 0.0224619 0.0213616 0.0205899 0.0198913 0.0188254 0.0168675 0.0138235 0.0101705 0.00669821 0.00397154 0.00213997 0.000991784 0.000443856 0.000187837 7.454e-05 2.7871e-05 9.90343e-06 3.32334e-06 -1987 9 1 0 0.0160866 0.017299 0.0186697 0.0245845 0.0353727 0.049593 0.0626267 0.0714685 0.0754679 0.0728641 0.0649356 0.0519711 0.0423624 0.035096 0.0299525 0.0265527 0.0243145 0.0227473 0.0214811 0.0202059 0.0186529 0.016658 0.0142381 0.011569 0.00889912 0.00646163 0.00428357 0.00273257 0.00166831 0.000966991 0.000534244 0.00028524 0.000153234 -1987 10 1 0 0.00862045 0.00933597 0.0117354 0.0171359 0.0260382 0.0371849 0.0477448 0.0570629 0.0645581 0.0678443 0.066807 0.0586226 0.0510169 0.0440167 0.037695 0.0325864 0.0287338 0.0259113 0.0237902 0.0220298 0.0203229 0.0184626 0.0164032 0.0141707 0.0118328 0.00949866 0.00715416 0.00521513 0.00366897 0.00247231 0.00160078 0.0010114 0.000653333 -1987 11 1 0 0.015536 0.0140857 0.0141228 0.0173026 0.0235769 0.0323632 0.0412766 0.0488409 0.0548556 0.0579125 0.0579844 0.0536709 0.0507456 0.0462507 0.041289 0.03651 0.0323072 0.0288212 0.0260042 0.0236978 0.0217026 0.019833 0.017953 0.0159912 0.0139368 0.0118262 0.00959419 0.00758857 0.00584182 0.00434606 0.00313435 0.00222666 0.00162873 -1987 12 1 0 0.00445911 0.00540709 0.00716851 0.0113691 0.018016 0.0257134 0.0327013 0.0396966 0.046877 0.0526806 0.0567612 0.0557327 0.0541679 0.0517766 0.0478175 0.0430319 0.0381099 0.033545 0.0295844 0.0262609 0.0234716 0.0210616 0.0188814 0.0168147 0.0147895 0.0127798 0.0106772 0.00874505 0.00702438 0.00549541 0.00420459 0.00320239 0.00253246 +1987 5 1 0 659585 501998 381180 307889 194546 89246.6 31433.8 10443.5 2707.98 612.617 96.4043 10.5207 0.909428 0.0611498 0.00366111 0.000215962 1.35162e-05 9.09473e-07 6.37309e-08 4.48791e-09 3.10909e-10 2.09976e-11 1.37856e-12 8.79428e-14 5.4518e-15 3.28995e-16 1.67224e-17 9.18122e-19 5.06665e-20 2.71458e-21 1.41219e-22 7.14643e-24 3.11465e-25 +1987 6 1 0 362352 312598 284788 277322 255060 174354 89758.1 39823.7 13936.9 4519.64 1286.04 342.444 101.079 27.3557 6.88659 1.59873 0.342319 0.0677916 0.0124576 0.00213096 0.000340286 5.08576e-05 7.1304e-06 9.39807e-07 1.16682e-07 1.37101e-08 1.33328e-09 1.35343e-10 1.34822e-11 1.27781e-12 1.15513e-13 1.00107e-14 7.5378e-16 +1987 7 1 0 85832.5 92834.7 116945 160360 206511 216878 195431 152728 102217 61708.6 31617.8 13553.8 5579.68 1886.56 538.911 131.866 28.3015 5.51006 1.01556 0.184816 0.0340977 0.006412 0.00121982 0.000232194 4.37682e-05 8.12849e-06 1.30727e-06 2.21935e-07 3.77522e-08 6.2201e-09 9.92115e-10 1.53808e-10 2.18349e-11 +1987 8 1 0 28609.6 33225.6 38494 54652.4 84628.1 110944 129864 133269 122404 101338 75954 53136 45525 40759.1 37653.6 35265.2 33537.8 32326.2 31229.3 29555.9 26482.1 21702.8 15967.7 10516.2 6235.32 3359.76 1557.1 696.854 294.905 117.028 43.7575 15.5484 5.21765 +1987 9 1 0 24934.3 26813.5 28938 38105.9 54827.6 73397.6 92687.5 105773 111693 107839 96104.7 76917.3 66509 55100.8 47025.4 41687.8 38173.7 35713.3 33725.3 31723.3 29285 26153 22353.8 18163.4 13971.6 10144.8 6725.2 4290.13 2619.24 1518.18 838.764 447.826 240.577 +1987 10 1 0 13361.7 14470.8 18189.8 26560.6 40359.2 55033.6 70662.3 84453.1 95546 100410 98874.3 86761.4 80096.5 69106.3 59181.1 51160.7 45112 40680.7 37350.6 34586.7 31906.9 28986.3 25753.1 22248 18577.4 14912.9 11232 8187.75 5760.28 3881.53 2513.22 1587.9 1025.73 +1987 11 1 0 24080.8 21832.8 21890.4 26819.1 36544.2 47897.5 61089.4 72284.5 81186.2 85710.6 85816.9 79433 79670.6 72613.7 64823.7 57320.8 50722.4 45249.3 40826.6 37205.6 34073.1 31137.8 28186.2 25106.2 21880.8 18567.2 15062.9 11914.1 9171.65 6823.31 4920.94 3495.85 2557.1 +1987 12 1 0 6911.63 8380.99 11111.2 17622.1 27924.9 38055.8 48397.9 58750.9 69377.9 77967.3 84006.6 82484.5 85043.7 81289.3 75073.5 67560.1 59832.5 52665.6 46447.5 41229.6 36850.4 33066.7 29643.8 26399.1 23219.5 20064.3 16763.2 13729.7 11028.3 8627.79 6601.21 5027.75 3975.97 diff --git a/test/dai-system-tests/baseline/lib/colloid-tracer/content_colloid.dlf b/test/dai-system-tests/baseline/lib/colloid-tracer/content_colloid.dlf index fc933113b..39f96aad1 100644 --- a/test/dai-system-tests/baseline/lib/colloid-tracer/content_colloid.dlf +++ b/test/dai-system-tests/baseline/lib/colloid-tracer/content_colloid.dlf @@ -1,8 +1,8 @@ dlf-0.0 -- Chemical Content (defined in 'log.dai'). -VERSION: 7.0.13 +VERSION: 7.1.3 LOGFILE: content_colloid.dlf -RUN: Tue Jun 3 14:08:49 2025 +RUN: Mon Jan 5 11:36:59 2026 COLUMN: * CHEMICAL: colloid @@ -15,17 +15,17 @@ SIM: Test colloid tracer -------------------- year month mday hour M @ -1.25 M @ -3.75 M @ -7.5 M @ -14 M @ -22.5 M @ -30.5 M @ -38 M @ -45.5 M @ -53 M @ -60.5 M @ -68 M @ -76 M @ -84 M @ -92 M @ -100 M @ -108 M @ -116 M @ -124 M @ -132 M @ -140 M @ -148 M @ -156 M @ -164 M @ -172 M @ -180 M @ -188 M @ -196.5 M @ -205 M @ -213 M @ -221 M @ -229 M @ -237 M @ -245.5 - ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil ppm dry soil + ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 ug/m^3 1986 12 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1987 1 1 0 26.7792 9.32532 2.13843 0.315318 0.0411351 0.00863737 0.00151256 0.000286871 4.88252e-05 7.41351e-06 4.06626e-07 7.88989e-07 0.00026833 0.000258049 0.000252302 0.000248583 0.000245424 0.00024183 0.000236353 0.000226092 0.000162923 6.56581e-06 1.03673e-07 8.00977e-10 3.76215e-12 1.30576e-14 3.28027e-17 8.13869e-20 1.84872e-22 3.8179e-25 7.23279e-28 1.26609e-30 1.79695e-33 -1987 2 1 0 8.32724 3.37155 1.04656 0.227613 0.0345472 0.00495854 0.000601679 8.8956e-05 1.22188e-05 1.95577e-06 3.47069e-07 4.73416e-07 2.3468e-06 4.72221e-06 7.25902e-06 1.00476e-05 1.30057e-05 1.58226e-05 1.80666e-05 1.90451e-05 1.57299e-05 5.48401e-06 1.07495e-06 1.40093e-07 1.34198e-08 1.00987e-09 5.48069e-11 2.79496e-12 1.25535e-13 4.94274e-15 1.7247e-16 5.38421e-18 1.33504e-19 -1987 3 1 0 8.86678 6.31752 3.32974 0.732906 0.103127 0.0130388 0.00166018 0.000239582 3.03059e-05 4.30786e-06 5.41063e-07 6.55735e-08 9.08995e-09 2.59078e-09 3.59853e-09 7.66002e-09 1.61531e-08 3.27454e-08 6.29994e-08 1.10719e-07 1.59568e-07 1.51184e-07 9.09692e-08 3.59026e-08 9.70155e-09 1.88172e-09 2.44143e-10 2.70705e-11 2.48708e-12 1.91175e-13 1.25548e-14 7.16627e-16 3.20034e-17 -1987 4 1 0 92.0568 43.1837 10.2973 1.24921 0.129508 0.0180011 0.00235495 0.000353336 4.87883e-05 7.01119e-06 8.05133e-07 7.98765e-08 8.8143e-09 1.08991e-09 1.52021e-10 3.62049e-11 2.92086e-11 4.03136e-11 5.8349e-11 8.04234e-11 9.92601e-11 1.02774e-10 8.68858e-11 6.01269e-11 3.45075e-11 1.66705e-11 6.33312e-12 2.18086e-12 6.5339e-13 1.67595e-13 3.65763e-14 6.74029e-15 9.51272e-16 -1987 5 1 0 0.101479 0.0690847 0.0481622 0.0315968 0.0189332 0.00914031 0.00198669 0.000349735 5.80561e-05 1.0053e-05 1.40762e-06 1.63138e-07 1.85116e-08 2.21555e-09 2.78063e-10 3.51787e-11 4.56562e-12 8.46801e-13 5.00039e-13 5.73249e-13 6.67625e-13 6.88051e-13 6.08336e-13 4.5936e-13 2.98207e-13 1.68251e-13 7.80858e-14 3.36305e-14 1.31116e-14 4.60103e-15 1.4584e-15 4.19564e-16 1.04543e-16 -1987 6 1 0 44.6959 9.96218 1.51635 0.102018 0.0295315 0.0135789 0.00238762 0.000412594 5.78575e-05 7.94305e-06 9.26689e-07 1.0917e-07 1.52788e-08 2.19476e-09 3.12311e-10 4.34535e-11 5.91022e-12 7.90097e-13 1.06294e-13 1.68443e-14 5.53773e-15 4.07866e-15 3.51969e-15 2.80827e-15 2.00011e-15 1.27048e-15 6.85819e-16 3.46227e-16 1.60457e-16 6.79245e-17 2.63806e-17 9.4658e-18 3.0647e-18 -1987 7 1 0 26.1956 9.24557 2.51711 0.381462 0.0553052 0.00909161 0.00136603 0.000205099 2.52025e-05 3.19544e-06 3.49001e-07 3.80327e-08 5.41264e-09 9.67377e-10 1.88358e-10 3.60863e-11 6.39454e-12 1.018e-12 1.45306e-13 1.90546e-14 2.43449e-15 3.63633e-16 1.04057e-16 6.01657e-17 4.05511e-17 2.55972e-17 1.39269e-17 7.14802e-18 3.40619e-18 1.50212e-18 6.1599e-19 2.36684e-19 8.40028e-20 -1987 8 1 0 65.773 18.4973 2.67037 0.209435 0.0118656 0.000979768 8.51022e-05 1.1917e-05 1.62827e-06 3.11966e-07 3.29503e-07 1.1218e-06 3.11283e-06 2.75283e-06 1.50729e-06 6.29103e-07 2.21442e-07 6.98054e-08 2.05016e-08 5.76669e-09 1.58397e-09 4.29764e-10 1.15475e-10 3.05849e-11 7.9264e-12 2.00146e-12 4.4311e-13 1.02956e-13 2.35576e-14 5.24062e-15 1.13626e-15 2.41241e-16 4.73673e-17 -1987 9 1 0 59.0129 14.7644 2.15334 0.346604 0.0611648 0.0106616 0.00138436 0.000226143 3.17221e-05 4.72464e-06 6.01786e-07 7.75124e-08 3.09214e-08 3.60603e-08 3.88188e-08 3.54633e-08 2.94378e-08 2.3226e-08 1.77641e-08 1.31273e-08 9.03306e-09 5.41395e-09 2.71762e-09 1.13742e-09 4.01964e-10 1.22307e-10 2.94662e-11 6.81088e-12 1.44096e-12 2.78211e-13 4.95427e-14 8.22904e-15 1.18727e-15 -1987 10 1 0 29.8973 14.075 3.22099 0.430909 0.0563813 0.0090856 0.00126726 0.000193569 2.69259e-05 4.3075e-06 6.43727e-07 2.08115e-07 6.05913e-07 1.0476e-06 1.27609e-06 1.33278e-06 1.29619e-06 1.2096e-06 1.0924e-06 9.40639e-07 7.03353e-07 3.73621e-07 1.4197e-07 4.08863e-08 9.39521e-09 1.79458e-09 2.61076e-10 3.6391e-11 4.58846e-12 5.21523e-13 5.40428e-14 5.17e-15 4.18501e-16 -1987 11 1 0 11.46 6.28259 2.18745 0.48622 0.0921032 0.0163052 0.00180893 0.000252465 2.94399e-05 3.73699e-06 4.25564e-07 4.85873e-08 6.65673e-09 1.40955e-09 6.90426e-10 5.09061e-10 3.89157e-10 2.90131e-10 2.11698e-10 1.50901e-10 1.02738e-10 6.42711e-11 3.58416e-11 1.76071e-11 7.63018e-12 2.9435e-12 9.33291e-13 2.86084e-13 8.13035e-14 2.12729e-14 5.15402e-15 1.16492e-15 2.32119e-16 -1987 12 1 0 47.0716 15.4923 2.71719 0.342981 0.0409291 0.00625287 0.000790945 0.000119028 1.69351e-05 2.77611e-06 4.0581e-07 5.68013e-08 8.8122e-09 1.47212e-09 2.56078e-10 4.50055e-11 8.07166e-12 2.01173e-12 1.16839e-12 1.02234e-12 8.57397e-13 6.2338e-13 3.86587e-13 2.05859e-13 9.57638e-14 3.97158e-14 1.37186e-14 4.61495e-15 1.4574e-15 4.29824e-16 1.19108e-16 3.12569e-17 7.44021e-18 +1987 1 1 0 4.15078e+07 1.44543e+07 3.31456e+06 488742 63759.4 12783.3 2238.59 424.57 72.2612 10.972 0.601806 1.1677 421.278 405.137 396.115 390.276 385.315 379.674 371.074 354.965 255.789 10.3083 0.162767 0.00125753 5.90657e-06 2.05005e-08 5.15002e-11 1.27777e-13 2.90248e-16 5.9941e-19 1.13555e-21 1.98777e-24 2.82121e-27 +1987 2 1 0 1.29072e+07 5.2259e+06 1.62217e+06 352800 53548.2 7338.64 890.485 131.655 18.0838 2.89453 0.513662 0.700655 3.68447 7.41387 11.3967 15.7748 20.419 24.8415 28.3645 29.9008 24.6959 8.6099 1.68768 0.219946 0.0210692 0.0015855 8.60469e-05 4.38808e-06 1.9709e-07 7.76011e-09 2.70777e-10 8.45322e-12 2.09601e-13 +1987 3 1 0 1.37435e+07 9.79216e+06 5.16109e+06 1.136e+06 159847 19297.5 2457.06 354.582 44.8528 6.37563 0.800773 0.0970488 0.0142712 0.00406752 0.0056497 0.0120262 0.0253604 0.0514103 0.098909 0.173829 0.250521 0.23736 0.142822 0.0563671 0.0152314 0.00295431 0.000383305 4.25006e-05 3.90472e-06 3.00144e-07 1.9711e-08 1.1251e-09 5.02453e-11 +1987 4 1 0 1.42688e+08 6.69347e+07 1.59609e+07 1.93627e+06 200737 26641.7 3485.32 522.938 72.2066 10.3766 1.1916 0.118217 0.0138384 0.00171115 0.000238673 5.68416e-05 4.58575e-05 6.32923e-05 9.1608e-05 0.000126265 0.000155838 0.000161356 0.000136411 9.43992e-05 5.41768e-05 2.61727e-05 9.94301e-06 3.42395e-06 1.02582e-06 2.63124e-07 5.74247e-08 1.05823e-08 1.4935e-09 +1987 5 1 0 157292 107081 74651.4 48975 29346.4 13527.7 2940.3 517.608 85.9231 14.8784 2.08328 0.241444 0.0290632 0.00347841 0.000436559 5.52306e-05 7.16803e-06 1.32948e-06 7.85062e-07 9.00002e-07 1.04817e-06 1.08024e-06 9.55087e-07 7.21195e-07 4.68184e-07 2.64154e-07 1.22595e-07 5.27999e-08 2.05851e-08 7.22362e-09 2.28969e-09 6.58715e-10 1.64133e-10 +1987 6 1 0 6.92787e+07 1.54414e+07 2.35034e+06 158128 45773.8 20096.8 3533.68 610.639 85.6291 11.7557 1.3715 0.161571 0.0239877 0.00344578 0.000490328 6.8222e-05 9.27904e-06 1.24045e-06 1.66881e-07 2.64455e-08 8.69424e-09 6.4035e-09 5.52591e-09 4.40899e-09 3.14017e-09 1.99465e-09 1.07674e-09 5.43577e-10 2.51917e-10 1.06642e-10 4.14175e-11 1.48613e-11 4.81157e-12 +1987 7 1 0 4.06031e+07 1.43306e+07 3.90151e+06 591266 85723.1 13455.6 2021.72 303.546 37.2997 4.72925 0.516521 0.0562884 0.00849785 0.00151878 0.000295723 5.66556e-05 1.00394e-05 1.59827e-06 2.2813e-07 2.99157e-08 3.82214e-09 5.70904e-10 1.6337e-10 9.44601e-11 6.36652e-11 4.01876e-11 2.18652e-11 1.12224e-11 5.34772e-12 2.35833e-12 9.67104e-13 3.71593e-13 1.31884e-13 +1987 8 1 0 1.01948e+08 2.86708e+07 4.13907e+06 324624 18391.6 1450.06 125.951 17.6372 2.40983 0.46171 0.487665 1.66027 4.88714 4.32195 2.36645 0.987692 0.347663 0.109594 0.0321874 0.0090537 0.00248683 0.000674729 0.000181296 4.80184e-05 1.24445e-05 3.14229e-06 6.95682e-07 1.6164e-07 3.69854e-08 8.22778e-09 1.78393e-09 3.78748e-10 7.43667e-11 +1987 9 1 0 9.147e+07 2.28849e+07 3.33768e+06 537236 94805.5 15779.1 2048.85 334.692 46.9487 6.99247 0.890643 0.114718 0.0485465 0.0566147 0.0609455 0.0556774 0.0462173 0.0364648 0.0278896 0.0206099 0.0141819 0.00849991 0.00426666 0.00178574 0.000631084 0.000192021 4.6262e-05 1.06931e-05 2.26231e-06 4.36791e-07 7.7782e-08 1.29196e-08 1.86401e-09 +1987 10 1 0 4.63408e+07 2.18162e+07 4.99254e+06 667908 87391.1 13446.7 1875.55 286.482 39.8503 6.3751 0.952717 0.30801 0.951283 1.64474 2.00347 2.09246 2.03502 1.89907 1.71506 1.4768 1.10426 0.586586 0.222892 0.0641915 0.0147505 0.00281748 0.000409889 5.71338e-05 7.20388e-06 8.1879e-07 8.48472e-08 8.1169e-09 6.57046e-10 +1987 11 1 0 1.77629e+07 9.73801e+06 3.39055e+06 753641 142760 24131.7 2677.21 373.648 43.571 5.53074 0.629834 0.0719092 0.0104511 0.00221299 0.00108397 0.000799226 0.000610976 0.000455506 0.000332365 0.000236914 0.000161299 0.000100906 5.62713e-05 2.76432e-05 1.19794e-05 4.6213e-06 1.46527e-06 4.49152e-07 1.27647e-07 3.33985e-08 8.09181e-09 1.82892e-09 3.64427e-10 +1987 12 1 0 7.2961e+07 2.4013e+07 4.21164e+06 531621 63440.1 9254.25 1170.6 176.161 25.064 4.10865 0.600599 0.0840659 0.0138352 0.00231122 0.000402043 7.06586e-05 1.26725e-05 3.15841e-06 1.83438e-06 1.60507e-06 1.34611e-06 9.78706e-07 6.06942e-07 3.23198e-07 1.50349e-07 6.23539e-08 2.15381e-08 7.24547e-09 2.28812e-09 6.74824e-10 1.87e-10 4.90733e-11 1.16811e-11 diff --git a/test/dai-system-tests/baseline/programs/AM_table/daisy.log b/test/dai-system-tests/baseline/programs/AM_table/daisy.log deleted file mode 100644 index 431b0c1a9..000000000 --- a/test/dai-system-tests/baseline/programs/AM_table/daisy.log +++ /dev/null @@ -1,44 +0,0 @@ -Has DAISYHOME environment variable -Using '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/../..' as daisy home. -Reseting current directory to '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests' -Daisy crop/soil simulation version 7.0.13. (Jun 3 2025) -Copyright 1996 - 2016 Per Abrahamsen, Søren Hansen and KU. -Changing directory to '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/baseline/programs/AM_table' success -Interpreting '.' in path as /home/silas/Projects/daisy-model/daisy/test/dai-system-tests/tests/common -In directory '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/baseline/programs/AM_table': -Opening absolute file name '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/tests/programs/test-AM_table.dai' -* Parsing file: '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/tests/programs/test-AM_table.dai' -** input -*** file -In directory '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/baseline/programs/AM_table': -Looking for file 'fertilizer.dai' -Trying '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/tests/common/fertilizer.dai' (cwd) -Trying '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/../../lib/fertilizer.dai' success! -Command line: ../../build/portable-7.0.13/daisy -d /home/silas/Projects/daisy-model/daisy/test/dai-system-tests/baseline/programs/AM_table -D /home/silas/Projects/daisy-model/daisy/test/dai-system-tests/tests/common /home/silas/Projects/daisy-model/daisy/test/dai-system-tests/tests/programs/test-AM_table.dai -Storing 'daisy.log' in '/home/silas/Projects/daisy-model/daisy/test/dai-system-tests/baseline/programs/AM_table' -Program started Tue Jun 3 14:40:29 2025., 0 seconds ago. -Name Super File NH4 NO3 volatilization N C DM -component -base component -root base 0.01 0.4 -mineral component 0 -state base -organic base 0 0 0 -initial base -Ammonia mineral fertilizer.dai 1 0 -AmmoniumNitrate mineral fertilizer.dai 0.5 0 -Nitrate mineral fertilizer.dai 0 0 -N25S mineral fertilizer.dai 0.508 0 -NPK01 mineral fertilizer.dai 0.53 0 -NPK02 mineral fertilizer.dai 0.57 0 -NP mineral fertilizer.dai 0.65 0 -CalciumNitrate mineral fertilizer.dai 0.08 0 -slurry organic fertilizer.dai 0 0 0 -cattle_slurry slurry fertilizer.dai 0.7 0 0 0.1 0.375 0.059 -pig_slurry slurry fertilizer.dai 0.7 0 0 0.1 0.375 0.059 -manure slurry fertilizer.dai 0 0 0 -cattle_manure manure fertilizer.dai 0.7 0.2 0 0.1 0.375 0.059 -pig_manure manure fertilizer.dai 0.7 0.2 0 0.1 0.375 0.059 -horse_manure manure fertilizer.dai 0.25 0 0 0.014 0.375 0.297 -Foulum_slurry slurry fertilizer.dai 0.57 0 0 0.0615 0.323 0.0341 -Program finished after 0 seconds. diff --git a/test/dai-system-tests/tests/lib/test-colloid-tracer.dai b/test/dai-system-tests/tests/lib/test-colloid-tracer.dai index ff3eee94e..0411fa0d8 100644 --- a/test/dai-system-tests/tests/lib/test-colloid-tracer.dai +++ b/test/dai-system-tests/tests/lib/test-colloid-tracer.dai @@ -13,9 +13,9 @@ (spray Tracer 1 [kg/ha])) (time 1986 12 1 1) (stop 1987 12 1 1) - (output ("Chemical Content" (chemical Tracer) (when monthly) (unit "ppm dry soil")) - ("Chemical Content" (chemical colloid) (when monthly) (unit "ppm dry soil")) + (output ("Chemical Content" (chemical Tracer) (when monthly)) + ("Chemical Content" (chemical colloid) (when monthly)) ("Field chemical" (chemical Tracer) (when monthly)) ("Field chemical" (chemical colloid) (when monthly)) ("Colloids" (when monthly)))) ;; tracking -(run test) \ No newline at end of file +(run test) diff --git a/test/dai-system-tests/tests/programs/CMakeLists.txt b/test/dai-system-tests/tests/programs/CMakeLists.txt index f28693719..8526e2360 100644 --- a/test/dai-system-tests/tests/programs/CMakeLists.txt +++ b/test/dai-system-tests/tests/programs/CMakeLists.txt @@ -1,4 +1,3 @@ -dai_system_test(AM_table programs) #dai_system_test(gnuplot programs) dai_system_test(GP2D programs) dai_system_test(hydraulic programs) diff --git a/test/dai-unit-tests/CMakeLists.txt b/test/dai-unit-tests/CMakeLists.txt index db225c5b8..209d51201 100644 --- a/test/dai-unit-tests/CMakeLists.txt +++ b/test/dai-unit-tests/CMakeLists.txt @@ -1,14 +1,29 @@ -function(dai_unit_test name) - add_test(NAME dai_unit_test.${name} - COMMAND - check_daisy - ${CMAKE_BINARY_DIR}/daisy - ${CMAKE_SOURCE_DIR}/test/dai-unit-tests/tests/test-${name}.dai - --path ${CMAKE_SOURCE_DIR}/test/dai-unit-tests/tests/common - ) - set_property(TEST dai_unit_test.${name} PROPERTY ENVIRONMENT "DAISYHOME=${CMAKE_SOURCE_DIR}") - set_property(TEST dai_unit_test.${name} PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_SOURCE_DIR}/sample/python") -endfunction() - +if(${OS} STREQUAL "mingw") + function(dai_unit_test name) + add_test(NAME dai_unit_test.${name} + COMMAND + C:/msys64/usr/bin/bash.exe + ${CMAKE_SOURCE_DIR}/scripts/run_dai_unit_test.sh + ${_daisy_test_exe} + ${CMAKE_SOURCE_DIR}/test/dai-unit-tests/tests/test-${name}.dai + --path ${CMAKE_SOURCE_DIR}/test/dai-unit-tests/tests/common + ) + set_property(TEST dai_unit_test.${name} PROPERTY ENVIRONMENT "DAISYHOME=${CMAKE_SOURCE_DIR}") + set_property(TEST dai_unit_test.${name} PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_SOURCE_DIR}/sample/python") + endfunction() +else() + function(dai_unit_test name) + add_test(NAME dai_unit_test.${name} + COMMAND + ${CMAKE_SOURCE_DIR}/scripts/run_dai_unit_test.sh + ${_daisy_test_exe} + ${CMAKE_SOURCE_DIR}/test/dai-unit-tests/tests/test-${name}.dai + --path ${CMAKE_SOURCE_DIR}/test/dai-unit-tests/tests/common + ) + set_property(TEST dai_unit_test.${name} PROPERTY ENVIRONMENT "DAISYHOME=${CMAKE_SOURCE_DIR}") + set_property(TEST dai_unit_test.${name} PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_SOURCE_DIR}/sample/python") + endfunction() +endif() +dai_unit_test(AM_table) dai_unit_test(CO2-mul) dai_unit_test(document) diff --git a/test/dai-system-tests/tests/programs/test-AM_table.dai b/test/dai-unit-tests/tests/test-AM_table.dai similarity index 100% rename from test/dai-system-tests/tests/programs/test-AM_table.dai rename to test/dai-unit-tests/tests/test-AM_table.dai