Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some corrections in CMake file #1

Open
tinyAdapter opened this issue Jul 21, 2022 · 0 comments
Open

Some corrections in CMake file #1

tinyAdapter opened this issue Jul 21, 2022 · 0 comments

Comments

@tinyAdapter
Copy link

Hi, I'm interested in your great work on supporting multiple interpreters in one process.

After testing the sample code in this repo, I have two corrections to the CMake file.

  1. CMake complains about missing cmake_minimum_required.
  2. It seems that you missed src/loader.cpp in the find_shared_function library, which will give me an unresolved symbol error when running the main program.

I use the following CMakelists.txt to successfully build the sample code:

cmake_minimum_required(VERSION 3.17)

project(singleprocessmultiprocess)
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(third_party/fmt)

find_package(Python COMPONENTS Development)
add_library(python_runner SHARED src/python_runner.cpp)
target_include_directories(python_runner PRIVATE third_party/pybind11/include ${Python_INCLUDE_DIRS})

add_library(find_shared_function SHARED src/find_shared_function.cpp src/loader.cpp)
target_link_libraries(find_shared_function PRIVATE fmt::fmt-header-only)

add_executable(main src/main.cpp src/loader.cpp)
target_compile_definitions(main PRIVATE PYTHON_SO_PATH=\"${Python_LIBRARIES}\")
target_link_libraries(main PRIVATE dl pthread fmt::fmt-header-only)

I recommend choosing 3.17 as the minimum required because it introduces the ability to resolve Python paths in an Anaconda environment.

I also have a question about the implementation, for which I will open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant