Some fixes to linux compilation

This commit is contained in:
Thibault Lescoat
2017-03-07 17:12:23 +01:00
parent 2bc9e1d152
commit 41f0cc83fe
2 changed files with 12 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ 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( BX_AMALGAMATED "Amalgamate bx source files for faster compilation" ON )
if( NOT BX_DIR )
set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bgfx." )

View File

@@ -15,7 +15,12 @@ if( NOT IS_DIRECTORY ${BX_DIR} )
endif()
# Grab the bx source files
file( GLOB BX_SOURCES ${BX_DIR}/src/*.cpp )
if(BX_AMALGAMATED)
set(BX_SOURCES ${BX_DIR}/src/amalgamated.cpp)
else()
file( GLOB BX_SOURCES ${BX_DIR}/src/*.cpp )
list(REMOVE_ITEM ${BX_DIR}/src/amalgamated.cpp)
endif()
# Create the bx target
add_library( bx STATIC ${BX_SOURCES} )
@@ -42,10 +47,14 @@ target_compile_definitions( bx PUBLIC "__STDC_LIMIT_MACROS" )
target_compile_definitions( bx PUBLIC "__STDC_FORMAT_MACROS" )
target_compile_definitions( bx PUBLIC "__STDC_CONSTANT_MACROS" )
# Threads
# Additional dependencies on Unix
if( UNIX AND NOT APPLE )
# Threads
find_package( Threads )
target_link_libraries( bx ${CMAKE_THREAD_LIBS_INIT} dl )
# Real time (for clock_gettime)
target_link_libraries( bx rt )
endif()
# Put in a "bgfx" folder in Visual Studio