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)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(xo_pyreflect VERSION 0.1)
|
project(xo_pyreflect VERSION 0.1)
|
||||||
enable_language(CXX)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(cmake/xo-bootstrap-macros.cmake)
|
include(cmake/xo-bootstrap-macros.cmake)
|
||||||
|
|
@ -17,9 +16,7 @@ set(PROJECT_CXX_FLAGS "")
|
||||||
add_definitions(${PROJECT_CXX_FLAGS})
|
add_definitions(${PROJECT_CXX_FLAGS})
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# sources
|
|
||||||
|
|
||||||
# note: library=pyreflect (not xo_pyreflect) -> establishes pyreflectTargets
|
|
||||||
add_subdirectory(src/pyreflect)
|
add_subdirectory(src/pyreflect)
|
||||||
#add_subdirectory(utest)
|
#add_subdirectory(utest)
|
||||||
|
|
||||||
|
|
@ -27,3 +24,5 @@ add_subdirectory(src/pyreflect)
|
||||||
# provide find_package() support
|
# provide find_package() support
|
||||||
|
|
||||||
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
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
|
# for example:
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake)
|
# $ 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()
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}")
|
||||||
|
|
||||||
if (NOT XO_SUBMODULE_BUILD)
|
if (NOT XO_SUBMODULE_BUILD)
|
||||||
message("-- CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix))
|
||||||
message("-- CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
|
# 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()
|
endif()
|
||||||
|
|
||||||
# needs to have been installed somewhere on 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)
|
# (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_LIB xo_pyreflect)
|
||||||
set(SELF_SRCS pyreflect.cpp)
|
set(SELF_SRCS pyreflect.cpp)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
|
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
|
||||||
xo_pybind11_dependency(${SELF_LIB} reflect)
|
xo_pybind11_dependency(${SELF_LIB} reflect)
|
||||||
xo_pybind11_dependency(${SELF_LIB} xo_pyutil)
|
xo_pybind11_dependency(${SELF_LIB} xo_pyutil)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,12 @@ namespace xo {
|
||||||
//py::class_<utc_nanos>(m, "utc_nanos");
|
//py::class_<utc_nanos>(m, "utc_nanos");
|
||||||
|
|
||||||
//py::class_<TypeDescrImpl>(m, "TypeDescr");
|
//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,
|
py::class_<TypeDescrBase,
|
||||||
unowned_ptr<TypeDescrBase>>(m, "TypeDescr")
|
unowned_ptr<TypeDescrBase>>(m, "TypeDescr")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue