Skip to content

Commit

Permalink
Merge pull request #372 from airlied/python-build-fixes
Browse files Browse the repository at this point in the history
Python build fixes
  • Loading branch information
axsaucedo authored May 29, 2024
2 parents 51b05fe + 276306f commit 937880e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ if(KOMPUTE_OPT_INSTALL)
EXPORT komputeTargets)
endif ()

if(KOMPUTE_OPT_BUILD_PYTHON)
if(KOMPUTE_OPT_BUILD_PYTHON AND KOMPUTE_OPT_USE_BUILT_IN_PYBIND11)
# We can't export pybind11::headers because it's alias target, so we unwrap the alias and install it.
get_target_property(pybind11_aliased_target pybind11::headers ALIASED_TARGET)
install(TARGETS ${pybind11_aliased_target}
EXPORT komputeTargets)
endif ()
endif()
endif()
9 changes: 5 additions & 4 deletions src/include/kompute/logger/Logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static const char* KOMPUTE_LOG_TAG = "KomputeLog";
#else
#if KOMPUTE_BUILD_PYTHON
#include <pybind11/pybind11.h>
#include <fmt/core.h>
namespace py = pybind11;
// from python/src/main.cpp
extern py::object kp_trace, kp_debug, kp_info, kp_warning, kp_error;
Expand Down Expand Up @@ -56,7 +57,7 @@ setupLogger();
ANDROID_LOG_VERBOSE, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str()))
#else
#if KOMPUTE_BUILD_PYTHON
#define KP_LOG_DEBUG(...) kp_trace(fmt::format(__VA_ARGS__))
#define KP_LOG_TRACE(...) kp_trace(fmt::format(__VA_ARGS__))
#else
#define KP_LOG_TRACE(...) \
fmt::print("[{} {}] [trace] [{}:{}] {}\n", \
Expand Down Expand Up @@ -114,7 +115,7 @@ setupLogger();
ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str()))
#else
#if KOMPUTE_BUILD_PYTHON
#define KP_LOG_DEBUG(...) kp_info(fmt::format(__VA_ARGS__))
#define KP_LOG_INFO(...) kp_info(fmt::format(__VA_ARGS__))
#else
#define KP_LOG_INFO(...) \
fmt::print("[{} {}] [info] [{}:{}] {}\n", \
Expand All @@ -138,7 +139,7 @@ setupLogger();
ANDROID_LOG_WARN, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str()))
#else
#if KOMPUTE_BUILD_PYTHON
#define KP_LOG_DEBUG(...) kp_warning(fmt::format(__VA_ARGS__))
#define KP_LOG_WARN(...) kp_warning(fmt::format(__VA_ARGS__))
#else
#define KP_LOG_WARN(...) \
fmt::print("[{} {}] [warn] [{}:{}] {}\n", \
Expand All @@ -162,7 +163,7 @@ setupLogger();
ANDROID_LOG_ERROR, KOMPUTE_LOG_TAG, fmt::format(__VA_ARGS__).c_str()))
#else
#if KOMPUTE_BUILD_PYTHON
#define KP_LOG_DEBUG(...) kp_error(fmt::format(__VA_ARGS__))
#define KP_LOG_ERROR(...) kp_error(fmt::format(__VA_ARGS__))
#else
#define KP_LOG_ERROR(...) \
fmt::print("[{} {}] [error] [{}:{}] {}\n", \
Expand Down

0 comments on commit 937880e

Please sign in to comment.