build: add pthreads w/vcpkg, link FAudio target
In preparation for including the finished FAudio support, link the cmake FAudio target FAudio::FAudio when the feature is enabled. Add pthreads to vcpkg deps and use the installed PThreads4W on Windows. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
215e3c5ae9
commit
ecb69a240a
|
@ -45,7 +45,7 @@ if(TAG_RELEASE)
|
||||||
include(MakeReleaseCommitAndTag)
|
include(MakeReleaseCommitAndTag)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(VCPKG_DEPS pkgconf zlib "sdl2[samplerate]" gettext wxwidgets)
|
set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext wxwidgets)
|
||||||
|
|
||||||
set(VCPKG_DEPS_OPTIONAL
|
set(VCPKG_DEPS_OPTIONAL
|
||||||
sfml ENABLE_LINK
|
sfml ENABLE_LINK
|
||||||
|
@ -417,6 +417,28 @@ if(ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS)
|
||||||
set(ASM_ENABLED ON)
|
set(ASM_ENABLED ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
find_library(PTHREAD_LIB pthread)
|
||||||
|
if(PTHREAD_LIB)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${PTHREAD_LIB})
|
||||||
|
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${PTHREAD_LIB})
|
||||||
|
endif()
|
||||||
|
elseif(MINGW)
|
||||||
|
if(NOT VBAM_STATIC)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lpthread)
|
||||||
|
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} -lpthread)
|
||||||
|
else()
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic")
|
||||||
|
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} "-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(PThreads4W)
|
||||||
|
if(PThreads4W_FOUND)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} PThreads4W::PThreads4W)
|
||||||
|
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} PThreads4W::PThreads4W)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Look for some dependencies using CMake scripts
|
# Look for some dependencies using CMake scripts
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
|
|
||||||
|
@ -509,22 +531,6 @@ if(ENABLE_LINK)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
find_library(PTHREAD_LIB pthread)
|
|
||||||
if(PTHREAD_LIB)
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${PTHREAD_LIB})
|
|
||||||
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${PTHREAD_LIB})
|
|
||||||
endif()
|
|
||||||
elseif(MINGW)
|
|
||||||
if(NOT VBAM_STATIC)
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lpthread)
|
|
||||||
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} -lpthread)
|
|
||||||
else()
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic")
|
|
||||||
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} "-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
||||||
if(SEM_TIMEDWAIT)
|
if(SEM_TIMEDWAIT)
|
||||||
|
|
|
@ -55,7 +55,7 @@ endif()
|
||||||
|
|
||||||
if(ENABLE_FAUDIO)
|
if(ENABLE_FAUDIO)
|
||||||
find_package(FAudio REQUIRED)
|
find_package(FAudio REQUIRED)
|
||||||
list(APPEND VBAM_LIBS FAudio)
|
list(APPEND VBAM_LIBS FAudio::FAudio)
|
||||||
else()
|
else()
|
||||||
add_definitions(-DNO_FAUDIO)
|
add_definitions(-DNO_FAUDIO)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue