From a3e5caeaf5af49d3210a2c52584adfe0ff90708a Mon Sep 17 00:00:00 2001 From: Joshua Brookover Date: Sat, 17 Sep 2016 16:27:37 -0500 Subject: [PATCH] Added install target --- CMakeLists.txt | 17 +++++++++++++++++ cmake/bgfx.cmake | 3 +++ cmake/examples.cmake | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f66694d..b895c2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/bgfx.cmake b/cmake/bgfx.cmake index 0223450..6f08449 100755 --- a/cmake/bgfx.cmake +++ b/cmake/bgfx.cmake @@ -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" ) diff --git a/cmake/examples.cmake b/cmake/examples.cmake index 1b2dc5d..7eb0bd9 100755 --- a/cmake/examples.cmake +++ b/cmake/examples.cmake @@ -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 )