build: bugfix SELF_LIB consistency + streamline CMAKE_MODULE_PATH
This commit is contained in:
parent
bb26c99660
commit
2f908b7c36
6 changed files with 43 additions and 7 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
# lsp keeps state here
|
# lsp keeps state here
|
||||||
.cache
|
.cache
|
||||||
# typical build directory
|
# typical build directory
|
||||||
build
|
.build*
|
||||||
# lsp: symlink to file in build directory (established manually)
|
# lsp: symlink to file in build directory (established manually)
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(xo_pyprocess VERSION 0.1)
|
project(xo_pyprocess VERSION 0.1)
|
||||||
|
|
||||||
include(xo_macros/xo-project-macros)
|
include(cmake/xo-bootstrap-macros.cmake)
|
||||||
|
|
||||||
xo_cxx_toplevel_options()
|
xo_cxx_toplevel_options()
|
||||||
|
|
||||||
|
|
|
||||||
26
README.md
26
README.md
|
|
@ -1,6 +1,17 @@
|
||||||
# python bindings for c++ stochastic process library (xo-process)
|
# python bindings for c++ stochastic process library (xo-process)
|
||||||
|
|
||||||
# build + install
|
## Getting Started
|
||||||
|
|
||||||
|
### build + install dependencies
|
||||||
|
|
||||||
|
- [github/Rconybea/xo-process](https://github.com/Rconybea/xo-process)
|
||||||
|
- [github/Rconybea/xo-reactor](https://github.com/Rconybea/xo-reactor)
|
||||||
|
- [github/Rconybea/xo-pyutil](https://github.com/Rconybea/xo-pyutil)
|
||||||
|
- [github/Rconybea/xo-pyreflect](https://github.com/Rconybea/xo-pyreflect)
|
||||||
|
- [github/Rconybea/xo-pyprintjson](https://github.com/Rconybea/xo-pyprintjson)
|
||||||
|
- [github/Rconybea/xo-pyreactor](https://github.com/Rconybea/xo-pyreactor)
|
||||||
|
|
||||||
|
### build + install
|
||||||
```
|
```
|
||||||
$ cd xo-pyprocess
|
$ cd xo-pyprocess
|
||||||
$ mkdir build
|
$ mkdir build
|
||||||
|
|
@ -15,6 +26,19 @@ $ make install
|
||||||
```
|
```
|
||||||
(also see .github/workflows/main.yml)
|
(also see .github/workflows/main.yml)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Assumes `xo-pyprocess` installed to `~/local2/lib`
|
||||||
|
```
|
||||||
|
PYTHONPATH=~/local2/lib:$PYTHONPATH python
|
||||||
|
>>> import xo_pyprocess
|
||||||
|
>>> dir(xo_pyprocess)
|
||||||
|
['BrownianMotion', 'ExpProcess', 'RealizationSource', 'RealizationTracer', 'StochasticProcess', 'UpxAdapterSink', 'UpxEvent', 'UpxEventStore', 'UpxToConsole', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'make_brownian_motion', 'make_exponential_brownian_motion', 'make_realization_printer', 'make_realization_source', 'make_tracer']
|
||||||
|
>>>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
# build for unit test coverage
|
# build for unit test coverage
|
||||||
```
|
```
|
||||||
$ cd xo-pyprocess
|
$ cd xo-pyprocess
|
||||||
|
|
|
||||||
12
cmake/xo-bootstrap-macros.cmake
Normal file
12
cmake/xo-bootstrap-macros.cmake
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL "prefix"))
|
||||||
|
# default to typical install location for xo-project-macros
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message("-- CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
||||||
|
message("-- CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
|
||||||
|
|
||||||
|
# needs to have been installed somewhere on CMAKE_MODULE_PATH,
|
||||||
|
# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX)
|
||||||
|
#
|
||||||
|
include(xo_macros/xo-project-macros)
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# xo_pyprocess/src/pyprocess/CMakeLists.txt
|
# xo_pyprocess/src/pyprocess/CMakeLists.txt
|
||||||
|
|
||||||
set(SELF_LIB pyprocess)
|
set(SELF_LIB xo_pyprocess)
|
||||||
set(SELF_SRCS pyprocess.cpp)
|
set(SELF_SRCS pyprocess.cpp)
|
||||||
|
|
||||||
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
|
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,18 @@
|
||||||
* example:
|
* example:
|
||||||
* PYBIND11_MODULE(PYPROCESS_MODULE_NAME(), m) { ... }
|
* PYBIND11_MODULE(PYPROCESS_MODULE_NAME(), m) { ... }
|
||||||
*/
|
*/
|
||||||
#define PYPROCESS_MODULE_NAME() @SELF_LIBRARY_NAME@
|
#define PYPROCESS_MODULE_NAME() @SELF_LIB@
|
||||||
|
|
||||||
/* example:
|
/* example:
|
||||||
* py::module_::import(PYPROCESS_MODULE_NAME_STR)
|
* py::module_::import(PYPROCESS_MODULE_NAME_STR)
|
||||||
*/
|
*/
|
||||||
#define PYPROCESS_MODULE_NAME_STR "@SELF_LIBRARY_NAME@"
|
#define PYPROCESS_MODULE_NAME_STR "@SELF_LIB@"
|
||||||
|
|
||||||
/* example:
|
/* example:
|
||||||
* PYPROCESS_IMPORT_MODULE()
|
* PYPROCESS_IMPORT_MODULE()
|
||||||
* replaces
|
* replaces
|
||||||
* py::module_::import("pyprocess")
|
* py::module_::import("pyprocess")
|
||||||
*/
|
*/
|
||||||
#define PYPROCESS_IMPORT_MODULE() py::module_::import("@SELF_LIBRARY_NAME@")
|
#define PYPROCESS_IMPORT_MODULE() py::module_::import("@SELF_LIB@")
|
||||||
|
|
||||||
/* end pyprocess.hpp */
|
/* end pyprocess.hpp */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue