From 92aa04bd00bfdee18881db4af44c21b9f014f575 Mon Sep 17 00:00:00 2001 From: Joshua Brookover Date: Sun, 18 Sep 2016 02:45:49 -0500 Subject: [PATCH] Cleanup and fixed first time generation. --- CMakeLists.txt | 15 ++++++++++----- cmake/3rdparty/ocornut-imgui.cmake | 2 +- cmake/bgfx.cmake | 9 +-------- cmake/bx.cmake | 5 ----- cmake/shared.cmake | 7 +++++++ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b895c2c..e798585 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,12 +16,17 @@ if( APPLE ) set( CMAKE_CXX_FLAGS "-ObjC++" ) endif() -option( BGFX_BUILD_TOOLS "Build bgfx tools." ON ) -option( BGFX_BUILD_EXAMPLES "Build bgfx examples." ON ) +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 ) -option( BGFX_INSTALL "Create installation target." ON ) - -option( BGFX_USE_OVR "Build with OVR support." OFF ) +if( NOT BX_DIR ) + set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bgfx." ) +endif() +if( NOT BGFX_DIR ) + set( BGFX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bgfx" CACHE STRING "Location of bgfx." ) +endif() if( BGFX_USE_OVR ) include( cmake/ovr.cmake ) diff --git a/cmake/3rdparty/ocornut-imgui.cmake b/cmake/3rdparty/ocornut-imgui.cmake index b7cc51c..cd9d256 100644 --- a/cmake/3rdparty/ocornut-imgui.cmake +++ b/cmake/3rdparty/ocornut-imgui.cmake @@ -14,7 +14,7 @@ endif() file( GLOB OCORNUT_IMGUI_SOURCES ${BGFX_DIR}/3rdparty/ocornut-imgui/*.cpp ${BGFX_DIR}/3rdparty/ocornut-imgui/*.h ${BGFX_DIR}/3rdparty/ocornut-imgui/*.inl ) -add_library( ocornut-imgui STATIC ${OCORNUT_IMGUI_SOURCES} ) +add_library( ocornut-imgui STATIC EXCLUDE_FROM_ALL ${OCORNUT_IMGUI_SOURCES} ) target_compile_definitions( ocornut-imgui PRIVATE "-D_CRT_SECURE_NO_WARNINGS" "-D__STDC_FORMAT_MACROS" ) target_include_directories( ocornut-imgui PUBLIC ${BGFX_DIR}/3rdparty ) target_link_libraries( ocornut-imgui PUBLIC bx ) diff --git a/cmake/bgfx.cmake b/cmake/bgfx.cmake index 6f08449..ce94064 100755 --- a/cmake/bgfx.cmake +++ b/cmake/bgfx.cmake @@ -8,11 +8,6 @@ # You should have received a copy of the CC0 Public Domain Dedication along with # this software. If not, see . -# The bgfx location is customizable via cache variable BGFX_DIR -if( NOT BGFX_DIR ) - set( BGFX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bgfx" CACHE STRING "Location of bgfx." ) -endif() - # Ensure the directory exists if( NOT IS_DIRECTORY ${BGFX_DIR} ) message( SEND_ERROR "Could not load bgfx, directory does not exist. ${BGFX_DIR}" ) @@ -52,15 +47,13 @@ endif() # Frameworks required on OS X if( APPLE ) - find_library( CARBON_LIBRARY Carbon ) find_library( COCOA_LIBRARY Cocoa ) find_library( METAL_LIBRARY Metal ) find_library( QUARTZCORE_LIBRARY QuartzCore ) - mark_as_advanced( CARBON_LIBRARY ) mark_as_advanced( COCOA_LIBRARY ) mark_as_advanced( METAL_LIBRARY ) mark_as_advanced( QUARTZCORE_LIBRARY ) - target_link_libraries( bgfx PUBLIC ${CARBON_LIBRARY} ${COCOA_LIBRARY} ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY} ) + target_link_libraries( bgfx PUBLIC ${COCOA_LIBRARY} ${METAL_LIBRARY} ${QUARTZCORE_LIBRARY} ) endif() # Excluded files from compilation diff --git a/cmake/bx.cmake b/cmake/bx.cmake index 2349de1..54c6778 100644 --- a/cmake/bx.cmake +++ b/cmake/bx.cmake @@ -8,11 +8,6 @@ # You should have received a copy of the CC0 Public Domain Dedication along with # this software. If not, see . -# The bx location is customizable via cache variable BX_DIR -if( NOT BX_DIR ) - set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bgfx." ) -endif() - # Ensure the directory exists if( NOT IS_DIRECTORY ${BX_DIR} ) message( SEND_ERROR "Could not load bx, directory does not exist. ${BX_DIR}" ) diff --git a/cmake/shared.cmake b/cmake/shared.cmake index 7cbc1ec..00d6ddf 100644 --- a/cmake/shared.cmake +++ b/cmake/shared.cmake @@ -16,3 +16,10 @@ add_library( bgfx-bounds INTERFACE ) target_sources( bgfx-bounds INTERFACE ${BGFX_DIR}/examples/common/bounds.cpp ) target_include_directories( bgfx-bounds INTERFACE ${BGFX_DIR}/include ) target_include_directories( bgfx-bounds INTERFACE ${BGFX_DIR}/examples/common ) + +# Frameworks required on OS X +if( APPLE ) + find_library( COCOA_LIBRARY Cocoa ) + mark_as_advanced( COCOA_LIBRARY ) + target_link_libraries( bgfx-vertexdecl INTERFACE ${COCOA_LIBRARY} ) +endif()