Skip to content

Commit

Permalink
Merge pull request #63 from N3PDF/fixescmake
Browse files Browse the repository at this point in the history
upgrading c-api cmake
  • Loading branch information
scarrazza authored Jan 23, 2024
2 parents 6c0110d + af869d1 commit 0546ddb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions capi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.0.2)
cmake_minimum_required (VERSION 3.0.2...3.28.1)

# Use rpaths for now, previously there were issues with osx
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
Expand All @@ -13,25 +13,25 @@ project(libpdfflow)

set(VERSION "\"0.1\"")

find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
find_package(Python3 COMPONENTS Interpreter Development)

# running the cffi builder
if (NOT EXISTS ${PROJECT_SOURCE_DIR/src/cpdfflow.cc})
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/build.py WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
execute_process(COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/build.py WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
endif()

include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${Python3_INCLUDE_DIRS})
include_directories(src)
add_library(pdfflow SHARED ${PROJECT_SOURCE_DIR}/src/cpdfflow.c)
target_link_libraries(pdfflow ${Python3_LIBRARIES})

# pkg-config
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "${prefix}")
set(includedir "${prefix}/include")
set(extraincludirs "-I${PYTHON_INCLUDE_DIR}")
set(extraincludirs "-I${Python3_INCLUDE_DIRS}")
set(libdir "${prefix}/lib")
set(pythonlibs "${PYTHON_LIBRARIES}")
set(pythonlibs "${Python3_LIBRARIES}")

configure_file(
"${PROJECT_SOURCE_DIR}/src/pdfflow.pc.in"
Expand All @@ -40,4 +40,4 @@ configure_file(

install(FILES ${PROJECT_SOURCE_DIR}/src/pdfflow.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/pdfflow DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(TARGETS pdfflow LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS pdfflow LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
3 changes: 2 additions & 1 deletion capi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ pkg-config pdfflow --cflags
pkg-config pdfflow --libs
```

If you installed to a non-standard location, you need to set up the `PKG_CONFIG_PATH` and `LD_LIBRARY_PATH`, e.g.:
If you installed to a non-standard location, you need to set up the `PKG_CONFIG_PATH` and `LD_LIBRARY_PATH`, e.g., for a `VIRTUAL_ENV`:
```bash
export PKG_CONFIG_PATH=${VIRTUAL_ENV}/lib/pkgconfig/:${PKG_CONFIG_PATH}:
export LD_LIBRARY_PATH=${VIRTUAL_ENV}/lib/:${LD_LIBRARY_PATH}:
export DYLD_LIBRARY_PATH=${VIRTUAL_ENV}/lib:${DYLD_LIBRARY_PATH}:
```


Expand Down

0 comments on commit 0546ddb

Please sign in to comment.