mirror of https://github.com/axmolengine/axmol.git
finish angle dependencies auto copy for win32, make flatbuffers dep header only
This commit is contained in:
parent
3d3fea28c6
commit
93a3452261
|
@ -37,7 +37,6 @@ THE SOFTWARE.
|
|||
#include "editor-support/cocostudio/CSParseBinary_generated.h"
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "flatbuffers/util.h"
|
||||
|
||||
#include "editor-support/cocostudio/FlatBuffersSerialize.h"
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@
|
|||
#include "editor-support/cocostudio/CCComExtensionData.h"
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "flatbuffers/util.h"
|
||||
|
||||
#include "editor-support/cocostudio/FlatBuffersSerialize.h"
|
||||
|
||||
|
|
|
@ -62,9 +62,6 @@
|
|||
#include "editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldExReader.h"
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "flatbuffers/util.h"
|
||||
|
||||
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace cocos2d::ui;
|
||||
|
@ -328,10 +325,9 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithOpaque(void* opaque,
|
|||
std::string outFullPath = FileUtils::getInstance()->fullPathForFilename(flatbuffersFileName);
|
||||
size_t pos = outFullPath.find_last_of('.');
|
||||
std::string convert = outFullPath.substr(0, pos).append(".csb");
|
||||
auto save = flatbuffers::SaveFile(convert.c_str(),
|
||||
reinterpret_cast<const char *>(thiz->_builder->GetBufferPointer()),
|
||||
auto save = FileUtils::writeBinaryToFile(thiz->_builder->GetBufferPointer(),
|
||||
thiz->_builder->GetSize(),
|
||||
true);
|
||||
convert);
|
||||
if (!save)
|
||||
{
|
||||
return "couldn't save files!";
|
||||
|
@ -1668,10 +1664,8 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFileForLanguageData
|
|||
|
||||
auto langSet = CreateLanguageSet(*_builder, _builder->CreateVector(langItemList));
|
||||
_builder->Finish(langSet);
|
||||
bool isSuccess = flatbuffers::SaveFile(flatBuffersFilePath.c_str(),
|
||||
reinterpret_cast<const char *>(_builder->GetBufferPointer()),
|
||||
_builder->GetSize(),
|
||||
true);
|
||||
bool isSuccess = FileUtils::writeBinaryToFile(_builder->GetBufferPointer(),
|
||||
_builder->GetSize(), flatBuffersFilePath);
|
||||
|
||||
if (isSuccess)
|
||||
return "";
|
||||
|
|
|
@ -497,27 +497,7 @@ void FileUtils::writeStringToFile(std::string dataStr, const std::string& fullPa
|
|||
|
||||
bool FileUtils::writeDataToFile(const Data& data, const std::string& fullPath) const
|
||||
{
|
||||
size_t size = 0;
|
||||
const char* mode = "wb";
|
||||
|
||||
CCASSERT(!fullPath.empty() && data.getSize() != 0, "Invalid parameters.");
|
||||
|
||||
auto fileutils = FileUtils::getInstance();
|
||||
do
|
||||
{
|
||||
// Read the file from hardware
|
||||
FILE *fp = fopen(fullPath.c_str(), mode);
|
||||
CC_BREAK_IF(!fp);
|
||||
size = data.getSize();
|
||||
|
||||
fwrite(data.getBytes(), size, 1, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return true;
|
||||
} while (0);
|
||||
|
||||
return false;
|
||||
return FileUtils::writeBinaryToFile(data.getBytes(), data.getSize(), fullPath);
|
||||
}
|
||||
|
||||
void FileUtils::writeDataToFile(Data data, const std::string& fullPath, std::function<void(bool)> callback) const
|
||||
|
@ -527,6 +507,28 @@ void FileUtils::writeDataToFile(Data data, const std::string& fullPath, std::fun
|
|||
}, std::move(callback), std::move(data));
|
||||
}
|
||||
|
||||
bool FileUtils::writeBinaryToFile(const void* data, size_t dataSize, const std::string& fullPath)
|
||||
{
|
||||
const char* mode = "wb";
|
||||
|
||||
CCASSERT(!fullPath.empty() && dataSize > 0, "Invalid parameters.");
|
||||
|
||||
auto fileutils = FileUtils::getInstance();
|
||||
do
|
||||
{
|
||||
// Read the file from hardware
|
||||
FILE* fp = fopen(fullPath.c_str(), mode);
|
||||
CC_BREAK_IF(!fp);
|
||||
fwrite(data, dataSize, 1, fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return true;
|
||||
} while (0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileUtils::init()
|
||||
{
|
||||
DECLARE_GUARD;
|
||||
|
|
|
@ -542,6 +542,11 @@ public:
|
|||
*@return bool
|
||||
*/
|
||||
virtual bool writeDataToFile(const Data& data, const std::string& fullPath) const;
|
||||
|
||||
/**
|
||||
* save data to file
|
||||
*/
|
||||
static bool writeBinaryToFile(const void* data, size_t dataSize, const std::string& fullPath);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -155,3 +155,13 @@ if(LINUX OR WINDOWS)
|
|||
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
|
||||
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_custom_command(TARGET ${APP_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libGLESv2.dll
|
||||
${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libEGL.dll
|
||||
${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/d3dcompiler_47.dll
|
||||
$<TARGET_FILE_DIR:${APP_NAME}>
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -432,3 +432,13 @@ if(WINDOWS)
|
|||
set_target_properties(${APP_NAME} PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h")
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/Classes/precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_custom_command(TARGET ${APP_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libGLESv2.dll
|
||||
${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libEGL.dll
|
||||
${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/d3dcompiler_47.dll
|
||||
$<TARGET_FILE_DIR:${APP_NAME}>
|
||||
)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue