mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Some fixes to linux compilation
This commit is contained in:
@@ -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." )
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user