Added install target

This commit is contained in:
Joshua Brookover
2016-09-17 16:27:37 -05:00
parent 68fed30b60
commit a3e5caeaf5
3 changed files with 22 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ endif()
option( BGFX_BUILD_TOOLS "Build bgfx tools." ON )
option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON )
option( BGFX_INSTALL "Create installation target." ON )
option( BGFX_USE_OVR "Build with OVR support." OFF )
if( BGFX_USE_OVR )
@@ -36,3 +38,18 @@ endif()
if( BGFX_BUILD_EXAMPLES )
include( cmake/examples.cmake )
endif()
if( BGFX_INSTALL )
# install bx
install( DIRECTORY ${BX_DIR}/include DESTINATION . )
# install bgfx
install( TARGETS bgfx DESTINATION lib )
install( DIRECTORY ${BGFX_DIR}/include DESTINATION . )
# install tools
if( BGFX_BUILD_TOOLS )
install( TARGETS shaderc DESTINATION bin )
install( TARGETS geometryc DESTINATION bin )
endif()
endif()

View File

@@ -79,3 +79,6 @@ endif()
# Put in a "bgfx" folder in Visual Studio
set_target_properties( bgfx PROPERTIES FOLDER "bgfx" )
# Export debug build as "bgfxd"
set_target_properties( bgfx PROPERTIES OUTPUT_NAME_DEBUG "bgfxd" )

View File

@@ -100,12 +100,12 @@ function( add_example ARG_NAME )
# Add target
if( ARG_COMMON )
add_library( example-${ARG_NAME} STATIC ${SOURCES} )
add_library( example-${ARG_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES} )
target_compile_definitions( example-${ARG_NAME} PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS" )
target_include_directories( example-${ARG_NAME} PUBLIC ${BGFX_DIR}/examples/common )
target_link_libraries( example-${ARG_NAME} PUBLIC bgfx ib-compress ocornut-imgui )
else()
add_executable( example-${ARG_NAME} WIN32 ${SOURCES} )
add_executable( example-${ARG_NAME} WIN32 EXCLUDE_FROM_ALL ${SOURCES} )
target_compile_definitions( example-${ARG_NAME} PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS" )
target_link_libraries( example-${ARG_NAME} example-common )
configure_debugging( example-${ARG_NAME} WORKING_DIR ${BGFX_DIR}/examples/runtime )