Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Fixes to installing as shared #100

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ set( BGFX_LIBRARY_TYPE "STATIC" CACHE STRING "Linking type for library" )

set_property( CACHE BGFX_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED )

if( BGFX_LIBRARY_TYPE MATCHES "SHARED" )
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

if( NOT BX_DIR )
set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." )
elseif( NOT IS_ABSOLUTE "${BX_DIR}")
Expand Down Expand Up @@ -118,13 +122,22 @@ if( BGFX_INSTALL )
install(FILES ${BGFX_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})

install( TARGETS bgfx bimg bx astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc
install( TARGETS bgfx
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
if( NOT BGFX_LIBRARY_TYPE MATCHES "SHARED" )
install( TARGETS bimg bx astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
endif()
if (BGFX_CONFIG_RENDERER_WEBGPU)
install( TARGETS webgpu
EXPORT "${TARGETS_EXPORT_NAME}"
Expand Down
2 changes: 1 addition & 1 deletion cmake/bgfx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ target_include_directories( bgfx
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

# bgfx depends on bx and bimg
target_link_libraries( bgfx PUBLIC bx bimg )
target_link_libraries( bgfx PRIVATE bx bimg )

# ovr support
if( BGFX_USE_OVR )
Expand Down
2 changes: 1 addition & 1 deletion cmake/bimg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ target_include_directories( bimg
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

# bimg dependencies
target_link_libraries( bimg bx astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc )
target_link_libraries( bimg PUBLIC bx PRIVATE astc-codec astc edtaa3 etc1 etc2 iqa squish nvtt pvrtc )

# Put in a "bgfx" folder in Visual Studio
set_target_properties( bimg PROPERTIES FOLDER "bgfx" )
2 changes: 1 addition & 1 deletion cmake/examples.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function( add_example ARG_NAME )
if( ARG_COMMON )
add_library( example-${ARG_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES} )
target_include_directories( example-${ARG_NAME} PUBLIC ${BGFX_DIR}/examples/common )
target_link_libraries( example-${ARG_NAME} PUBLIC bgfx dear-imgui meshoptimizer )
target_link_libraries( example-${ARG_NAME} PUBLIC bgfx bx bimg dear-imgui meshoptimizer )
if( BGFX_WITH_GLFW )
find_package( glfw3 REQUIRED )
target_link_libraries( example-${ARG_NAME} PUBLIC glfw )
Expand Down