diff --git a/.gitignore b/.gitignore index 8ea1f615..13c0afb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ -# lsp keep state here +# clangd working space (see emacs+lsp) .cache -# typical build directories -build -ccov -# for lsp: manual symlink to chosen build directory +# typical cmake build directory (source-tree-nephew) +.build* +# symlink to builddir/compile_commands.json; should be set manually in dev sandbox compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f326e13..603f7253 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,7 @@ project(xo_pyprintjson VERSION 1.0) enable_language(CXX) # common XO cmake macros (see github.com:Rconybea/xo-cmake) -include(xo_macros/xo_cxx) -include(xo_macros/code-coverage) +include(cmake/xo-bootstrap-macros.cmake) # ---------------------------------------------------------------- # unit test setup diff --git a/README.md b/README.md index 34b77909..e85bc227 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,18 @@ $ make install ``` (also see .github/workflows/main.yml) +## Examples + +``` +PYTHONPATH=~/local2/lib:$PYTHONPATH python +>>> import xo_pyprintjson +>>> dir(xo_pyprintjson) +['PrintJson', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__'] +>>> dir(xo_pyprintjson.PrintJson) +['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'instance', 'print'] +>>> +``` + ## Development ### build for unit test coverage diff --git a/cmake/xo-bootstrap-macros.cmake b/cmake/xo-bootstrap-macros.cmake new file mode 100644 index 00000000..16644435 --- /dev/null +++ b/cmake/xo-bootstrap-macros.cmake @@ -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) diff --git a/include/README.md b/include/README.md new file mode 100644 index 00000000..5d2b4c67 --- /dev/null +++ b/include/README.md @@ -0,0 +1 @@ +placeholder for future pyprintjson #include files diff --git a/include/xo/pyprintjson/pyprintjson.hpp b/include/xo/pyprintjson/pyprintjson.hpp deleted file mode 100644 index c5fa007d..00000000 --- a/include/xo/pyprintjson/pyprintjson.hpp +++ /dev/null @@ -1,25 +0,0 @@ -/* @file pyprintjson.hpp - * - * automatically generated from src/pyprintjson/pyprintjson.hpp.in - * see src/pyprintjson/CMakeLists.txt - */ - -/* python requires module name = library name - * example: - * PYBIND11_MODULE(PYPRINTJSON_MODULE_NAME(), m) { ... } - */ -#define PYPRINTJSON_MODULE_NAME() pyprintjson - -/* example: - * py::module_::import(PYPRINTJSON_MODULE_NAME_STR) - */ -#define PYPRINTJSON_MODULE_NAME_STR "pyprintjson" - -/* example: - * PYPRINTJSON_IMPORT_MODULE() - * replaces - * py::module_::import("pyprintjson") - */ -#define PYPRINTJSON_IMPORT_MODULE() py::module_::import("pyprintjson") - -/* end pyprintjson.hpp */