2021-04-21 14:05:44 +08:00
|
|
|
|
2021-06-08 20:45:55 +08:00
|
|
|
project(thirdparty)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2022-02-17 17:11:17 +08:00
|
|
|
if (NOT DEFINED AX_USE_ALSOFT)
|
|
|
|
if(NOT APPLE)
|
|
|
|
set(AX_USE_ALSOFT ON)
|
|
|
|
else()
|
2023-05-25 16:54:30 +08:00
|
|
|
set(AX_USE_ALSOFT OFF)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif()
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
2021-08-13 13:54:18 +08:00
|
|
|
option(OPT_BOX2D_OPTIMIZED "" OFF)
|
2022-02-17 17:11:17 +08:00
|
|
|
option(AX_WITH_BOX2D "Build with internal Box2D support" ON)
|
|
|
|
option(AX_WITH_CHIPMUNK "Build with internal chipmunk support" ON)
|
|
|
|
option(AX_WITH_FREETYPE "Build with internal freetype support" ON)
|
|
|
|
option(AX_WITH_RECAST "Build with internal recast support" ON)
|
|
|
|
option(AX_WITH_BULLET "Build with internal bullet support" ON)
|
|
|
|
option(AX_WITH_JPEG "Build with internal jpeg support" ON)
|
|
|
|
option(AX_WITH_OPENSSL "Build with internal openssl support" ON)
|
|
|
|
option(AX_WITH_WEBP "Build with internal webp support" ON)
|
|
|
|
option(AX_WITH_PUGIXML "Build with internal pugixml support" ON)
|
2022-08-27 23:00:10 +08:00
|
|
|
option(AX_WITH_CLIPPER2 "Build with internal Clipper2 support" ON)
|
2022-02-17 17:11:17 +08:00
|
|
|
option(AX_WITH_CONVERTUTF "Build with internal ConvertUTF support" ON)
|
|
|
|
option(AX_WITH_POLY2TRI "Build with internal poly2tri support" ON)
|
|
|
|
option(AX_WITH_ZLIB "Build with internal zlib support" ON)
|
|
|
|
option(AX_WITH_CURL "Build with internal curl support" ON)
|
|
|
|
option(AX_WITH_UNZIP "Build with internal unzip support" ON)
|
2023-05-03 20:30:41 +08:00
|
|
|
option(AX_WITH_ASTCENC "Build with internal ASTCENC support" ON)
|
2022-02-17 17:11:17 +08:00
|
|
|
option(AX_WITH_ALSOFT "Build with internal openal-soft support" ${AX_USE_ALSOFT})
|
|
|
|
option(AX_WITH_CARES "Build with internal c-ares support" OFF)
|
|
|
|
option(AX_WITH_LLHTTP "Build with lhttp support" ON)
|
|
|
|
option(AX_WITH_YAML_CPP "Build with yaml-cpp support" OFF)
|
|
|
|
option(AX_WITH_KCP "Build with internal kcp support" OFF)
|
2023-05-25 16:54:30 +08:00
|
|
|
option(AX_WITH_OBOE "Build with oboe support" OFF)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2021-08-11 19:27:58 +08:00
|
|
|
# by default, enable ios,macOS openal-soft framework for legal license LGPL-2.1
|
|
|
|
option(ALSOFT_OSX_FRAMEWORK "" ON)
|
|
|
|
|
2020-11-16 14:47:43 +08:00
|
|
|
set(ANDROID_SHARED_LOADS "" CACHE INTERNAL "The android shared libraries load source code" )
|
|
|
|
set(ANDROID_SHARED_LOAD_FILE_NAME "SharedLoader.java" CACHE INTERNAL "The android shared load java file name" )
|
|
|
|
set(ANDROID_SHARED_LOAD_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_SHARED_LOAD_FILE_NAME}.in" CACHE INTERNAL "The android shared libraries load config code file" )
|
|
|
|
|
|
|
|
# cmake_policy(SET CMP0079 NEW)
|
2022-12-17 14:49:06 +08:00
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
|
|
|
|
# Detetion SIMD instrinsics
|
|
|
|
|
2023-04-01 23:11:58 +08:00
|
|
|
### check -msse2 flag
|
|
|
|
set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
|
|
|
if(MSVC)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} /WX")
|
|
|
|
check_c_compiler_flag("/arch:SSE2" AX_HAVE_SSE2_SWITCH)
|
|
|
|
else()
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Werror")
|
|
|
|
check_c_compiler_flag(-msse2 AX_HAVE_SSE2_SWITCH)
|
|
|
|
endif()
|
|
|
|
if (AX_HAVE_SSE2_SWITCH)
|
|
|
|
set(AX_HAVE_SSE2_INTRINSICS 1)
|
|
|
|
endif()
|
|
|
|
### end check -msse2 flag
|
|
|
|
|
|
|
|
if (NOT TVOS)
|
|
|
|
# Checking intel SIMD Intrinsics
|
|
|
|
if(APPLE)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mpopcnt")
|
2022-12-17 14:49:06 +08:00
|
|
|
endif()
|
2023-04-01 23:11:58 +08:00
|
|
|
check_c_source_compiles("#include <immintrin.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
__m256 m = _mm256_set_ps(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f);
|
|
|
|
return (int)*(float*)&m;
|
|
|
|
}" AX_HAVE_AVX2_INTRINSICS)
|
|
|
|
check_c_source_compiles("#include <nmmintrin.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
uint32_t v = 0;
|
|
|
|
return (int)_mm_popcnt_u32(v);
|
|
|
|
}" AX_HAVE_SSE42_INTRINSICS)
|
|
|
|
check_c_source_compiles("#include <smmintrin.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
__m128i shuf = _mm_set_epi8(0,0,0,0, 0,0,0,0, 0,0,0,0, 12,8,4,0);
|
|
|
|
return *(int*)&shuf;
|
|
|
|
}" AX_HAVE_SSE41_INTRINSICS)
|
|
|
|
|
|
|
|
if (NOT AX_HAVE_SSE2_INTRINSICS)
|
|
|
|
check_c_source_compiles("#include <emmintrin.h>
|
2022-12-17 14:49:06 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
int main()
|
|
|
|
{
|
2023-04-01 23:11:58 +08:00
|
|
|
__m128d m = _mm_set_sd(0.0);
|
|
|
|
return (int)*(double*)&m;
|
|
|
|
}" AX_HAVE_SSE2_INTRINSICS)
|
2022-12-17 14:49:06 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
|
2023-04-01 23:11:58 +08:00
|
|
|
|
|
|
|
### Checking ARM SIMD neon
|
|
|
|
check_include_file(arm_neon.h AX_HAVE_ARM_NEON_H)
|
|
|
|
if(AX_HAVE_ARM_NEON_H)
|
|
|
|
check_c_source_compiles("#include <arm_neon.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int32x4_t ret4 = vdupq_n_s32(0);
|
|
|
|
return vgetq_lane_s32(ret4, 0);
|
|
|
|
}" AX_HAVE_NEON_INTRINSICS)
|
2022-12-17 14:49:06 +08:00
|
|
|
endif()
|
2023-04-01 23:11:58 +08:00
|
|
|
else()
|
|
|
|
message(AUTHOR_WARNING "Skipping AVX2/SSE4/NEON detection for astc-encoder when build target 'tvos'")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
|
|
|
|
unset(OLD_REQUIRED_FLAGS)
|
|
|
|
|
|
|
|
### set AX_ISA_SIMD
|
|
|
|
if(AX_HAVE_AVX2_INTRINSICS)
|
|
|
|
set(AX_ISA_SIMD "avx2")
|
|
|
|
elseif(AX_HAVE_SSE42_INTRINSICS)
|
|
|
|
set(AX_ISA_SIMD "sse4.2")
|
|
|
|
elseif(AX_HAVE_SSE41_INTRINSICS)
|
|
|
|
set(AX_ISA_SIMD "sse4.1")
|
|
|
|
elseif(AX_HAVE_SSE2_INTRINSICS)
|
|
|
|
set(AX_ISA_SIMD "sse2")
|
|
|
|
elseif(AX_HAVE_NEON_INTRINSICS)
|
|
|
|
set(AX_ISA_SIMD "neon")
|
|
|
|
else()
|
|
|
|
set(AX_ISA_SIMD "none")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(AUTHOR_WARNING "AX_ISA_SIMD=${AX_ISA_SIMD},AX_HAVE_AVX2_INTRINSICS=${AX_HAVE_AVX2_INTRINSICS},AX_HAVE_SSE42_INTRINSICS=${AX_HAVE_SSE42_INTRINSICS},AX_HAVE_SSE41_INTRINSICS=${AX_HAVE_SSE41_INTRINSICS},AX_HAVE_SSE2_INTRINSICS=${AX_HAVE_SSE2_INTRINSICS},AX_HAVE_NEON_INTRINSICS=${AX_HAVE_NEON_INTRINSICS}")
|
2022-12-17 14:49:06 +08:00
|
|
|
|
2023-04-02 16:04:19 +08:00
|
|
|
if (WINDOWS)
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
if (AX_HAVE_SSE41_INTRINSICS)
|
|
|
|
add_compile_options("-msse4.1")
|
|
|
|
endif()
|
2023-04-01 23:11:58 +08:00
|
|
|
endif()
|
2022-12-17 14:49:06 +08:00
|
|
|
endif()
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2021-04-28 12:43:51 +08:00
|
|
|
function(configure_target_outdir target)
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
2021-06-08 20:45:55 +08:00
|
|
|
FOLDER "ThirdParty"
|
2021-04-28 12:43:51 +08:00
|
|
|
)
|
2021-06-09 12:28:33 +08:00
|
|
|
endfunction()
|
2021-04-28 12:43:51 +08:00
|
|
|
|
2023-03-11 22:10:18 +08:00
|
|
|
if (WINRT)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
|
|
|
|
endif()
|
|
|
|
|
2022-02-17 18:06:19 +08:00
|
|
|
if(NOT DEFINED AX_USE_LUAJIT)
|
|
|
|
set(AX_USE_LUAJIT FALSE CACHE INTERNAL "Use luajit instead plainlua")
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
2022-02-17 18:06:19 +08:00
|
|
|
if(NOT AX_USE_LUAJIT)
|
|
|
|
message(STATUS "Using plainlua https://lua.org")
|
|
|
|
set (AX_LUA_ENGINE "plainlua" CACHE INTERNAL "")
|
2020-11-16 14:47:43 +08:00
|
|
|
else()
|
2022-02-17 18:06:19 +08:00
|
|
|
message(STATUS "Using luajit https://luajit.org")
|
|
|
|
set (AX_LUA_ENGINE "luajit" CACHE INTERNAL "")
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
2021-07-08 22:39:08 +08:00
|
|
|
add_library(thirdparty STATIC empty.cpp)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2022-02-25 17:40:08 +08:00
|
|
|
# bellow are header only libs
|
2021-12-29 13:44:39 +08:00
|
|
|
target_include_directories(thirdparty
|
2022-02-17 21:31:39 +08:00
|
|
|
INTERFACE "robin-map/include"
|
2021-12-29 12:22:59 +08:00
|
|
|
)
|
2021-12-29 11:52:09 +08:00
|
|
|
|
2021-12-29 19:27:27 +08:00
|
|
|
if (ANDROID)
|
|
|
|
target_include_directories(thirdparty
|
|
|
|
INTERFACE "jni.hpp/include"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-02-25 17:40:08 +08:00
|
|
|
add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
|
|
|
target_link_libraries(thirdparty fmt-header-only)
|
|
|
|
|
|
|
|
# bellow are non header only libs
|
2022-08-14 11:19:56 +08:00
|
|
|
|
|
|
|
# cpufeatures
|
|
|
|
if(ANDROID)
|
|
|
|
add_subdirectory(android-specific/cpufeatures)
|
|
|
|
endif()
|
|
|
|
|
2022-05-14 17:47:47 +08:00
|
|
|
add_subdirectory(zlib)
|
2023-05-25 16:54:30 +08:00
|
|
|
target_link_libraries(thirdparty
|
2022-05-14 17:47:47 +08:00
|
|
|
dep_zlib
|
|
|
|
)
|
2021-04-28 12:43:51 +08:00
|
|
|
|
2022-08-14 11:19:56 +08:00
|
|
|
# libpng
|
|
|
|
add_subdirectory(png)
|
|
|
|
target_include_directories(png PRIVATE "zlib/include")
|
|
|
|
if(ANDROID)
|
|
|
|
target_include_directories(png PRIVATE ${cpufeatures_include_dir})
|
|
|
|
target_link_libraries(png INTERFACE cpufeatures)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(thirdparty png)
|
|
|
|
configure_target_outdir(png)
|
|
|
|
|
|
|
|
set(PNG_PNG_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/png" CACHE STRING "png include dir" FORCE)
|
|
|
|
set(PNG_LIBRARY "png" CACHE STRING "png include dir" FORCE)
|
|
|
|
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_BOX2D)
|
2020-11-16 14:47:43 +08:00
|
|
|
set(BOX2D_BUILD_UNIT_TESTS OFF CACHE BOOL "Build the Box2D unit tests" FORCE)
|
|
|
|
set(BOX2D_BUILD_TESTBED OFF CACHE BOOL "Build the Box2D testbed" FORCE)
|
2021-08-13 13:54:18 +08:00
|
|
|
if(OPT_BOX2D_OPTIMIZED)
|
|
|
|
add_subdirectory(box2d-optimized)
|
|
|
|
configure_target_outdir(box2d-optimized)
|
|
|
|
target_link_libraries(thirdparty box2d-optimized)
|
|
|
|
else()
|
|
|
|
add_subdirectory(box2d)
|
|
|
|
configure_target_outdir(box2d)
|
|
|
|
target_link_libraries(thirdparty box2d)
|
|
|
|
endif()
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_BOX2D)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_CHIPMUNK)
|
2020-11-16 14:47:43 +08:00
|
|
|
set(CP_BUILD_SHARED OFF CACHE BOOL "Build chipmunk as shared library" FORCE)
|
|
|
|
set(CP_BUILD_STATIC ON CACHE BOOL "Build chipmunk as static library" FORCE)
|
|
|
|
set(CP_BUILD_DEMOS OFF CACHE BOOL "Build chipmunk demos" FORCE)
|
|
|
|
set(CP_INSTALL_STATIC OFF CACHE BOOL "Install chipmunk static" FORCE)
|
|
|
|
add_subdirectory(chipmunk)
|
|
|
|
set_target_properties(chipmunk PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/chipmunk/include"
|
|
|
|
)
|
2023-05-25 16:54:30 +08:00
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
# !important axmol not use double precision
|
2020-11-16 14:47:43 +08:00
|
|
|
target_compile_definitions(chipmunk PUBLIC CP_USE_CGTYPES=0)
|
|
|
|
target_compile_definitions(chipmunk PUBLIC CP_USE_DOUBLES=0)
|
|
|
|
|
|
|
|
#~ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/chipmunk/include")
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty chipmunk)
|
|
|
|
configure_target_outdir(chipmunk)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_CHIPMUNK)
|
|
|
|
if(AX_WITH_FREETYPE)
|
2022-05-14 17:47:47 +08:00
|
|
|
if (NOT LINUX)
|
|
|
|
set(FT_WITH_ZLIB ON CACHE BOOL "Use system zlib instead of internal library." FORCE)
|
|
|
|
set(DISABLE_FORCE_DEBUG_POSTFIX ON CACHE BOOL "" FORCE)
|
|
|
|
set(SKIP_INSTALL_ALL TRUE CACHE BOOL "Skip freetype instal." FORCE)
|
2022-08-14 11:19:56 +08:00
|
|
|
set(FT_DISABLE_HARFBUZZ TRUE CACHE BOOL "Disable HarfBuzz." FORCE)
|
|
|
|
set(FT_DISABLE_BROTLI TRUE CACHE BOOL "Disable Brotli." FORCE)
|
2022-12-07 21:38:19 +08:00
|
|
|
set(FT_DISABLE_BZIP2 TRUE CACHE BOOL "Disable bzip2." FORCE)
|
2022-05-14 17:47:47 +08:00
|
|
|
add_subdirectory(freetype)
|
|
|
|
target_link_libraries(thirdparty freetype)
|
|
|
|
configure_target_outdir(freetype)
|
2023-04-02 12:29:39 +08:00
|
|
|
if (WINRT)
|
|
|
|
target_compile_definitions(freetype PUBLIC "generic=GenericFromFreeTypeLibrary")
|
|
|
|
endif()
|
2022-05-14 17:47:47 +08:00
|
|
|
endif()
|
2021-06-08 20:45:55 +08:00
|
|
|
target_include_directories(thirdparty PUBLIC "freetype/include")
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_FREETYPE)
|
|
|
|
if(AX_WITH_RECAST)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(recast)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty recast)
|
|
|
|
configure_target_outdir(recast)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_RECAST)
|
|
|
|
if(AX_WITH_BULLET)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(bullet)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty bullet)
|
|
|
|
configure_target_outdir(bullet)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_BULLET)
|
2023-03-11 22:10:18 +08:00
|
|
|
if(AX_WITH_JPEG AND NOT WINRT)
|
2022-08-13 09:51:21 +08:00
|
|
|
add_subdirectory(jpeg-turbo)
|
|
|
|
target_link_libraries(thirdparty dep_jpeg-turbo)
|
2023-03-11 22:10:18 +08:00
|
|
|
endif()
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_OPENSSL)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(openssl)
|
|
|
|
if(ANDROID OR LINUX)
|
2021-04-28 15:10:28 +08:00
|
|
|
target_link_libraries(OpenSSL::SSL INTERFACE OpenSSL::Crypto)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty OpenSSL::SSL)
|
2020-11-16 14:47:43 +08:00
|
|
|
else()
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty OpenSSL::Crypto OpenSSL::SSL)
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
2021-12-16 11:14:39 +08:00
|
|
|
target_compile_definitions(thirdparty PUBLIC OPENSSL_SUPPRESS_DEPRECATED=1)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_OPENSSL)
|
|
|
|
if(AX_WITH_WEBP)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(webp)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty webp)
|
|
|
|
configure_target_outdir(webp)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_WEBP)
|
|
|
|
if(AX_WITH_PUGIXML)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(pugixml)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty pugixml)
|
|
|
|
configure_target_outdir(pugixml)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_PUGIXML)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2021-06-24 00:04:29 +08:00
|
|
|
add_subdirectory(xxhash)
|
|
|
|
target_link_libraries(thirdparty xxhash)
|
|
|
|
configure_target_outdir(xxhash)
|
|
|
|
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(lz4)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty lz4)
|
|
|
|
configure_target_outdir(lz4)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2022-08-27 23:00:10 +08:00
|
|
|
if(AX_WITH_CLIPPER2)
|
2022-08-28 00:28:21 +08:00
|
|
|
add_subdirectory(clipper2)
|
2022-08-27 23:00:10 +08:00
|
|
|
target_link_libraries(thirdparty clipper2)
|
|
|
|
configure_target_outdir(clipper2)
|
|
|
|
endif(AX_WITH_CLIPPER2)
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_CONVERTUTF)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(ConvertUTF)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty ConvertUTF)
|
|
|
|
configure_target_outdir(ConvertUTF)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_CONVERTUTF)
|
|
|
|
if(AX_WITH_POLY2TRI)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(poly2tri)
|
2023-05-25 16:54:30 +08:00
|
|
|
target_link_libraries(thirdparty poly2tri)
|
2022-06-30 18:13:55 +08:00
|
|
|
# Build static lib
|
|
|
|
target_compile_definitions(poly2tri PUBLIC P2T_STATIC_EXPORTS)
|
2021-06-08 20:45:55 +08:00
|
|
|
configure_target_outdir(poly2tri)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_POLY2TRI)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2023-05-03 20:30:41 +08:00
|
|
|
if(AX_WITH_ASTCENC)
|
|
|
|
add_subdirectory(astcenc)
|
|
|
|
target_link_libraries(thirdparty astcenc)
|
|
|
|
configure_target_outdir(astcenc)
|
|
|
|
endif(AX_WITH_ASTCENC)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
|
|
|
# use lua/js specific libs by property to prevent conflict
|
2022-02-17 21:31:39 +08:00
|
|
|
if(AX_ENABLE_EXT_LUA)
|
2022-02-17 18:06:19 +08:00
|
|
|
add_subdirectory(lua/${AX_LUA_ENGINE})
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(lua/tolua)
|
2021-07-16 11:17:34 +08:00
|
|
|
add_subdirectory(lua/lua-cjson)
|
2023-05-25 16:54:30 +08:00
|
|
|
set_property(TARGET thirdparty APPEND PROPERTY
|
2022-07-08 07:17:41 +08:00
|
|
|
AX_LUA_DEPEND ${AX_LUA_ENGINE} tolua lua-cjson
|
2020-11-16 14:47:43 +08:00
|
|
|
)
|
2022-08-15 16:37:53 +08:00
|
|
|
if (AX_USE_LUAJIT)
|
|
|
|
target_compile_definitions(lua-cjson PRIVATE USING_LUAJIT=1)
|
|
|
|
endif()
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
2022-05-14 17:47:47 +08:00
|
|
|
if(AX_WITH_CURL)
|
|
|
|
add_subdirectory(curl)
|
|
|
|
if(ANDROID OR LINUX)
|
|
|
|
target_link_libraries(libcurl INTERFACE OpenSSL::SSL)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(thirdparty libcurl)
|
|
|
|
endif(AX_WITH_CURL)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
|
|
|
# The openal-soft(LGPL 2.1)
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_ALSOFT)
|
2021-04-28 12:43:51 +08:00
|
|
|
set(ALSOFT_DLOPEN OFF CACHE BOOL "Check for the dlopen API for loading optional libs" FORCE)
|
|
|
|
set(ALSOFT_UTILS OFF CACHE BOOL "Build utility program" FORCE)
|
|
|
|
set(ALSOFT_EXAMPLES OFF CACHE BOOL "Build example programs" FORCE)
|
|
|
|
set(ALSOFT_INSTALL OFF CACHE BOOL "Install main library" FORCE)
|
2023-05-25 16:54:30 +08:00
|
|
|
if (ANDROID AND AX_WITH_OBOE)
|
2023-02-18 11:49:46 +08:00
|
|
|
set(ALSOFT_BACKEND_OPENSL OFF CACHE BOOL "Enable OpenSL backend" FORCE)
|
|
|
|
set(OBOE_SOURCE "${CMAKE_CURRENT_LIST_DIR}/oboe" CACHE STRING "Source directory for Oboe." FORCE)
|
|
|
|
endif()
|
2023-03-11 22:10:18 +08:00
|
|
|
|
|
|
|
if(WINRT)
|
|
|
|
set(ALSOFT_BACKEND_WASAPI OFF CACHE BOOL "Enable WASAPI backend" FORCE)
|
|
|
|
set(ALSOFT_BACKEND_WAVE OFF CACHE BOOL "Enable Wave Writer backend" FORCE)
|
|
|
|
set(ALSOFT_BACKEND_DSOUND OFF CACHE BOOL "Enable DirectSound backend" FORCE)
|
|
|
|
set(ALSOFT_BACKEND_WINMM OFF CACHE BOOL "Enable Windows Multimedia backend" FORCE)
|
|
|
|
endif()
|
|
|
|
|
2021-05-14 10:16:55 +08:00
|
|
|
add_subdirectory(openal EXCLUDE_FROM_ALL)
|
2021-04-28 12:43:51 +08:00
|
|
|
configure_target_outdir(common)
|
2023-05-25 16:54:30 +08:00
|
|
|
|
2021-04-28 12:43:51 +08:00
|
|
|
configure_target_outdir(OpenAL)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty
|
2021-04-28 12:43:51 +08:00
|
|
|
OpenAL
|
2020-11-16 14:47:43 +08:00
|
|
|
)
|
2022-05-15 09:55:57 +08:00
|
|
|
target_compile_definitions(thirdparty PUBLIC AX_USE_ALSOFT=1)
|
2023-03-11 22:10:18 +08:00
|
|
|
|
|
|
|
if(WINRT)
|
|
|
|
target_include_directories(thirdparty PUBLIC openal-uwp/include)
|
|
|
|
endif()
|
2023-05-25 16:54:30 +08:00
|
|
|
|
2021-08-08 14:35:30 +08:00
|
|
|
if(ANDROID)
|
|
|
|
set(ANDROID_SHARED_LOADS "${ANDROID_SHARED_LOADS}System.loadLibrary(\"openal\");" CACHE INTERNAL "Android Shared Loads" )
|
|
|
|
endif()
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# The ogg decoder
|
|
|
|
add_subdirectory(ogg)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty ogg)
|
|
|
|
configure_target_outdir(ogg)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2022-11-10 21:22:55 +08:00
|
|
|
if(WINDOWS OR LINUX OR (ANDROID AND AX_USE_GLAD))
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(glad)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty glad)
|
|
|
|
configure_target_outdir(glad)
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
2023-03-11 22:10:18 +08:00
|
|
|
if((WINDOWS AND NOT WINRT) OR MACOSX OR LINUX)
|
2021-04-28 12:43:51 +08:00
|
|
|
set(GLFW_BUILD_DOCS OFF CACHE BOOL "Build the GLFW documentation" FORCE)
|
|
|
|
set(GLFW_INSTALL OFF CACHE BOOL "Build the GLFW documentation" FORCE)
|
|
|
|
add_subdirectory(glfw)
|
|
|
|
configure_target_outdir(glfw)
|
2021-05-18 21:30:42 +08:00
|
|
|
set_target_properties(glfw PROPERTIES
|
|
|
|
OUTPUT_NAME glfw)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty glfw)
|
2021-04-28 12:43:51 +08:00
|
|
|
if(NOT WINDOWS)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty pthread)
|
2021-04-28 12:43:51 +08:00
|
|
|
endif()
|
2021-06-08 20:45:55 +08:00
|
|
|
target_include_directories(thirdparty PUBLIC "glfw/include/GLFW")
|
2020-11-16 14:47:43 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# unzip depend on zlib
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_UNZIP)
|
2020-11-16 14:47:43 +08:00
|
|
|
add_subdirectory(unzip)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty unzip)
|
|
|
|
configure_target_outdir(unzip)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_UNZIP)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_CARES)
|
2020-11-16 14:47:43 +08:00
|
|
|
set(CARES_STATIC ON CACHE BOOL "Build c-ares as static library" FORCE)
|
|
|
|
set(CARES_SHARED OFF CACHE BOOL "Build c-ares as shared library" FORCE)
|
|
|
|
set(CARES_BUILD_TOOLS OFF CACHE BOOL "Build c-ares tools" FORCE)
|
|
|
|
set(CARES_INSTALL OFF CACHE BOOL "Create installation targets (chain builders may want to disable this)" FORCE)
|
|
|
|
add_subdirectory(c-ares)
|
2021-06-08 20:45:55 +08:00
|
|
|
target_link_libraries(thirdparty c-ares)
|
2020-11-16 14:47:43 +08:00
|
|
|
include_directories($<TARGET_FILE_DIR:c-ares>)
|
|
|
|
include_directories("c-ares/include")
|
2021-04-28 12:43:51 +08:00
|
|
|
configure_target_outdir(c-ares)
|
2023-04-05 13:32:13 +08:00
|
|
|
target_compile_definitions(thirdparty PUBLIC YASIO_USE_CARES=1)
|
2022-02-17 17:11:17 +08:00
|
|
|
endif(AX_WITH_CARES)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_LLHTTP)
|
2021-06-15 12:43:01 +08:00
|
|
|
add_subdirectory(llhttp)
|
|
|
|
configure_target_outdir(llhttp)
|
|
|
|
target_link_libraries(thirdparty llhttp)
|
|
|
|
endif()
|
|
|
|
|
2021-12-29 11:25:42 +08:00
|
|
|
# yaml
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_YAML_CPP)
|
2021-07-08 22:39:08 +08:00
|
|
|
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
|
|
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
|
|
|
|
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "" FORCE)
|
|
|
|
set(YAML_CPP_INSTALL OFF CACHE BOOL "" FORCE)
|
2021-07-08 22:55:33 +08:00
|
|
|
set(YAML_CPP_CLANG_FORMAT_EXE OFF CACHE BOOL "" FORCE)
|
2021-07-08 22:39:08 +08:00
|
|
|
# set(YAML_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
|
|
add_subdirectory(yaml-cpp)
|
|
|
|
configure_target_outdir(yaml-cpp)
|
2022-04-02 13:50:53 +08:00
|
|
|
add_dependencies(thirdparty yaml-cpp)
|
2021-07-08 22:39:08 +08:00
|
|
|
endif()
|
|
|
|
|
2021-12-29 11:25:42 +08:00
|
|
|
# kcp
|
2022-02-17 17:11:17 +08:00
|
|
|
if(AX_WITH_KCP)
|
2021-07-08 22:39:08 +08:00
|
|
|
add_subdirectory(kcp)
|
|
|
|
configure_target_outdir(kcp)
|
|
|
|
target_link_libraries(thirdparty kcp)
|
|
|
|
endif()
|
|
|
|
|
2023-05-25 16:54:30 +08:00
|
|
|
if (WINRT)
|
2023-03-11 22:10:18 +08:00
|
|
|
add_subdirectory(angle)
|
|
|
|
target_link_libraries(thirdparty angle::GLESv2 angle::EGL)
|
|
|
|
endif()
|
|
|
|
|
2021-06-08 20:45:55 +08:00
|
|
|
# put "thirdparty" into thirdparty folder, too
|
|
|
|
configure_target_outdir(thirdparty)
|
2020-11-16 14:47:43 +08:00
|
|
|
|
|
|
|
if(MACOSX OR IOS)
|
|
|
|
add_subdirectory(glsl-optimizer)
|
2023-05-25 16:54:30 +08:00
|
|
|
target_link_libraries(thirdparty
|
2022-02-17 17:11:17 +08:00
|
|
|
dep_glcpp_library
|
|
|
|
dep_glsl_optimizer
|
|
|
|
dep_libmesa
|
2020-11-16 14:47:43 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (ANDROID)
|
|
|
|
function(config_android_shared_libs package_name target_folder)
|
|
|
|
string(REPLACE "." "/" package_path ${package_name})
|
|
|
|
set(ANDROID_PACKAGE_NAME ${package_name})
|
|
|
|
configure_file(${ANDROID_SHARED_LOAD_FILE_PATH} ${target_folder}/${package_path}/${ANDROID_SHARED_LOAD_FILE_NAME} @ONLY)
|
|
|
|
endfunction()
|
|
|
|
endif()
|