Merge branch 'main' of github.com:Rconybea/xo-pyreflect
This commit is contained in:
commit
92c4cda97f
4 changed files with 37 additions and 9 deletions
|
|
@ -3,7 +3,6 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(xo_pyreflect VERSION 0.1)
|
||||
enable_language(CXX)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(cmake/xo-bootstrap-macros.cmake)
|
||||
|
|
@ -17,9 +16,7 @@ set(PROJECT_CXX_FLAGS "")
|
|||
add_definitions(${PROJECT_CXX_FLAGS})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# sources
|
||||
|
||||
# note: library=pyreflect (not xo_pyreflect) -> establishes pyreflectTargets
|
||||
add_subdirectory(src/pyreflect)
|
||||
#add_subdirectory(utest)
|
||||
|
||||
|
|
@ -27,3 +24,5 @@ add_subdirectory(src/pyreflect)
|
|||
# provide find_package() support
|
||||
|
||||
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
||||
|
||||
# end CMakeLists.txt
|
||||
|
|
|
|||
|
|
@ -1,14 +1,35 @@
|
|||
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)
|
||||
# ----------------------------------------------------------------
|
||||
# for example:
|
||||
# $ PREFIX=/usr/local # for example
|
||||
# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build
|
||||
#
|
||||
# will get
|
||||
# CMAKE_MODULE_PATH
|
||||
# from xo-cmake-config --cmake-module-path
|
||||
#
|
||||
# and expect .cmake macros in
|
||||
# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED)
|
||||
|
||||
if ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND")
|
||||
message(FATAL "could not find xo-cmake-config executable")
|
||||
endif()
|
||||
|
||||
message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}")
|
||||
|
||||
if (NOT XO_SUBMODULE_BUILD)
|
||||
message("-- CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
||||
message("-- CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
|
||||
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix))
|
||||
# default to typical install location for xo-project-macros
|
||||
execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH)
|
||||
message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
include(xo_macros/xo_cxx)
|
||||
|
||||
xo_cxx_bootstrap_message()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
set(SELF_LIB xo_pyreflect)
|
||||
set(SELF_SRCS pyreflect.cpp)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
|
||||
xo_pybind11_dependency(${SELF_LIB} reflect)
|
||||
xo_pybind11_dependency(${SELF_LIB} xo_pyutil)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ namespace xo {
|
|||
//py::class_<utc_nanos>(m, "utc_nanos");
|
||||
|
||||
//py::class_<TypeDescrImpl>(m, "TypeDescr");
|
||||
/* TypeDescrBase instances are created automatically at library load time
|
||||
* by static initializers. The reflection library (xo-reflect) is responsible
|
||||
* for lifetime of TypeDescrobjects. Under no circumstances should python
|
||||
* (or pybind11) directly destroy a TypeDescrImpl instance, hence use of
|
||||
* unowned_ptr<TypeDescrBase> here.
|
||||
*/
|
||||
py::class_<TypeDescrBase,
|
||||
unowned_ptr<TypeDescrBase>>(m, "TypeDescr")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue