Skip to content
Snippets Groups Projects
Commit 884fddfd authored by Daniel Hornung's avatar Daniel Hornung
Browse files

WIP: New mex structure and cmake files

parent 9c84c574
No related branches found
No related tags found
1 merge request!1Initial functionality
...@@ -58,22 +58,29 @@ endif() ...@@ -58,22 +58,29 @@ endif()
####################################################### #######################################################
add_subdirectory(src) add_subdirectory(src)
set(PKG_INST_DIR "${PROJECT_SOURCE_DIR}/inst") set(PKG_INST_DIR "${PROJECT_SOURCE_DIR}/inst")
file(MAKE_DIRECTORY ${PKG_INST_DIR}) file(MAKE_DIRECTORY ${PKG_INST_DIR})
# Options for mex compilation
string(REGEX REPLACE ";" ";-I" _MKOCTFILE_INCLUDES "-I${CONAN_INCLUDE_DIRS}") string(REGEX REPLACE ";" ";-I" _MKOCTFILE_INCLUDES "-I${CONAN_INCLUDE_DIRS}")
string(REGEX REPLACE ";" ";-L" _MKOCTFILE_LIB_DIRS "-L${CONAN_LIB_DIRS}") string(REGEX REPLACE ";" ";-L" _MKOCTFILE_LIB_DIRS "-L${CONAN_LIB_DIRS}")
string(REGEX REPLACE ";" ";-l" _MKOCTFILE_LIBS "-l${CONAN_LIBS}") string(REGEX REPLACE ";" ";-l" _MKOCTFILE_LIBS "-l${CONAN_LIBS}")
string(REGEX REPLACE ";" ":" _MKOCTFILE_RPATH "${CONAN_LIB_DIRS}") string(REGEX REPLACE ";" ":" _MKOCTFILE_RPATH "${CONAN_LIB_DIRS}")
set(_MKOCTFILE_OPTIONS "-o" "${PKG_INST_DIR}/caosdb.mex" "-Wl,-rpath,${_MKOCTFILE_RPATH}" "--mex" "-std=gnu++17" set(_MKOCTFILE_OPTIONS "-Wl,-rpath,${_MKOCTFILE_RPATH}" "--mex" "-std=gnu++17"
"-L/usr/local/lib" ${_MKOCTFILE_INCLUDES} ${_MKOCTFILE_LIB_DIRS} ${_MKOCTFILE_LIBS}) "-L/usr/local/lib" ${_MKOCTFILE_INCLUDES} ${_MKOCTFILE_LIB_DIRS} ${_MKOCTFILE_LIBS})
add_custom_command(OUTPUT ${PKG_INST_DIR}/caosdb.mex file(GLOB_RECURSE _CPP_SOURCES RELATIVE "${PROJECT_SOURCE_DIR}/src" src/*.cpp)
COMMAND mkoctfile foreach(sourcefile ${_CPP_SOURCES})
ARGS ${_MKOCTFILE_OPTIONS} ${OCTAVE_CAOSDB_SRC} STRING(REGEX REPLACE ".cpp$" ".mex" _mex_ext_file ${sourcefile})
DEPENDS ${OCTAVE_CAOSDB_SRC} set(_mex_ext_file "${PKG_INST_DIR}/${_mex_ext_file}")
) set(_mkoct_output "-o" "${_mex_ext_file}")
add_custom_target(caosdb.mex ALL set(_abs_source "${PROJECT_SOURCE_DIR}/src/${sourcefile}")
SOURCES ${PKG_INST_DIR}/caosdb.mex) add_custom_command(OUTPUT ${_mex_ext_file}
COMMAND mkoctfile
ARGS ${_MKOCTFILE_OPTIONS} ${_mkoct_output} ${_abs_source}
MAIN_DEPENDENCY ${_abs_source}
)
add_custom_target(mex ALL DEPENDS ${_mex_ext_file})
endforeach(sourcefile)
####################################################### #######################################################
......
...@@ -51,20 +51,3 @@ static website. If you rather would like to use the native, ...@@ -51,20 +51,3 @@ static website. If you rather would like to use the native,
- `sphinx-autoapi` - `sphinx-autoapi`
- `recommonmark` - `recommonmark`
### Writing Documentation
- Example for texinfo documentation:
https://github.com/gnu-octave/octave/blob/default/scripts/geometry/inpolygon.m
- Extract documentation from file:
`[txt, form] = get_help_text_from_file(make_absolute_filename('pkg/inst/some_function.m'))`
- Generate HTML documentation from single file:
```octave
pkg uninstall caosdb
pkg install caosdb.tar.gz
pkg load caosdb
html_help_text('some_function', './htdocs/some.html', 'octave-forge', pkgname="caosdb")
```
- Generate HTML documentation for a package:
```octave
generate_package_html('caosdb', 'htdocs', 'octave-forge')
```
Development
===========
Structure
---------
The sources for functions and classes are in ``src/``. Private functions (mostly C++ source files
which are to be compiled into ``*.mex``) are implemented in ``private/_some_function.*``.
Writing Documentation
---------------------
- Example for texinfo documentation:
https://github.com/gnu-octave/octave/blob/default/scripts/geometry/inpolygon.m
- Extract documentation from file:
``[txt, form] = get_help_text_from_file(make_absolute_filename('pkg/inst/some_function.m'))``
- Generate HTML documentation from single file:
.. code-block:: octave
pkg uninstall caosdb
pkg install caosdb.tar.gz
pkg load caosdb
html_help_text('some_function', './htdocs/some.html', 'octave-forge', pkgname="caosdb")
- Generate HTML documentation for a package:
.. code-block:: octave
generate_package_html('caosdb', 'htdocs', 'octave-forge')
...@@ -42,7 +42,7 @@ doc-help: ...@@ -42,7 +42,7 @@ doc-help:
# Catch-all target: route all unknown targets to Sphinx using the new # Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile octavedoc %: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
octavedoc: octavedoc:
......
...@@ -91,7 +91,7 @@ html_theme = "sphinx_rtd_theme" ...@@ -91,7 +91,7 @@ html_theme = "sphinx_rtd_theme"
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [ html_static_path = [
'_static', # '_static',
'_build_octave', '_build_octave',
] ]
......
...@@ -38,6 +38,7 @@ This is work in progress. ...@@ -38,6 +38,7 @@ This is work in progress.
:caption: Contents: :caption: Contents:
Welcome <self> Welcome <self>
Development
api/index api/index
* :ref:`genindex` * :ref:`genindex`
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
# We want to compile all the _*.cpp files in `private`
set(OCTAVE_CAOSDB_SRC set(OCTAVE_CAOSDB_SRC
${CMAKE_CURRENT_SOURCE_DIR}/caosdb.cpp ${CMAKE_CURRENT_SOURCE_DIR}/private/_caosdb.cpp
) )
# pass variable to parent scope # pass variable to parent scope
......
...@@ -9,6 +9,7 @@ INST_DIR="$(realpath ../inst)" ...@@ -9,6 +9,7 @@ INST_DIR="$(realpath ../inst)"
echo "Octave CaosDB INST_DIR: $INST_DIR" echo "Octave CaosDB INST_DIR: $INST_DIR"
rm -r "${INST_DIR}" || true rm -r "${INST_DIR}" || true
mkdir -p "${INST_DIR}" mkdir -p "${INST_DIR}"
mkdir -p "${INST_DIR}/private"
BUILD_DIR="$(realpath ../build)" BUILD_DIR="$(realpath ../build)"
echo "Octave CaosDB BUILD_DIR: $BUILD_DIR" echo "Octave CaosDB BUILD_DIR: $BUILD_DIR"
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment