Use system env var 'COCOS2DX_ROOT' to avoid copy whole engine sources when create new project with template

This commit is contained in:
halx99 2020-10-18 01:01:36 +08:00
parent 7a4a5d0100
commit d02c9da98b
5 changed files with 33 additions and 5 deletions

View File

@ -36,7 +36,12 @@ if(XCODE)
endif()
if(NOT DEFINED BUILD_ENGINE_DONE) # to test HelloCpp into root project
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d)
if(NOT ("$ENV{COCOS2DX_ROOT}" STREQUAL ""))
message(STATUS "Using system env var COCOS2DX_ROOT=$ENV{COCOS2DX_ROOT}")
set(COCOS2DX_ROOT_PATH "$ENV{COCOS2DX_ROOT}")
else
message(FATAL_ERROR "Please add system env var 'COCOS2DX_ROOT' to specific the engine root")
endif()
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)

View File

@ -33,8 +33,15 @@ if(XCODE)
endif()
endif()
if(NOT ("$ENV{COCOS2DX_ROOT}" STREQUAL ""))
message(STATUS "Using system env var COCOS2DX_ROOT=$ENV{COCOS2DX_ROOT}")
set(COCOS2DX_ROOT_PATH "$ENV{COCOS2DX_ROOT}")
else
message(FATAL_ERROR "Please add system env var 'COCOS2DX_ROOT' to specific the engine root")
endif()
set(RUNTIME_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/runtime-src)
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x)
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)

View File

@ -11,7 +11,13 @@ if(XCODE)
endif()
if(NOT DEFINED BUILD_ENGINE_DONE)
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..)
if(NOT ("$ENV{COCOS2DX_ROOT}" STREQUAL ""))
message(STATUS "Using system env var COCOS2DX_ROOT=$ENV{COCOS2DX_ROOT}")
set(COCOS2DX_ROOT_PATH "$ENV{COCOS2DX_ROOT}")
else
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..)
endif()
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)

View File

@ -34,7 +34,12 @@ if(XCODE)
endif()
if(NOT DEFINED BUILD_ENGINE_DONE)
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..)
if(NOT ("$ENV{COCOS2DX_ROOT}" STREQUAL ""))
message(STATUS "Using system env var COCOS2DX_ROOT=$ENV{COCOS2DX_ROOT}")
set(COCOS2DX_ROOT_PATH "$ENV{COCOS2DX_ROOT}")
else
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..)
endif()
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)

View File

@ -11,7 +11,12 @@ if(XCODE)
endif()
if(NOT DEFINED BUILD_ENGINE_DONE)
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
if(NOT ("$ENV{COCOS2DX_ROOT}" STREQUAL ""))
message(STATUS "Using system env var COCOS2DX_ROOT=$ENV{COCOS2DX_ROOT}")
set(COCOS2DX_ROOT_PATH "$ENV{COCOS2DX_ROOT}")
else
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
endif()
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)