- configured use of libvpx for all platforms

MSVC uses libvpx stored in the repository if lookup for external headers and libraries failed
This commit is contained in:
alexey.lysiuk 2020-01-28 11:04:48 +02:00
parent d56fb25975
commit c0bd8f80e7
3 changed files with 38 additions and 12 deletions

View file

@ -172,6 +172,7 @@ option( NO_OPENAL "Disable OpenAL sound support" OFF )
find_package( BZip2 ) find_package( BZip2 )
find_package( JPEG ) find_package( JPEG )
find_package( VPX )
find_package( ZLIB ) find_package( ZLIB )
include( TargetArch ) include( TargetArch )
@ -228,7 +229,7 @@ if( MSVC )
# Most of these need to be cleaned out. The source is currently infested with far too much conditional compilation which is a constant source of problems. # Most of these need to be cleaned out. The source is currently infested with far too much conditional compilation which is a constant source of problems.
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUSE_OPENGL=1 /DUSE_LIBVPX /DNOASM=1 /DWIN32" ) set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUSE_OPENGL=1 /DNOASM=1 /DWIN32" )
# The CMake configurations set /GR and /MD by default, which conflict with our settings. # The CMake configurations set /GR and /MD by default, which conflict with our settings.
string(REPLACE "/MD " " " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} ) string(REPLACE "/MD " " " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} )
@ -248,7 +249,7 @@ else()
else() else()
set( ALL_C_FLAGS "-ffp-contract=off" ) set( ALL_C_FLAGS "-ffp-contract=off" )
endif() endif()
set( ALL_C_FLAGS "${ALL_C_FLAGS} -DUSE_OPENGL=1 -DNOASM=1" ) # /DUSE_LIBVPX fixme: Set up libvpx set( ALL_C_FLAGS "${ALL_C_FLAGS} -DUSE_OPENGL=1 -DNOASM=1" )
if ( UNIX ) if ( UNIX )
include(CheckSymbolExists) include(CheckSymbolExists)

8
cmake/FindVPX.cmake Normal file
View file

@ -0,0 +1,8 @@
find_path(VPX_INCLUDE_DIR NAMES vpx/vp8dx.h vpx/vpx_decoder.h)
find_library(VPX_LIBRARIES NAMES vpx)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VPX DEFAULT_MSG VPX_LIBRARIES VPX_INCLUDE_DIR)
mark_as_advanced(VPX_INCLUDE_DIR VPX_LIBRARIES)

View file

@ -69,12 +69,6 @@ if( WIN32 )
set( DX_dinput8_LIBRARY dinput8 ) set( DX_dinput8_LIBRARY dinput8 )
if( X64 )
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../platform/Windows/lib/64)
else()
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../platform/Windows/lib/32)
endif()
set( PROJECT_LIBRARIES set( PROJECT_LIBRARIES
opengl32 opengl32
wsock32 wsock32
@ -433,11 +427,34 @@ if (HAVE_VULKAN)
set( PROJECT_LIBRARIES ${PROJECT_LIBRARIES} "glslang" "SPIRV" "OGLCompiler") set( PROJECT_LIBRARIES ${PROJECT_LIBRARIES} "glslang" "SPIRV" "OGLCompiler")
endif() endif()
# Ugh... These precompiled dependencies need to go. # VPX
if (WIN32)
include_directories( "platform/win32" "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GDTOA_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include/vpx") if( MSVC AND NOT VPX_FOUND )
# Use prebuilt library
set( VPX_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../platform/Windows" )
set( VPX_INCLUDE_DIR ${VPX_ROOT_PATH}/include )
set( VPX_LIBRARIES libvpx libcompat-to-msvc )
if( X64 )
link_directories( ${VPX_ROOT_PATH}/lib/64 )
else() else()
link_directories( ${VPX_ROOT_PATH}/lib/32 )
# Workaround for "error LNK2026: module unsafe for SAFESEH image."
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO" )
endif()
set( VPX_FOUND TRUE )
endif()
if( VPX_FOUND )
add_definitions( "-DUSE_LIBVPX=1" )
include_directories( "${VPX_INCLUDE_DIR}" )
set( PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${VPX_LIBRARIES} )
endif()
include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GDTOA_INCLUDE_DIR}" ) include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GDTOA_INCLUDE_DIR}" )
if (WIN32)
include_directories( "platform/win32" )
endif() endif()