Skip to content

Commit

Permalink
build glfw as a dynamic library
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Nov 15, 2022
1 parent 5bb4e04 commit 4ebefe9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmake/add_hello_imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ function (add_hello_imgui)
enable_language(OBJC) # See https://gitlab.kitware.com/cmake/cmake/-/issues/24104
endif()

# 2.1 Build glfw (also used by hello_imgui)
# 2.1 Build glfw as a *shared* library (this is required if we want to be able to use python bindings
# for glfw, using https://github.com/FlorianRhiem/pyGLFW)
# Note: the rpath is set by a call to
# lg_target_set_rpath(${python_native_module_name} ".")
# (inside add_imgui_bundle_bindings)
set(BUILD_SHARED_LIBS ON)
add_subdirectory(external/glfw)
install(TARGETS glfw DESTINATION .)
set(BUILD_SHARED_LIBS OFF)

if (UNIX AND NOT APPLE)
# Those are only needed for wheels build using cibuildwheel (cp36-manylinux_x86_64 wheel)
# See https://bytemeta.vip/repo/glfw/glfw/issues/2139
Expand Down
1 change: 1 addition & 0 deletions cmake/add_imgui_bundle_bindings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ function(add_imgui_bundle_bindings)
target_link_libraries(${python_native_module_name} PUBLIC cvnp)
endif()

lg_target_set_rpath(${python_native_module_name} ".")
target_link_libraries(${python_native_module_name} PUBLIC ${bound_library})
endfunction()

0 comments on commit 4ebefe9

Please sign in to comment.