axmol/cmake/Modules/AXBuildSet.cmake

66 lines
2.5 KiB
CMake
Raw Normal View History

2019-11-23 20:27:39 +08:00
# print cmake debug info
set(CMAKE_DEBUG_TARGET_PROPERTIES
# INCLUDE_DIRECTORIES
# COMPILE_DEFINITIONS
# COMPILE_OPTIONS
# AUTOUIC_OPTIONS
# POSITION_INDEPENDENT_CODE
)
2022-08-11 15:41:10 +08:00
# some useful variables for every one axys project
2019-11-23 20:27:39 +08:00
set(ENGINE_BINARY_PATH ${PROJECT_BINARY_DIR}/engine)
if(CMAKE_TOOLCHAIN_FILE)
message(STATUS "using toolchain file:" ${CMAKE_TOOLCHAIN_FILE})
endif()
find_program(PYTHON_COMMAND NAMES python3 python2 python)
2022-08-11 15:41:10 +08:00
find_program(_AX_COMMAND NAME axis
PATHS ${_AX_ROOT_PATH}/tools/axis-console/bin $ENV{_AX_CONSOLE_ROOT})
2019-11-23 20:27:39 +08:00
message(STATUS "PROJECT_NAME:" ${PROJECT_NAME})
message(STATUS "PROJECT_SOURCE_DIR:" ${PROJECT_SOURCE_DIR})
message(STATUS "_AX_ROOT_PATH:" ${_AX_ROOT_PATH})
2019-11-23 20:27:39 +08:00
message(STATUS "CMAKE_MODULE_PATH:" ${CMAKE_MODULE_PATH})
# delete binary dir if you hope a full clean re-build
message(STATUS "PROJECT_BINARY_DIR:" ${PROJECT_BINARY_DIR})
message(STATUS "ENGINE_BINARY_PATH:" ${ENGINE_BINARY_PATH})
message(STATUS "PYTHON_PATH:" ${PYTHON_COMMAND})
2022-08-11 15:41:10 +08:00
message(STATUS "_AX_COMMAND_PATH:" ${_AX_COMMAND})
2019-11-23 20:27:39 +08:00
message(STATUS "HOST_SYSTEM:" ${CMAKE_HOST_SYSTEM_NAME})
# the default behavior of build module
option(AX_ENABLE_EXT_LUA "Build lua libraries" OFF)
2019-11-23 20:27:39 +08:00
2020-08-03 20:31:47 +08:00
# hold the extensions list to auto link to app
set(_AX_EXTENSION_LIBS "" CACHE INTERNAL "extensions for auto link to target application")
2020-08-03 20:31:47 +08:00
2019-11-23 20:27:39 +08:00
# include helper functions
2022-08-08 18:02:17 +08:00
include(AXBuildHelpers)
2019-11-23 20:27:39 +08:00
# set common compiler options
# add target compile define function
# add target compile options function
2022-08-08 18:02:17 +08:00
include(AXConfigDefine)
2019-11-23 20:27:39 +08:00
# config libraries dependence
2022-08-08 18:02:17 +08:00
include(AXConfigDepend)
2019-11-23 20:27:39 +08:00
2022-08-11 15:41:10 +08:00
if(_AX_COMMAND)
get_filename_component(ax_console_dir ${_AX_COMMAND} DIRECTORY)
set(_AX_LUAJIT_ROOT ${ax_console_dir}/../plugins/plugin_luacompile/bin)
2022-08-08 18:02:17 +08:00
message(STATUS "_AX_LUAJIT_ROOT:" ${_AX_LUAJIT_ROOT})
2019-11-23 20:27:39 +08:00
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
2022-08-08 18:02:17 +08:00
find_program(LUAJIT32_COMMAND NAMES luajit-win32 PATHS ${_AX_LUAJIT_ROOT}/32bit NO_SYSTEM_ENVIRONMENT_PATH)
find_program(LUAJIT64_COMMAND NAMES luajit-win32 PATHS ${_AX_LUAJIT_ROOT}/64bit NO_SYSTEM_ENVIRONMENT_PATH)
2019-11-23 20:27:39 +08:00
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
2022-08-08 18:02:17 +08:00
find_program(LUAJIT32_COMMAND NAMES luajit-linux PATHS ${_AX_LUAJIT_ROOT}/32bit NO_SYSTEM_ENVIRONMENT_PATH)
find_program(LUAJIT64_COMMAND NAMES luajit-linux PATHS ${_AX_LUAJIT_ROOT}/64bit NO_SYSTEM_ENVIRONMENT_PATH)
2019-11-23 20:27:39 +08:00
endif()
endif()
if(WINDOWS OR LINUX)
message(STATUS "LUAJIT32_COMMAND:" ${LUAJIT32_COMMAND})
message(STATUS "LUAJIT64_COMMAND:" ${LUAJIT64_COMMAND})
endif()