2022-08-11 15:41:10 +08:00
|
|
|
macro(ax_depend)
|
2019-11-23 20:27:39 +08:00
|
|
|
# confim the libs, prepare to link
|
|
|
|
set(PLATFORM_SPECIFIC_LIBS)
|
|
|
|
|
2022-02-17 17:11:17 +08:00
|
|
|
message(STATUS "AX_USE_ALSOFT=${AX_USE_ALSOFT}")
|
2020-08-17 19:18:18 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
if(WINDOWS)
|
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS ws2_32 userenv psapi winmm Version Iphlpapi opengl32)
|
2023-03-11 22:10:18 +08:00
|
|
|
if(WINRT)
|
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS windowscodecs Advapi32 runtimeobject Dwrite)
|
|
|
|
endif()
|
2019-11-23 20:27:39 +08:00
|
|
|
elseif(LINUX)
|
|
|
|
# need review those libs: X11 Xi Xrandr Xxf86vm Xinerama Xcursor rt m
|
2023-09-02 19:56:50 +08:00
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS dl X11 Xi Xrandr Xxf86vm Xinerama Xcursor rt m)
|
2023-06-13 00:10:53 +08:00
|
|
|
if(_AX_HAVE_VLC)
|
2023-06-10 22:05:49 +08:00
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS vlc vlccore)
|
|
|
|
endif()
|
2019-11-23 20:27:39 +08:00
|
|
|
# use older cmake style on below linux libs
|
2022-08-11 15:41:10 +08:00
|
|
|
ax_find_package(Fontconfig FONTCONFIG REQUIRED)
|
|
|
|
ax_find_package(GTK3 GTK3 REQUIRED)
|
|
|
|
# ax_find_package(ZLIB ZLIB REQUIRED)
|
|
|
|
# ax_find_package(PNG PNG REQUIRED)
|
|
|
|
# ax_find_package(GLEW GLEW REQUIRED)
|
|
|
|
ax_find_package(OpenGL OPENGL REQUIRED)
|
|
|
|
# ax_find_package(CURL CURL REQUIRED)
|
|
|
|
# ax_find_package(SQLite3 SQLITE3 REQUIRED)
|
2019-11-23 20:27:39 +08:00
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
set(THREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
elseif(ANDROID)
|
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS GLESv2 EGL log android OpenSLES)
|
|
|
|
elseif(APPLE)
|
|
|
|
include_directories(/System/Library/Frameworks)
|
|
|
|
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
|
|
|
find_library(FOUNDATION_LIBRARY Foundation)
|
|
|
|
find_library(QUARTZCORE_LIBRARY QuartzCore)
|
|
|
|
find_library(GAMECONTROLLER_LIBRARY GameController)
|
|
|
|
find_library(METAL_LIBRARY Metal)
|
2023-03-25 08:37:51 +08:00
|
|
|
find_library(COREVIDEO_LIBRARY CoreVideo)
|
|
|
|
find_library(AVFOUNDATION_LIBRARY AVFoundation)
|
|
|
|
find_library(COREMEDIA_LIBRARY CoreMedia)
|
2022-08-11 15:41:10 +08:00
|
|
|
set(_AX_APPLE_LIBS
|
2019-11-23 20:27:39 +08:00
|
|
|
${AUDIOTOOLBOX_LIBRARY}
|
|
|
|
${QUARTZCORE_LIBRARY}
|
|
|
|
${FOUNDATION_LIBRARY}
|
|
|
|
${GAMECONTROLLER_LIBRARY}
|
|
|
|
${METAL_LIBRARY}
|
2023-03-25 08:37:51 +08:00
|
|
|
${COREVIDEO_LIBRARY}
|
|
|
|
${AVFOUNDATION_LIBRARY}
|
|
|
|
${COREMEDIA_LIBRARY}
|
2019-11-23 20:27:39 +08:00
|
|
|
)
|
2020-07-31 00:06:59 +08:00
|
|
|
|
2022-02-17 17:11:17 +08:00
|
|
|
if(NOT AX_USE_ALSOFT)
|
2020-07-31 00:06:59 +08:00
|
|
|
find_library(OPENAL_LIBRARY OpenAL)
|
2022-08-11 15:41:10 +08:00
|
|
|
set(_AX_APPLE_LIBS
|
2020-07-31 00:06:59 +08:00
|
|
|
${OPENAL_LIBRARY}
|
2022-08-11 15:41:10 +08:00
|
|
|
${_AX_APPLE_LIBS}
|
2020-07-31 00:06:59 +08:00
|
|
|
)
|
|
|
|
endif()
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
if(MACOSX)
|
|
|
|
list(APPEND PREBUILT_SPECIFIC_LIBS GLFW3)
|
|
|
|
|
|
|
|
find_library(COCOA_LIBRARY Cocoa)
|
|
|
|
find_library(OPENGL_LIBRARY OpenGL)
|
|
|
|
find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices)
|
|
|
|
find_library(IOKIT_LIBRARY IOKit)
|
|
|
|
find_library(APPKIT_LIBRARY AppKit)
|
2022-06-12 22:26:54 +08:00
|
|
|
#find_library(ICONV_LIBRARY iconv)
|
2020-10-06 20:55:38 +08:00
|
|
|
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
|
|
|
find_library(COREAUDIO_LIBRARY CoreAudio)
|
2021-09-20 18:18:52 +08:00
|
|
|
find_library(SYSTEMCONFIGURATION_LIBRARY SystemConfiguration)
|
2019-11-23 20:27:39 +08:00
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS
|
|
|
|
${COCOA_LIBRARY}
|
|
|
|
${OPENGL_LIBRARY}
|
|
|
|
${APPLICATIONSERVICES_LIBRARY}
|
|
|
|
${IOKIT_LIBRARY}
|
2022-08-11 15:41:10 +08:00
|
|
|
${_AX_APPLE_LIBS}
|
2019-11-23 20:27:39 +08:00
|
|
|
${APPKIT_LIBRARY}
|
2022-06-12 22:26:54 +08:00
|
|
|
#${ICONV_LIBRARY}
|
2020-10-06 20:55:38 +08:00
|
|
|
${AUDIOUNIT_LIBRARY}
|
|
|
|
${COREAUDIO_LIBRARY}
|
2021-09-20 18:18:52 +08:00
|
|
|
${SYSTEMCONFIGURATION_LIBRARY}
|
2019-11-23 20:27:39 +08:00
|
|
|
)
|
|
|
|
elseif(IOS)
|
|
|
|
# Locate system libraries on iOS
|
|
|
|
find_library(UIKIT_LIBRARY UIKit)
|
2022-09-05 14:13:52 +08:00
|
|
|
find_library(OPENGLES_LIBRARY OpenGLES)
|
2019-11-23 20:27:39 +08:00
|
|
|
find_library(AVKIT_LIBRARY AVKit)
|
2023-03-25 08:37:51 +08:00
|
|
|
# find_library(CORE_MEDIA_LIBRARY CoreMedia)
|
2019-11-23 20:27:39 +08:00
|
|
|
find_library(CORE_TEXT_LIBRARY CoreText)
|
|
|
|
find_library(SECURITY_LIBRARY Security)
|
|
|
|
find_library(CORE_GRAPHICS_LIBRARY CoreGraphics)
|
2023-03-25 08:37:51 +08:00
|
|
|
# find_library(AV_FOUNDATION_LIBRARY AVFoundation)
|
2021-04-22 22:01:47 +08:00
|
|
|
find_library(ZLIB z)
|
2022-06-12 22:26:54 +08:00
|
|
|
#find_library(ICONVLIB iconv)
|
2022-09-05 14:13:52 +08:00
|
|
|
|
|
|
|
if(NOT TVOS)
|
|
|
|
find_library(CORE_MOTION_LIBRARY CoreMotion)
|
|
|
|
find_library(WEBKIT_LIBRARY WebKit)
|
|
|
|
endif()
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS
|
|
|
|
${UIKIT_LIBRARY}
|
|
|
|
${OPENGLES_LIBRARY}
|
|
|
|
${AVKIT_LIBRARY}
|
|
|
|
${CORE_MEDIA_LIBRARY}
|
|
|
|
${CORE_TEXT_LIBRARY}
|
|
|
|
${SECURITY_LIBRARY}
|
|
|
|
${CORE_GRAPHICS_LIBRARY}
|
|
|
|
${AV_FOUNDATION_LIBRARY}
|
2022-08-11 15:41:10 +08:00
|
|
|
${_AX_APPLE_LIBS}
|
2021-04-22 22:01:47 +08:00
|
|
|
${ZLIB}
|
2022-06-12 22:26:54 +08:00
|
|
|
#${ICONVLIB}
|
2019-11-23 20:27:39 +08:00
|
|
|
)
|
2022-09-05 14:13:52 +08:00
|
|
|
|
|
|
|
if(NOT TVOS)
|
|
|
|
list(APPEND PLATFORM_SPECIFIC_LIBS
|
|
|
|
${CORE_MOTION_LIBRARY}
|
|
|
|
${WEBKIT_LIBRARY}
|
|
|
|
)
|
|
|
|
endif()
|
2019-11-23 20:27:39 +08:00
|
|
|
endif()
|
2023-09-05 21:10:25 +08:00
|
|
|
elseif(WASM)
|
|
|
|
list(APPEND openal) # refer to: https://emscripten.org/docs/porting/Audio.html
|
2019-11-23 20:27:39 +08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
macro(use_ax_depend target)
|
2022-08-11 15:41:10 +08:00
|
|
|
ax_depend()
|
2019-11-23 20:27:39 +08:00
|
|
|
foreach(platform_lib ${PLATFORM_SPECIFIC_LIBS})
|
|
|
|
target_link_libraries(${target} ${platform_lib})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(LINUX)
|
2022-08-11 15:41:10 +08:00
|
|
|
ax_use_pkg(${target} FONTCONFIG)
|
|
|
|
ax_use_pkg(${target} GTK3)
|
|
|
|
#ax_use_pkg(${target} ZLIB)
|
|
|
|
#ax_use_pkg(${target} PNG)
|
|
|
|
#ax_use_pkg(${target} GLEW)
|
|
|
|
ax_use_pkg(${target} OPENGL)
|
|
|
|
#ax_use_pkg(${target} CURL)
|
|
|
|
ax_use_pkg(${target} THREADS)
|
|
|
|
#ax_use_pkg(${target} SQLITE3)
|
2019-11-23 20:27:39 +08:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|