Skip to content

Some corrections in CMake file #1

Description

@tinyAdapter

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions