mirror of https://github.com/axmolengine/axmol.git
Fix python setup file.
This commit is contained in:
parent
cb20eb614c
commit
455be5d2ac
|
@ -5,9 +5,16 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/android-ci.yml
|
||||
- tools/unix-ci/**/*
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
GH_OS_NAME: linux
|
||||
|
|
|
@ -4,9 +4,12 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tools/tolua/*
|
||||
- .github/workflows/genbindings-ci.yml
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
|
|
@ -5,9 +5,15 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/ios-ci.yml
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
GH_OS_NAME: osx
|
||||
|
|
|
@ -5,9 +5,14 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/linux-ci.yml
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
|
|
@ -5,9 +5,14 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/osx-ci.yml
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
|
|
@ -3,7 +3,7 @@ name: pull_request
|
|||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '**/README.md'
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
|
|
|
@ -5,9 +5,15 @@ on:
|
|||
branches:
|
||||
- dev
|
||||
- release
|
||||
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
paths:
|
||||
- cmake/**/*
|
||||
- core/**/*
|
||||
- extensions/**/*
|
||||
- tests/**/*
|
||||
- thirdparty/**/*
|
||||
- CMakeLists.txt
|
||||
- .github/workflows/windows-ci.yml
|
||||
- tools/win-ci/build.ps1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2014-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
Copyright (c) 2022 Bytedance Inc.
|
||||
|
||||
https://adxeproject.github.io/
|
||||
|
||||
|
@ -44,13 +43,8 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
using ilist_u16_t = std::initializer_list<uint16_t>;
|
||||
using ilist_u32_t = std::initializer_list<uint32_t>;
|
||||
|
||||
// The underlaying GL driver support U_INT8, U_SHORT, U_INT32, but we support U_SHORT and U_INT32 only
|
||||
template <typename _T>
|
||||
inline constexpr bool is_index_format_type_v = std::is_integral_v<_T> &&
|
||||
(std::is_same_v<_T, uint16_t> || std::is_same_v<_T, uint32_t>);
|
||||
using uint16_index_format = std::integral_constant<int, 1>;
|
||||
using uint32_index_format = std::integral_constant<int, 2>;
|
||||
|
||||
class IndexArray
|
||||
{
|
||||
|
@ -64,8 +58,11 @@ public:
|
|||
IndexArray() : _stride(formatToStride(backend::IndexFormat::U_SHORT)) {}
|
||||
IndexArray(backend::IndexFormat indexFormat) : _stride(formatToStride(indexFormat)) {}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
IndexArray(std::initializer_list<_Ty> rhs) : _stride(sizeof(_Ty)), _buffer(rhs)
|
||||
IndexArray(std::initializer_list<uint16_t> rhs, uint16_index_format /*U_SHORT*/)
|
||||
: _stride(formatToStride(backend::IndexFormat::U_SHORT)), _buffer(rhs)
|
||||
{}
|
||||
IndexArray(std::initializer_list<uint32_t> rhs, uint32_index_format /*U_INT*/)
|
||||
: _stride(formatToStride(backend::IndexFormat::U_INT)), _buffer(rhs)
|
||||
{}
|
||||
|
||||
IndexArray(const IndexArray& rhs) : _stride(rhs._stride), _buffer(rhs._buffer) {}
|
||||
|
@ -89,99 +86,43 @@ public:
|
|||
_buffer.swap(rhs._buffer);
|
||||
}
|
||||
|
||||
/** Returns the format of the index array. */
|
||||
backend::IndexFormat format() const { return strideToFormat(_stride); }
|
||||
|
||||
/** Clears the internal byte buffer. */
|
||||
void clear() { _buffer.clear(); }
|
||||
|
||||
/** Clears the internal byte buffer and sets the format specified. */
|
||||
void clear(backend::IndexFormat format)
|
||||
{
|
||||
clear();
|
||||
_stride = formatToStride(format);
|
||||
}
|
||||
|
||||
/** Pushes back a value. */
|
||||
template <typename _Ty, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void push_back(const _Ty& val)
|
||||
void push_back(uint32_t val)
|
||||
{
|
||||
assert(_stride == sizeof(_Ty));
|
||||
assert(_stride == 2 || _stride == 4);
|
||||
_buffer.append_n((uint8_t*)&val, _stride);
|
||||
}
|
||||
|
||||
/** Inserts a list containing unsigned int (uint16_t/uint32_t) data. */
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void insert(_Ty* position, std::initializer_list<_Ty> ilist)
|
||||
/** Inserts a list containing unsigned short (uint16_t) data. */
|
||||
void insert(size_t offset, std::initializer_list<uint16_t> ilist, uint16_index_format /*U_SHORT*/)
|
||||
{
|
||||
insert(position, ilist.begin(), ilist.end());
|
||||
assert(_stride == 2);
|
||||
binsert(offset * _stride, ilist.begin(), ilist.end());
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void insert(_Ty* position, _Ty* first, _Ty* last)
|
||||
/** Inserts a list containing unsigned int (uint32_t) data. */
|
||||
void insert(size_t offset, std::initializer_list<uint32_t> ilist, uint32_index_format /*U_INT*/)
|
||||
{
|
||||
assert(_stride == sizeof(_Ty));
|
||||
binsert(position, first, last);
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
void insert(size_t offset, std::initializer_list<_Ty> ilist)
|
||||
{
|
||||
assert(_stride == sizeof(_Ty));
|
||||
binsert(begin<_Ty>() + offset, ilist.begin(), ilist.end());
|
||||
assert(_stride == 4);
|
||||
binsert(offset * _stride, ilist.begin(), ilist.end());
|
||||
}
|
||||
|
||||
/** Inserts range data based on an offset in bytes. */
|
||||
void binsert(uint8_t* position, const void* first, const void* last)
|
||||
void binsert(size_t offset, const void* first, const void* last)
|
||||
{
|
||||
_buffer.insert(position, (const uint8_t*)first, (const uint8_t*)last);
|
||||
_buffer.insert(offset, (const uint8_t*)first, (const uint8_t*)last);
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
const _Ty* begin() const
|
||||
{
|
||||
return (const _Ty*)_buffer.begin();
|
||||
}
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* begin()
|
||||
{
|
||||
return (_Ty*)_buffer.begin();
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
const _Ty* end() const
|
||||
{
|
||||
return (const _Ty*)_buffer.end();
|
||||
}
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* end()
|
||||
{
|
||||
return (_Ty*)_buffer.end();
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* erase(_Ty* position)
|
||||
{
|
||||
return (_Ty*)_buffer.erase((uint8_t*)position);
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
_Ty* erase(_Ty* first, _Ty* last)
|
||||
{
|
||||
return (_Ty*)_buffer.erase((uint8_t*)first, (uint8_t*)last);
|
||||
}
|
||||
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
template <typename _Ty>
|
||||
_Ty& at(size_t idx)
|
||||
{
|
||||
assert(sizeof(_Ty) == _stride);
|
||||
return (_Ty&)_buffer[idx * sizeof(_Ty)];
|
||||
}
|
||||
template <typename _Ty = uint16_t, std::enable_if_t<is_index_format_type_v<_Ty>, int> = 0>
|
||||
const _Ty& at(size_t idx) const
|
||||
{
|
||||
assert(sizeof(_Ty) == _stride);
|
||||
return (const _Ty&)_buffer[idx * sizeof(_Ty)];
|
||||
if (idx < this->size())
|
||||
return (_Ty&)_buffer[idx * sizeof(_Ty)];
|
||||
throw std::out_of_range("IndexArray: out of range!");
|
||||
}
|
||||
|
||||
uint8_t* data() noexcept { return _buffer.data(); }
|
||||
|
@ -200,6 +141,16 @@ public:
|
|||
/** Returns true if the container is empty. Otherwise, false. */
|
||||
bool empty() const { return _buffer.empty(); }
|
||||
|
||||
/** Returns the format of the index array. */
|
||||
backend::IndexFormat format() const { return strideToFormat(_stride); }
|
||||
|
||||
/** Clears the internal byte buffer and sets the format specified. */
|
||||
void clear(backend::IndexFormat format)
|
||||
{
|
||||
clear();
|
||||
_stride = formatToStride(format);
|
||||
}
|
||||
|
||||
template <typename _Fty>
|
||||
void for_each(_Fty cb) const
|
||||
{
|
||||
|
@ -304,6 +255,7 @@ struct NodeDatas
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/**mesh data
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
|
46
setup.py
46
setup.py
|
@ -26,11 +26,11 @@ THE SOFTWARE.
|
|||
****************************************************************************"""
|
||||
|
||||
'''
|
||||
This script will install environment variables needed to by adxe. It will set these envrironment variables:
|
||||
* ADXE_CONSOLE_ROOT: used to run adxe console tools
|
||||
This script will install environment variables needed to by axis. It will set these envrironment variables:
|
||||
* AXIS_CONSOLE_ROOT: used to run axis console tools
|
||||
* ANDROID_NDK: used to build android native codes
|
||||
* ANDROID_SDK: used to generate applicatoin on Android through commands
|
||||
* ADXE_ROOT: path where adxe is installed
|
||||
* AXIS_ROOT: path where axis is installed
|
||||
|
||||
On Max OS X, when start a shell, it will read these files and execute commands in sequence:
|
||||
|
||||
|
@ -63,8 +63,8 @@ from time import time
|
|||
from time import sleep
|
||||
from os.path import dirname
|
||||
|
||||
ADXE_ROOT = 'ADXE_ROOT'
|
||||
ADXE_CONSOLE_ROOT = 'ADXE_CONSOLE_ROOT'
|
||||
AXIS_ROOT = 'AXIS_ROOT'
|
||||
AXIS_CONSOLE_ROOT = 'AXIS_CONSOLE_ROOT'
|
||||
|
||||
ANDROID_NDK = 'ANDROID_NDK'
|
||||
ANDROID_SDK = 'ANDROID_SDK'
|
||||
|
@ -191,7 +191,7 @@ class SetEnvVar(object):
|
|||
self.need_backup = False
|
||||
|
||||
file = open(self.file_used_for_setup, 'a')
|
||||
file.write('\n# Add environment variable %s for adxe\n' % key)
|
||||
file.write('\n# Add environment variable %s for axis\n' % key)
|
||||
file.write('export %s="%s"\n' % (key, value))
|
||||
file.write('export PATH=$%s:$PATH\n' % key)
|
||||
if key == ANDROID_SDK:
|
||||
|
@ -454,41 +454,41 @@ class SetEnvVar(object):
|
|||
print(" ->Add directory \"%s\" into PATH failed!\n" % add_dir)
|
||||
|
||||
def set_console_root(self):
|
||||
print("->Check environment variable %s" % ADXE_CONSOLE_ROOT)
|
||||
adxe_console_root = os.path.join(
|
||||
print("->Check environment variable %s" % AXIS_CONSOLE_ROOT)
|
||||
axis_console_root = os.path.join(
|
||||
self.current_absolute_path, 'tools', 'console', 'bin')
|
||||
old_dir = self._find_environment_variable(ADXE_CONSOLE_ROOT)
|
||||
old_dir = self._find_environment_variable(AXIS_CONSOLE_ROOT)
|
||||
if old_dir is None:
|
||||
# add environment variable
|
||||
if self._isWindows():
|
||||
self.set_windows_path(adxe_console_root)
|
||||
self.set_windows_path(axis_console_root)
|
||||
|
||||
self._set_environment_variable(
|
||||
ADXE_CONSOLE_ROOT, adxe_console_root)
|
||||
AXIS_CONSOLE_ROOT, axis_console_root)
|
||||
else:
|
||||
if old_dir == adxe_console_root:
|
||||
if old_dir == axis_console_root:
|
||||
# is same with before, nothing to do
|
||||
return
|
||||
|
||||
# update the environment variable
|
||||
if self._isWindows():
|
||||
self.remove_dir_from_win_path(old_dir)
|
||||
self.set_windows_path(adxe_console_root)
|
||||
self.set_windows_path(axis_console_root)
|
||||
|
||||
self._force_update_env(ADXE_CONSOLE_ROOT, adxe_console_root)
|
||||
self._force_update_env(AXIS_CONSOLE_ROOT, axis_console_root)
|
||||
|
||||
def set_adxe_root(self):
|
||||
print("->Check environment variable %s" % ADXE_ROOT)
|
||||
adxe_root = self.current_absolute_path
|
||||
old_dir = self._find_environment_variable(ADXE_ROOT)
|
||||
def set_axis_root(self):
|
||||
print("->Check environment variable %s" % AXIS_ROOT)
|
||||
axis_root = self.current_absolute_path
|
||||
old_dir = self._find_environment_variable(AXIS_ROOT)
|
||||
if old_dir is None:
|
||||
# add environment variable
|
||||
self._set_environment_variable(ADXE_ROOT, adxe_root)
|
||||
self._set_environment_variable(AXIS_ROOT, axis_root)
|
||||
else:
|
||||
if old_dir == adxe_root:
|
||||
if old_dir == axis_root:
|
||||
# is same with before, nothing to do
|
||||
return
|
||||
self._force_update_env(ADXE_ROOT, adxe_root)
|
||||
self._force_update_env(AXIS_ROOT, axis_root)
|
||||
|
||||
def _force_update_unix_env(self, var_name, value):
|
||||
import re
|
||||
|
@ -641,11 +641,11 @@ class SetEnvVar(object):
|
|||
|
||||
def set_environment_variables(self, ndk_root, android_sdk_root, quiet):
|
||||
|
||||
print('\nSetting up adxe...')
|
||||
print('\nSetting up axis...')
|
||||
|
||||
self.file_used_for_setup = self._get_filepath_for_setup()
|
||||
|
||||
self.set_adxe_root()
|
||||
self.set_axis_root()
|
||||
self.set_console_root()
|
||||
|
||||
if self._isWindows():
|
||||
|
|
Loading…
Reference in New Issue