PageSourceSearch

https://dune-copasi.netlify.app/assets/js/5dfb0910.00fffb9a.js

js dune-copasi.netlify.app collected 2026-10-03 10:42:45 UTC 3,851 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdune_copasi_docusaurus=self.webpackChunkdune_copasi_docusaurus||[]).push([[8074],{1760:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>r,toc:()=>d});var s=n(4848),i=n(8453);const a={id:"use_api",title:"Application Programming Interface Usage",description:"How to use the API",sidebar_label:"Use as API",tags:["API"]},o=void 0,r={id:"use_api",title:"Application Programming Interface Usage",description:"How to use the API",source:"@site/versioned_docs/version-v2.0.1/use_api.mdx",sourceDirName:".",slug:"/use_api",permalink:"/docs/v2.0.1/use_api",draft:!1,unlisted:!1,editUrl:"https://gitlab.dune-project.org/copasi/dune-copasi/-/edit/master/doc/docusaurus/versioned_docs/version-v2.0.1/use_api.mdx",tags:[{inline:!0,label:"API",permalink:"/docs/v2.0.1/tags/api"}],version:"v2.0.1",lastUpdatedBy:"Santiago Ospina De Los Rios",lastUpdatedAt:1713784883e3,frontMatter:{id:"use_api",title:"Application Programming Interface Usage",description:"How to use the API",sidebar_label:"Use as API",tags:["API"]},sidebar:"docs",previous:{title:"Use as GUI",permalink:"/docs/v2.0.1/use_gui"},next:{title:"Configuration Options",permalink:"/docs/v2.0.1/category/docs/config"}},c={},d=[{value:"Importing CMake targets",id:"importing-cmake-targets",level:3}];function p(e){const t={a:"a",admonition:"admonition",code:"code",h3:"h3",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["DuneCopasi is a C++ program, its main objects may be consumed by another program in order\nto generate custom simulation rules, to couple intermediate steps with other\ntools, or to implement a GUI, etc. In such a case, DuneCopasi must be\navailable in development mode and the downstream library is expected to\n",(0,s.jsx)(t.a,{href:"#importing-cmake-targets",children:"consume the library"})," by using the\n",(0,s.jsx)(t.a,{href:"https://cmake.org",children:"CMake build system"})," and use the ",(0,s.jsx)(t.a,{href:"api",children:"C++ objects"})," in code."]}),"\n",(0,s.jsx)(t.h3,{id:"importing-cmake-targets",children:"Importing CMake targets"}),"\n",(0,s.jsx)(t.p,{children:"To use the API for development, you must find and consume the CMake targets from DuneCopasi in your project as follows:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-cmake",metastring:'title="CMakeLists.txt"',children:"cmake_minimum_required(VERSION 3.16 FATAL_ERROR)\nproject(my-app CXX)\n# ...\nfind_package(dune-copasi IMPORTED REQUIRED)\ntarget_link_libraries(my_app PRIVATE Dune::Copasi)\n# ...\n"})}),"\n",(0,s.jsxs)(t.admonition,{title:"Custom installed directory",type:"tip",children:[(0,s.jsxs)(t.p,{children:["If DuneCopasi was installed on a custom directory\n(e.g. using ",(0,s.jsx)(t.code,{children:"CMAKE_INSTALL_PREFIX=/opt/dune"}),") when ",(0,s.jsx)(t.a,{href:"install_source",children:"installed from source"}),", it is likely that you need to\npass such directory to the ",(0,s.jsx)(t.code,{children:"CMAKE_PREFIX_PATH"})," when building the CMake project. This way,\nCMake can find the CMake configuration file and its targets:"]}),(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-bash",children:"cmake -DCMAKE_PREFIX_PATH:PATH=/opt/dune /path/to/app/source/\n"})})]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>r});var s=n(6540);const i={},a=s.createContext(i);function o(e){const t=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),s.createElement(a.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.