diff --git a/CMakeLists.txt b/CMakeLists.txt index 47a65b3..9698cba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,8 +37,6 @@ if(${CERES_VERSION} VERSION_LESS "2.2.0") add_definitions("-DCERES_PARAMETERIZATION_ENABLED") endif() -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/madpose) - add_subdirectory(ext/pybind11) include_directories( diff --git a/setup.py b/setup.py index da0a005..bcfca92 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ def build_extension(self, ext: CMakeExtension) -> None: # EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code # from Python. cmake_args = [ - f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}", + f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}{ext.name}", f"-DPYTHON_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm ] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bef7b6f..23958d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,4 +19,9 @@ target_link_libraries(madpose PRIVATE PoseLib::PoseLib Ceres::ceres ${OpenCV_LIBS} -) \ No newline at end of file +) + +add_custom_command(TARGET madpose POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_SOURCE_DIR}/madpose + COMMENT "Copying madpose library to ${CMAKE_SOURCE_DIR}/madpose" +)