diff --git a/nongnu/packages/modelica.scm b/nongnu/packages/modelica.scm new file mode 100644 index 00000000..715cb209 --- /dev/null +++ b/nongnu/packages/modelica.scm @@ -0,0 +1,120 @@ +(define-module (nongnu packages modelica) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix download) + #:use-module (guix gexp) + #:use-module (guix build-system cmake) + #:use-module ((guix licenses) #:prefix license:) + + #:use-module (gnu packages autotools) + #:use-module (gnu packages boost) + #:use-module (gnu packages ccache) + #:use-module (gnu packages commencement) + #:use-module (gnu packages curl) + #:use-module (gnu packages documentation) + #:use-module (gnu packages graphics) + #:use-module (gnu packages graphviz) + #:use-module (gnu packages java) + #:use-module (gnu packages linux) + #:use-module (gnu packages maths) + #:use-module (gnu packages opencl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages python) + #:use-module (gnu packages qt) + #:use-module (gnu packages readline) + #:use-module (gnu packages xml)) + +(define ombootstrapping + (origin + (method url-fetch) + (uri "https://api.github.com/repos/OpenModelica/OMBootstrapping/tarball/c289e97c41d00939a4a69fe504961b47283a6d8e") + (sha256 + (base32 "1drz4hh9xfp2n9ilr0cmxm0jka24swdnglh8av06rdp0b2f9xszi")))) + +(define-public openmodelica + (package + (name "openmodelica") + (version "1.22.4") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/OpenModelica/OpenModelica") + (commit (string-append "v" version)) + (recursive? #t))) + (sha256 + (base32 "02g5i2clcnn16gmi8v11sfn23r291jpsqi98qqq6al3lmc1xp556")) + (snippet + (with-imported-modules + '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (substitute* + "OMCompiler/Compiler/boot/CMakeLists.txt" + (("https://github.com/OpenModelica/OMBootstrapping/archive/refs/heads/master.tar.gz") + (string-append "file://" #$ombootstrapping))) + + + (substitute* + "OMPlot/OMPlot/OMPlotGUI/CMakeLists.txt" + (("target_link_libraries\\(OMPlotLib PUBLIC omc::simrt::runtime\\)") + "target_link_libraries(OMPlotLib PUBLIC omc::simrt::runtime) +find_package(Qt5Svg REQUIRED) +INCLUDE_DIRECTORIES(${Qt5Svg_INCLUDE_DIRS}) +target_link_libraries(OMPlotLib PUBLIC Qt5Svg) +"))))))) + + (build-system cmake-build-system) + (arguments + (list + #:validate-runpath? #f + ;; No tests + #:tests? #f + #:configure-flags + ''("-DOM_OMEDIT_ENABLE_QTWEBENGINE=ON") + #:phases + #~(modify-phases %standard-phases + (add-before 'build 'create-home + (lambda _ + (mkdir-p (string-append (getcwd) "/home")) + (setenv "HOME" (string-append (getcwd) "/home"))))))) + (native-inputs + (list + ccache + doxygen + graphviz + autoconf + pkg-config)) + (inputs + (list + expat + openscenegraph + readline + qtdeclarative-5 + qtwebchannel-5 + qtwebengine-5 + qtxmlpatterns + qtsvg-5 + qtbase-5 + opencl-headers + opencl-icd-loader + boost + icedtea + (list util-linux "lib") + gfortran-toolchain + openblas + curl)) + (home-page "https://openmodelica.org/") + (synopsis + "Open-source Modelica-based modeling and simulation environment") + (description + "OPENMODELICA is an open-source Modelica-based1 modeling and simulation +environment intended for industrial and academic usage. + +The goal with the OpenModelica effort is to create a comprehensive Open Source +Modelica modeling, compilation and simulation environment based on free software +distributed in binary and source code form for research, teaching, and +industrial usage. We invite researchers and students, or any interested +developer to participate in the project and cooperate around OpenModelica, +tools, and applications.") + (license license:agpl3)))