2019-11-23 20:27:39 +08:00
|
|
|
#/****************************************************************************
|
|
|
|
# Copyright (c) 2013 cocos2d-x.org
|
|
|
|
# Copyright (c) 2014 martell malone
|
|
|
|
# Copyright (c) 2015-2017 Chukong Technologies Inc.
|
2023-07-06 20:24:41 +08:00
|
|
|
# Copyright (c) 2021-2023 Bytedance Inc.
|
2021-10-25 23:30:03 +08:00
|
|
|
#
|
2022-10-01 16:24:52 +08:00
|
|
|
# https://axmolengine.github.io/
|
2019-11-23 20:27:39 +08:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
# THE SOFTWARE.
|
|
|
|
# ****************************************************************************/
|
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
# this CMakeLists is to generate Axmol Engine Library
|
|
|
|
# build ax
|
2022-08-08 18:02:17 +08:00
|
|
|
# build axlua if AX_ENABLE_EXT_LUA=ON
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2023-07-06 20:24:41 +08:00
|
|
|
# include_guard (GLOBAL)
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
# The version number
|
2023-09-02 19:56:50 +08:00
|
|
|
set(_AX_VERSION 2.0)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
if(NOT DEFINED _AX_CORE_LIB)
|
2022-10-01 16:24:52 +08:00
|
|
|
set(_AX_CORE_LIB axmol CACHE INTERNAL "The axmol core lib name" )
|
2020-08-18 12:36:44 +08:00
|
|
|
endif()
|
2020-08-12 18:53:33 +08:00
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
cmake_policy(SET CMP0127 NEW)
|
|
|
|
|
2022-08-29 20:51:22 +08:00
|
|
|
project(ax_libs)
|
2021-08-12 11:25:01 +08:00
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
if(WIN32)
|
|
|
|
# explicit set source charset to utf-8 for windows targets
|
|
|
|
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
|
|
|
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
2023-09-02 19:47:18 +08:00
|
|
|
endif()
|
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
include(CMakeDependentOption)
|
|
|
|
|
|
|
|
# by default: use angle on win32
|
|
|
|
cmake_dependent_option(AX_USE_COMPAT_GL "Whether use compatibility GL as render backend" ON "WIN32" OFF)
|
|
|
|
|
|
|
|
# choosing render backend for all target platforms: win32, winuwp, ios, tvos, android, linux, osx
|
|
|
|
if(APPLE AND (NOT AX_USE_COMPAT_GL))
|
|
|
|
set(AX_USE_METAL ON CACHE BOOL "" FORCE)
|
|
|
|
set(AX_USE_GL OFF CACHE BOOL "" FORCE)
|
|
|
|
else() # win32, winuwp, android, linux: OpenGL
|
|
|
|
set(AX_USE_GL ON CACHE BOOL "" FORCE)
|
|
|
|
set(AX_USE_METAL OFF CACHE BOOL "" FORCE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# macos, linux or (win32, ios, tvos and NOT AX_USE_COMPAT_GL) not use GLES profile
|
|
|
|
set(_GLES_PROFILE 0) # _GLES_PROFILE is the default GLES profile
|
|
|
|
if(ANDROID) # android force use GLES profile
|
|
|
|
set(_GLES_PROFILE 200)
|
|
|
|
elseif(WINRT OR WASM) # winuwp/wasm fore use GLES profile
|
|
|
|
set(_GLES_PROFILE 300)
|
|
|
|
elseif((NOT MACOSX) AND (NOT LINUX)) # win32, ios, tvos
|
|
|
|
if(AX_USE_COMPAT_GL)
|
|
|
|
set(_GLES_PROFILE 300)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(_GLES_PROFILE)
|
|
|
|
set(AX_GLES_PROFILE ${_GLES_PROFILE} CACHE STRING "")
|
|
|
|
if (NOT (AX_GLES_PROFILE EQUAL 200 OR AX_GLES_PROFILE EQUAL 300))
|
|
|
|
message(FATAL_ERROR "${MACOSX} Invalid GLES profile ${AX_GLES_PROFILE}, must be 200 or 300, default ${_GLES_PROFILE}")
|
2023-08-25 16:57:54 +08:00
|
|
|
endif()
|
2023-09-02 19:56:50 +08:00
|
|
|
else() # force disable GLES profile
|
|
|
|
set(AX_GLES_PROFILE 0 CACHE STRING "" FORCE)
|
2023-08-25 16:57:54 +08:00
|
|
|
endif()
|
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
# print renderer backend profile
|
|
|
|
message(AUTHOR_WARNING "AX_USE_GL=${AX_USE_GL}, AX_USE_METAL=${AX_USE_METAL}, AX_GLES_PROFILE=${AX_GLES_PROFILE}")
|
2023-03-11 22:10:18 +08:00
|
|
|
|
2023-06-13 20:44:20 +08:00
|
|
|
option (AX_ENABLE_MFMEDIA "Enabling microsoft media foundation" ON)
|
2023-03-25 08:37:51 +08:00
|
|
|
|
2023-03-11 22:10:18 +08:00
|
|
|
if (NOT WINRT)
|
|
|
|
option (AX_ENABLE_MSEDGE_WEBVIEW2 "Use Microsoft Edge webview2" ON)
|
|
|
|
else() # we not support webview2 and vidio player for WINRT target
|
|
|
|
set(AX_ENABLE_MSEDGE_WEBVIEW2 OFF CACHE BOOL "Use Microsoft Edge webview2" FORCE)
|
2023-03-25 08:37:51 +08:00
|
|
|
# set(AX_ENABLE_MFMEDIA OFF CACHE BOOL "Enabling microsoft media foundation for windows video player" FORCE)
|
2023-03-11 22:10:18 +08:00
|
|
|
endif()
|
|
|
|
|
2023-06-10 22:05:49 +08:00
|
|
|
if (LINUX)
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
check_include_file(vlc/vlc.h _AX_HAVE_VLC)
|
|
|
|
endif()
|
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
cmake_dependent_option(AX_ENABLE_VLC_MEDIA "Enabling vlc media" ON "_AX_HAVE_VLC" OFF)
|
|
|
|
|
2023-06-10 22:05:49 +08:00
|
|
|
message(STATUS "AX_ENABLE_VLC_MEDIA=${AX_ENABLE_VLC_MEDIA}")
|
|
|
|
|
2023-09-01 16:31:14 +08:00
|
|
|
if(NOT APPLE AND (NOT EMSCRIPTEN))
|
2023-06-10 22:05:49 +08:00
|
|
|
set(AX_USE_ALSOFT ON CACHE BOOL "" FORCE)
|
|
|
|
else()
|
|
|
|
option(AX_USE_ALSOFT "Use ALSOFT on apple" OFF)
|
|
|
|
endif()
|
|
|
|
|
2023-03-30 22:08:53 +08:00
|
|
|
option(AX_UPDATE_BUILD_VERSION "Update build version" ON)
|
|
|
|
|
2022-11-10 21:22:55 +08:00
|
|
|
# default value for axmol extensions modules to Build
|
2023-09-12 01:06:28 +08:00
|
|
|
# total supported extensions count: 13
|
2022-11-10 21:22:55 +08:00
|
|
|
# extensions dependicies: COCOSTUDIO may depend on spine & dragonBones if they are present in buildset
|
|
|
|
|
|
|
|
option(AX_ENABLE_EXT_GUI "Build extension GUI" ON)
|
|
|
|
|
|
|
|
option(AX_ENABLE_EXT_ASSETMANAGER "Build extension asset-manager" ON)
|
|
|
|
option(AX_ENABLE_EXT_PARTICLE3D "Build extension Particle3D" ON)
|
|
|
|
option(AX_ENABLE_EXT_PHYSICS_NODE "Build extension physics-nodes" ON)
|
|
|
|
|
|
|
|
option(AX_ENABLE_EXT_SPINE "Build extension spine" ON)
|
|
|
|
option(AX_ENABLE_EXT_DRAGONBONES "Build extension DragonBones" ON)
|
|
|
|
|
|
|
|
option(AX_ENABLE_EXT_COCOSTUDIO "Build extension cocostudio" ON)
|
|
|
|
|
|
|
|
option(AX_ENABLE_EXT_FAIRYGUI "Build extension FairyGUI" ON)
|
|
|
|
|
|
|
|
option(AX_ENABLE_EXT_LIVE2D "Build extension Live2D" OFF)
|
|
|
|
option(AX_ENABLE_EXT_EFFEKSEER "Build extension Effekseer" OFF)
|
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
cmake_dependent_option(AX_ENABLE_EXT_IMGUI "Build extension ImGui" ON "(WINDOWS AND NOT WINRT) OR MACOSX OR LINUX OR ANDROID OR WASM" OFF)
|
2023-09-12 01:06:28 +08:00
|
|
|
cmake_dependent_option(AX_ENABLE_EXT_INSPECTOR "Build extension Inspector" ON "(WINDOWS AND NOT WINRT) OR MACOSX OR LINUX OR ANDROID OR WASM" OFF)
|
2023-09-26 01:33:06 +08:00
|
|
|
cmake_dependent_option(AX_ENABLE_EXT_SDFGEN "Build extension SDFGen" ON "(WINDOWS AND NOT WINRT) OR MACOSX OR LINUX OR WASM" OFF)
|
2022-11-10 21:22:55 +08:00
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
option(AX_DISABLE_GLES2 "Whether disable GLES2 support" OFF)
|
2023-08-13 23:58:18 +08:00
|
|
|
|
2023-10-19 15:30:39 +08:00
|
|
|
option(AX_ENABLE_EXT_JSONDEFAULT "Build extension JSONDefault" ON)
|
|
|
|
|
2021-08-12 11:25:01 +08:00
|
|
|
if(XCODE)
|
|
|
|
# set(CMAKE_BUILD_WITH_INSTALL_RPATH YES)
|
|
|
|
# set(CMAKE_INSTALL_RPATH "@executable_path/Frameworks")
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" CACHE INTERNAL "")
|
|
|
|
endif()
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
set(_AX_THIRDPARTY_NAME "thirdparty" CACHE INTERNAL "" )
|
2021-06-08 21:53:18 +08:00
|
|
|
|
2021-07-04 21:18:14 +08:00
|
|
|
if (WIN32)
|
|
|
|
option(WIN32_PATH_USE_ACP "" OFF)
|
|
|
|
if(NOT WIN32_PATH_USE_ACP)
|
|
|
|
add_definitions(-DNTCVT_CP_DEFAULT=CP_UTF8)
|
|
|
|
else()
|
|
|
|
add_definitions(-DNTCVT_CP_DEFAULT=CP_ACP)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
# axmolver.h
|
|
|
|
find_package(Git)
|
|
|
|
if(AX_UPDATE_BUILD_VERSION AND GIT_FOUND AND EXISTS "${_AX_ROOT}/.git")
|
|
|
|
# Get the current working branch and its latest abbreviated commit hash
|
|
|
|
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} -C "${_AX_ROOT}" rev-list --count HEAD
|
|
|
|
TIMEOUT 5
|
|
|
|
OUTPUT_VARIABLE AX_BUILD_NUM
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} -C "${_AX_ROOT}" branch --show-current
|
|
|
|
TIMEOUT 5
|
|
|
|
OUTPUT_VARIABLE AX_GIT_BRANCH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} -C "${_AX_ROOT}" rev-parse --short=7 HEAD
|
|
|
|
TIMEOUT 5
|
|
|
|
OUTPUT_VARIABLE AX_GIT_COMMIT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
else()
|
|
|
|
set(AX_GIT_BRANCH "UNKNOWN")
|
|
|
|
set(AX_GIT_COMMIT_HASH "unknown")
|
|
|
|
endif()
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/axmolver.h.in"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/axmolver.h")
|
|
|
|
|
|
|
|
# early experimental features
|
|
|
|
# include(CMakeDependentOption)
|
|
|
|
# cmake_dependent_option(AX_ENABLE_EARLY_FEATURES
|
|
|
|
# "Build the tests when we are the root project" ON
|
|
|
|
# "NOT (AX_GIT_BRANCH STREQUAL \"dev\")" OFF)
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
include(2d/CMakeLists.txt)
|
|
|
|
include(3d/CMakeLists.txt)
|
|
|
|
include(platform/CMakeLists.txt)
|
|
|
|
include(physics/CMakeLists.txt)
|
|
|
|
include(physics3d/CMakeLists.txt)
|
|
|
|
include(math/CMakeLists.txt)
|
|
|
|
include(navmesh/CMakeLists.txt)
|
|
|
|
include(renderer/CMakeLists.txt)
|
|
|
|
include(base/CMakeLists.txt)
|
|
|
|
include(ui/CMakeLists.txt)
|
|
|
|
include(network/CMakeLists.txt)
|
|
|
|
include(audio/CMakeLists.txt)
|
|
|
|
|
2023-03-25 08:37:51 +08:00
|
|
|
file(GLOB_RECURSE _AX_MEDIA_HEADER media/*.h)
|
|
|
|
file(GLOB_RECURSE _AX_MEDIA_SRC media/*.cpp)
|
|
|
|
|
|
|
|
if (APPLE)
|
2023-04-02 01:51:36 +08:00
|
|
|
list(APPEND _AX_MEDIA_SRC media/AvfMediaEngine.mm)
|
|
|
|
set_source_files_properties(media/MediaEngine.cpp PROPERTIES LANGUAGE OBJCXX)
|
2023-03-25 08:37:51 +08:00
|
|
|
endif()
|
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
set(_AX_HEADER axmol.h
|
2022-08-11 15:41:10 +08:00
|
|
|
${_AX_2D_HEADER}
|
|
|
|
${_AX_3D_HEADER}
|
|
|
|
${_AX_PLATFORM_HEADER}
|
|
|
|
${_AX_PHYSICS_HEADER}
|
|
|
|
${_AX_PHYSICS3D_HEADER}
|
|
|
|
${_AX_MATH_HEADER}
|
|
|
|
${_AX_NAVMESH_HEADER}
|
|
|
|
${_AX_RENDERER_HEADER}
|
|
|
|
${_AX_BASE_HEADER}
|
|
|
|
${_AX_AUDIO_HEADER}
|
|
|
|
${_AX_UI_HEADER}
|
|
|
|
${_AX_NETWORK_HEADER}
|
2023-03-25 08:37:51 +08:00
|
|
|
${_AX_MEDIA_HEADER}
|
2019-11-23 20:27:39 +08:00
|
|
|
)
|
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
set(_AX_SRC axmol.cpp
|
2022-08-11 15:41:10 +08:00
|
|
|
${_AX_2D_SRC}
|
|
|
|
${_AX_3D_SRC}
|
|
|
|
${_AX_PLATFORM_SRC}
|
|
|
|
${_AX_PHYSICS_SRC}
|
|
|
|
${_AX_PHYSICS3D_SRC}
|
|
|
|
${_AX_MATH_SRC}
|
|
|
|
${_AX_NAVMESH_SRC}
|
|
|
|
${_AX_RENDERER_SRC}
|
|
|
|
${_AX_BASE_SRC}
|
|
|
|
${_AX_AUDIO_SRC}
|
|
|
|
${_AX_UI_SRC}
|
|
|
|
${_AX_NETWORK_SRC}
|
2023-03-25 08:37:51 +08:00
|
|
|
${_AX_MEDIA_SRC}
|
2019-11-23 20:27:39 +08:00
|
|
|
)
|
|
|
|
|
2022-08-11 15:41:10 +08:00
|
|
|
list(APPEND _AX_SRC ${_AX_HEADER})
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-11 15:41:10 +08:00
|
|
|
add_library(${_AX_CORE_LIB} ${_AX_SRC})
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2023-09-02 19:56:50 +08:00
|
|
|
ax_find_shaders(${_AX_ROOT}/core/renderer/shaders BUILTIN_SHADER_SOURCES)
|
|
|
|
set(ax_builtin_shaders ${BUILTIN_SHADER_SOURCES} CACHE STATIC "" FORCE)
|
|
|
|
|
|
|
|
# configure engine builtin light num
|
|
|
|
if (NOT DEFINED AX_MAX_DIRECTIONAL_LIGHT)
|
|
|
|
set(AX_MAX_DIRECTIONAL_LIGHT 1)
|
|
|
|
endif()
|
|
|
|
if (NOT DEFINED AX_MAX_POINT_LIGHT)
|
|
|
|
set(AX_MAX_POINT_LIGHT 1)
|
|
|
|
endif()
|
|
|
|
if (NOT DEFINED AX_MAX_SPOT_LIGHT)
|
|
|
|
set (AX_MAX_SPOT_LIGHT 1)
|
|
|
|
endif()
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/renderer/RenderConsts.h.in"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/renderer/RenderConsts.h" @ONLY)
|
|
|
|
# SKINPOSITION_NORMAL_TEXTURE_3D: skinPositionNormalTexture.vert, colorNormalTexture.frag, LightDefs
|
|
|
|
# POSITION_NORMAL_TEXTURE_3D: skinPositionNormalTexture.vert, colorNormalTexture.frag, LightDefs
|
|
|
|
# POSITION_NORMAL_3D: positionNormalTexture.vert, colorNormal.frag, LightDefs
|
|
|
|
# POSITION_BUMPEDNORMAL_TEXTURE_3D: positionNormalTexture.vert, colorNormalTexture.frag, lightNormMapDef
|
|
|
|
# SKINPOSITION_BUMPEDNORMAL_TEXTURE_3D: skinPositionNormalTexture_vert, colorNormalTexture.frag, lightNormMapDef
|
|
|
|
set_source_files_properties(
|
|
|
|
${_AX_ROOT}/core/renderer/shaders/colorNormal.frag
|
|
|
|
${_AX_ROOT}/core/renderer/shaders/colorNormalTexture.frag
|
|
|
|
${_AX_ROOT}/core/renderer/shaders/positionNormalTexture.vert
|
|
|
|
${_AX_ROOT}/core/renderer/shaders/skinPositionNormalTexture.vert
|
|
|
|
PROPERTIES GLSLCC_DEFINES
|
|
|
|
"MAX_DIRECTIONAL_LIGHT_NUM=${AX_MAX_DIRECTIONAL_LIGHT},MAX_POINT_LIGHT_NUM=${AX_MAX_POINT_LIGHT},MAX_SPOT_LIGHT_NUM=${AX_MAX_SPOT_LIGHT}"
|
|
|
|
)
|
|
|
|
set_source_files_properties(
|
|
|
|
${_AX_ROOT}/core/renderer/shaders/colorNormalTexture.frag
|
|
|
|
${_AX_ROOT}/core/renderer/shaders/positionNormalTexture.vert
|
|
|
|
${_AX_ROOT}/core/renderer/shaders/skinPositionNormalTexture.vert
|
|
|
|
PROPERTIES GLSLCC_OUTPUT1 "USE_NORMAL_MAPPING=1"
|
|
|
|
)
|
|
|
|
ax_target_compile_shaders(${_AX_CORE_LIB} FILES ${BUILTIN_SHADER_SOURCES})
|
|
|
|
|
2023-01-11 22:28:14 +08:00
|
|
|
ax_config_pred(${_AX_CORE_LIB} AX_ENABLE_MFMEDIA)
|
|
|
|
ax_config_pred(${_AX_CORE_LIB} AX_ENABLE_MSEDGE_WEBVIEW2)
|
|
|
|
|
2021-06-08 20:45:55 +08:00
|
|
|
# use thirdparty libs
|
2023-07-06 16:09:54 +08:00
|
|
|
add_subdirectory(${_AX_ROOT}/thirdparty ${ENGINE_BINARY_PATH}/thirdparty)
|
2022-08-08 18:02:17 +08:00
|
|
|
target_link_libraries(${_AX_CORE_LIB} thirdparty)
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
# add base macro define and compile options
|
2022-08-08 18:02:17 +08:00
|
|
|
use_ax_compile_define(${_AX_CORE_LIB})
|
|
|
|
use_ax_compile_options(${_AX_CORE_LIB})
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
# use all platform related system libs
|
2022-08-08 18:02:17 +08:00
|
|
|
use_ax_depend(${_AX_CORE_LIB})
|
|
|
|
|
|
|
|
target_include_directories(${_AX_CORE_LIB}
|
2023-07-06 16:09:54 +08:00
|
|
|
PUBLIC ${_AX_ROOT}
|
|
|
|
PUBLIC ${_AX_ROOT}/thirdparty
|
|
|
|
PUBLIC ${_AX_ROOT}/extensions
|
|
|
|
PUBLIC ${_AX_ROOT}/core
|
|
|
|
PUBLIC ${_AX_ROOT}/core/platform
|
|
|
|
|
|
|
|
INTERFACE ${_AX_ROOT}/thirdparty
|
|
|
|
INTERFACE ${_AX_ROOT}/extensions
|
|
|
|
INTERFACE ${_AX_ROOT}/core/base
|
|
|
|
INTERFACE ${_AX_ROOT}/core/audio
|
|
|
|
INTERFACE ${_AX_ROOT}/core/platform/${PLATFORM_FOLDER}
|
2019-11-23 20:27:39 +08:00
|
|
|
)
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
set_target_properties(${_AX_CORE_LIB}
|
2019-11-23 20:27:39 +08:00
|
|
|
PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
|
2021-04-22 22:01:47 +08:00
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
2022-08-29 20:51:22 +08:00
|
|
|
VERSION "${_AX_VERSION}"
|
2019-11-23 20:27:39 +08:00
|
|
|
FOLDER "Internal"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(XCODE OR VS)
|
2022-08-11 15:41:10 +08:00
|
|
|
ax_mark_code_files("${_AX_CORE_LIB}")
|
2019-11-23 20:27:39 +08:00
|
|
|
endif()
|
|
|
|
|
2022-10-10 03:52:04 +08:00
|
|
|
message("CMake ${_AX_CORE_LIB} target_precompile_headers")
|
2022-10-11 08:54:02 +08:00
|
|
|
target_precompile_headers(${_AX_CORE_LIB} PRIVATE
|
2022-10-12 07:04:01 +08:00
|
|
|
"$<$<COMPILE_LANGUAGE:CXX>:axmol.h>"
|
2022-10-11 08:54:02 +08:00
|
|
|
)
|
2022-10-10 03:52:04 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
if(WINDOWS)
|
2023-09-26 00:11:33 +08:00
|
|
|
# cppwinrt or webview2 require nuget
|
|
|
|
if(WINDOWS_STORE OR AX_ENABLE_MSEDGE_WEBVIEW2)
|
2021-12-31 12:12:40 +08:00
|
|
|
find_program(NUGET_EXE NAMES nuget
|
2023-07-06 16:09:54 +08:00
|
|
|
PATHS ${_AX_ROOT}/tools/external/nuget)
|
2021-12-31 12:12:40 +08:00
|
|
|
|
|
|
|
if(NOT NUGET_EXE)
|
|
|
|
message("NUGET.EXE not found.")
|
2023-07-06 14:00:21 +08:00
|
|
|
message(FATAL_ERROR "Please run setup.ps1 again to download NUGET.EXE, and run CMake again.")
|
2021-12-31 12:12:40 +08:00
|
|
|
endif()
|
2023-09-26 00:11:33 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WINDOWS_STORE)
|
|
|
|
# intsall cppwinrt package for xaml apps
|
|
|
|
exec_program(${NUGET_EXE}
|
|
|
|
ARGS install "Microsoft.Windows.CppWinRT" -Version ${AX_CPPWINRT_VERISON} -ExcludeVersion -OutputDirectory "\"${CMAKE_BINARY_DIR}/packages\"")
|
|
|
|
set_target_properties(${_AX_CORE_LIB} PROPERTIES
|
|
|
|
VS_PROJECT_IMPORT ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.props
|
|
|
|
)
|
|
|
|
target_link_libraries(${_AX_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.targets)
|
|
|
|
endif()
|
|
|
|
if(AX_ENABLE_MSEDGE_WEBVIEW2)
|
2021-12-31 12:12:40 +08:00
|
|
|
exec_program(${NUGET_EXE}
|
2023-09-20 09:54:27 +08:00
|
|
|
ARGS install "Microsoft.Web.WebView2" -Version 1.0.992.28 -ExcludeVersion -OutputDirectory "\"${CMAKE_BINARY_DIR}/packages\"")
|
2022-04-26 15:16:02 +08:00
|
|
|
|
2023-04-02 16:04:19 +08:00
|
|
|
if(CMAKE_GENERATOR MATCHES "Ninja")
|
2022-08-08 18:02:17 +08:00
|
|
|
target_link_libraries(${_AX_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/${ARCH_ALIAS}/WebView2Loader.dll.lib)
|
|
|
|
target_include_directories(${_AX_CORE_LIB} PUBLIC ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/include)
|
2022-04-26 15:16:02 +08:00
|
|
|
else()
|
2022-08-08 18:02:17 +08:00
|
|
|
target_link_libraries(${_AX_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets)
|
2022-04-26 15:16:02 +08:00
|
|
|
endif()
|
2021-10-04 15:55:01 +08:00
|
|
|
endif()
|
2019-11-23 20:27:39 +08:00
|
|
|
endif()
|
|
|
|
|
2023-10-11 01:05:22 +08:00
|
|
|
# AX_USE_SSE
|
|
|
|
if (AX_ISA_SIMD MATCHES "sse")
|
|
|
|
target_compile_definitions(${_AX_CORE_LIB} PUBLIC AX_USE_SSE=1)
|
|
|
|
endif()
|
|
|
|
|
2020-08-03 20:31:47 +08:00
|
|
|
# engine extensions
|
2023-07-06 16:09:54 +08:00
|
|
|
add_subdirectory(${_AX_ROOT}/extensions ${ENGINE_BINARY_PATH}/extensions)
|
2020-08-03 20:31:47 +08:00
|
|
|
|
2022-05-13 21:06:17 +08:00
|
|
|
if(MSVC)
|
2022-10-13 21:44:42 +08:00
|
|
|
target_sources(${_AX_CORE_LIB} PRIVATE ./axmol.natvis)
|
2022-08-08 18:02:17 +08:00
|
|
|
target_sources(${_AX_CORE_LIB} PRIVATE ../thirdparty/yasio/yasio.natvis)
|
|
|
|
target_sources(${_AX_CORE_LIB} PRIVATE ../thirdparty/robin-map/tsl-robin-map.natvis)
|
|
|
|
target_compile_options(${_AX_CORE_LIB} PUBLIC "/Zm2000")
|
2021-12-10 19:15:48 +08:00
|
|
|
endif()
|
|
|
|
|
2022-12-17 16:35:34 +08:00
|
|
|
if(ANDROID)
|
2023-07-06 16:09:54 +08:00
|
|
|
add_subdirectory(${_AX_ROOT}/core/platform/android ${ENGINE_BINARY_PATH}/core/cpp-android)
|
2022-12-17 16:35:34 +08:00
|
|
|
endif()
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
#if(XCODE)
|
|
|
|
# # Later versions of Xcode clang want to compile C++17 with aligned allocation turned on and this is only supported on iOS 11.0+
|
|
|
|
# # TODO: Only turn this off if ${CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET} < 11.0
|
2022-08-08 18:02:17 +08:00
|
|
|
# target_compile_options(${_AX_CORE_LIB} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-fno-aligned-allocation>)
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif()
|