[DEV] compilation back on Android/windows

This commit is contained in:
Edouard DUPIN 2012-11-04 15:44:26 +01:00
parent 508162dfc8
commit d3eed67f00
11 changed files with 72 additions and 66 deletions

2
Build

@ -1 +1 @@
Subproject commit 4016ab8885720c1e9117c7f9542f7c6d3f3e4bd3
Subproject commit 0793d9eb2c2da85dc3dbe854886ba6b2fbadf4bd

View File

@ -42,6 +42,12 @@ extern "C" {
#endif
#ifdef __TARGET_OS__Windows
// For ctime
#include <time.h>
#endif
// zip file of the apk file for Android ==> set to zip file apk access
static etk::UString s_fileAPK = "";
static etk::UString baseApplName = "ewolNoName";
@ -137,12 +143,14 @@ void etk::InitDefaultFolder(const char * applName)
#else
char cCurrentPath[FILENAME_MAX];
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
baseFolderData = "./out/Linux/debug/staging/usr/share/";
baseFolderData = ".";
} else {
cCurrentPath[FILENAME_MAX - 1] = '\0';
baseFolderData = cCurrentPath;
baseFolderData += "/out/Linux/debug/staging/usr/share/";
}
baseFolderData += "/out/Linux/debug/staging/";
baseFolderData += baseApplName;
baseFolderData += "/usr/share/";
#endif
baseFolderData += baseApplName;
baseFolderData += "/";
@ -175,21 +183,21 @@ etk::UString etk::GetUserHomeFolder(void)
#ifdef __TARGET_OS__Android
bool etk::File::LoadDataZip(void)
bool etk::FSNode::LoadDataZip(void)
{
if (NULL != m_zipData) {
return true;
} else {
struct zip_file * m_zipPointerFile= zip_fopen_index(s_APKArchive, m_idZipFile, 0);
if (NULL == m_zipPointerFile) {
TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\"");
TK_ERROR("Can not find the file name" << *this);
return false;
}
// get the fileSize .... end read all the data from the zip files
struct zip_stat zipFileProperty;
zip_stat_init(&zipFileProperty);
zip_stat_index(s_APKArchive, m_idZipFile, 0, &zipFileProperty);
TK_VERBOSE("LOAD data from the files : \"" << GetCompleateName() << "\"");
TK_VERBOSE("LOAD data from the files : " << *this );
/*
TK_DEBUG(" name=" << zipFileProperty.name);
TK_DEBUG(" index=" << zipFileProperty.index);
@ -203,14 +211,14 @@ bool etk::File::LoadDataZip(void)
m_zipDataSize = zipFileProperty.size;
m_zipData = new char[m_zipDataSize +10];
if (NULL == m_zipData) {
TK_ERROR("File allocation ERROR : \"" << GetCompleateName() << "\"");
TK_ERROR("File allocation ERROR : " << *this);
zip_fclose(m_zipPointerFile);
return false;
}
memset(m_zipData, 0, m_zipDataSize +10);
int32_t sizeTmp = zip_fread(m_zipPointerFile, m_zipData, m_zipDataSize);
if (sizeTmp != m_zipDataSize) {
TK_ERROR("File load data ERROR : \"" << GetCompleateName() << "\"");
TK_ERROR("File load data ERROR : " << *this);
zip_fclose(m_zipPointerFile);
delete[] m_zipData;
return false;
@ -407,7 +415,7 @@ void etk::FSNode::PrivateSetName(etk::UString& newName)
bool isRoofFolder = false;
#ifdef __TARGET_OS__Windows
for (char iii='a' ; iii<='z' iii++) {
for (char iii='a' ; iii<='z' ; iii++) {
char tmpVal[10];
char tmpValMaj[10];
sprintf(tmpVal, "%c:/", iii);
@ -496,7 +504,7 @@ bool DirectCheckFile(etk::UString tmpFileNameDirect, bool checkInAPKIfNeeded=fal
continue;
}
if (tmpFileNameDirect == name) {
return true
return true;
}
}
return false;
@ -617,23 +625,23 @@ void etk::FSNode::UpdateFileSystemProperty(void)
TK_ERROR("Can not get pointer on file in the APK file id " << iii);
continue;
}
if (tmpFileNameDirect == name) {
if (m_systemFileName == name) {
m_idZipFile = iii;
break;
}
}
if( -1 == m_idZipFile
|| m_idZipFile >= s_APKnbFiles)) {
TK_ERROR("File Does not existed ... in APK : \"" << tmpFilename << "\"");
|| m_idZipFile >= s_APKnbFiles) {
TK_ERROR("File Does not existed ... in APK : \"" << m_systemFileName << "\"");
return;
}
// note : Zip does not support other think than file ...
// TODO : Suport folder parsing ...
m_typeNode=FSN_FILE;
m_rights.IsUserReadable(true);
m_rights.SetUserReadable(true);
// TODO : Set the time of the file (time program compilation)
// TODO : Set the USER ID in the group and the user Id ...
TK_DBG_MODE("File existed ... in APK : \"" << tmpFilename << "\" ==> id=" << m_idZipFile);
TK_DBG_MODE("File existed ... in APK : \"" << m_systemFileName << "\" ==> id=" << m_idZipFile);
return;
}
#endif
@ -649,9 +657,13 @@ void etk::FSNode::UpdateFileSystemProperty(void)
case S_IFCHR: m_typeNode=etk::FSN_CHARACTER; break;
case S_IFDIR: m_typeNode=etk::FSN_FOLDER; break;
case S_IFIFO: m_typeNode=etk::FSN_FIFO; break;
#ifndef __TARGET_OS__Windows
case S_IFLNK: m_typeNode=etk::FSN_LINK; break;
#endif
case S_IFREG: m_typeNode=etk::FSN_FILE; break;
#ifndef __TARGET_OS__Windows
case S_IFSOCK: m_typeNode=etk::FSN_SOCKET; break;
#endif
default: m_typeNode=etk::FSN_UNKNOW; break;
}
// Right
@ -814,7 +826,7 @@ const etk::FSNode& etk::FSNode::operator= (const etk::FSNode &obj )
m_PointerFile = NULL;
}
#ifdef __TARGET_OS__Android
m_idZipFile = etkF.m_idZipFile;
m_idZipFile = obj.m_idZipFile;
m_zipData = NULL;
m_zipDataSize = 0;
m_zipReadingOffset = 0;

View File

@ -33,20 +33,19 @@ LOCAL_EXPORT_LDLIBS += -ldl -llog
FILE_ABSTRACTION:=$(LOCAL_PATH)/ewol/os/gui.Android.base.cpp
FILE_ABSTRACTION_DEST:=ewol/os/gui.Android.cpp
FILE_ABSTRACTION_DEST:=ewol/os/gui.Android.tmp.cpp
EWOL_TMP_PATH:=$(LOCAL_PATH)
$(shell rm $(FILE_ABSTRACTION_DEST) $(LOCAL_PATH)/$(FILE_ABSTRACTION_DEST))
$(shell rm -f $(LOCAL_PATH)/$(FILE_ABSTRACTION_DEST))
$(LOCAL_PATH)/$(FILE_ABSTRACTION_DEST): $(FILE_ABSTRACTION)
$(Q)mkdir -p $(dir $@)
$(Q)cp -f $(FILE_ABSTRACTION) $@
$(Q)sed -i "s|__PROJECT_ORG_TYPE__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_ORGANISATION_TYPE__)))|" $@
$(Q)sed -i "s|__PROJECT_VENDOR__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_COMPAGNY__)))|" $@
$(Q)sed -i "s|__PROJECT_NAME__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__)))|" $@
$(Q)sed -i "s|__PROJECT_PACKAGE__|$(subst _,$(empty),$(call convert-special-char,$(CONFIG___EWOL_APPL_NAME__)))|" $@
$(Q)sed -i "s|__PROJECT_ORG_TYPE__|$(PROJECT_COMPAGNY_TYPE)|" $@
$(Q)sed -i "s|__PROJECT_VENDOR__|$(PROJECT_COMPAGNY_NAME2)|" $@
$(Q)sed -i "s|__PROJECT_NAME__|$(PROJECT_NAME2)|" $@
$(Q)sed -i "s|__PROJECT_PACKAGE__|$(PROJECT_NAME2)|" $@
$(FILE_ABSTRACTION_DEST): $(LOCAL_PATH)/$(FILE_ABSTRACTION_DEST)

View File

@ -19,27 +19,4 @@ menu "General"
help
This is the application Title
config __EWOL_APPL_ORGANISATION_TYPE__
prompt "OrganisationType"
string
default "com"
help
Can be manny things, but limit whith no space no special char and no Maj ... [a..z]
com : Commercial
net : Network??
org : Organisation
gov : Governement
mil : Military
edu : Education
pri : Private
museum : ...
config __EWOL_APPL_COMPAGNY__
prompt "Compagny Name"
string
default "Unknow"
help
This is the c name ...
endmenu

View File

@ -29,14 +29,6 @@ menu "Android"
bool "2: Lock in portrait mode"
endchoice
config __EWOL_ANDROID_ICON__
prompt "Select Icon"
string
default "@drawable/ic_luncher_ewol"
help
Select the source of the icon for the application ...
menu "Permissions"
config __ANDROID_PERMISSION__WRITE_EXTERNAL_STORAGE__
prompt "WRITE_EXTERNAL_STORAGE"

View File

@ -219,4 +219,4 @@ void ewol::CmdLine::Add(etk::UString& newElement)
int64_t ewol::GetTime(void)
{
return guiInterface::GetTime();
}
}

View File

@ -0,0 +1,25 @@
/**
*******************************************************************************
* @file ewolAndroidAbstraction.cpp
* @brief User abstraction for Android (Sources)
* @author Edouard DUPIN
* @date 14/12/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
// this include a dynamic generating file ==> this is really stupid, but it is needed for the dependency coherency
#include <ewol/os/gui.Android.tmp.cpp>

View File

@ -48,7 +48,7 @@ int64_t guiInterface::GetTime(void)
bool inputIsPressed[20];
static eSystem::specialKey_ts guiKeyBoardMode;
static ewol::specialKey_ts guiKeyBoardMode;
/**
* @brief Set the new title of the windows
@ -262,7 +262,7 @@ int main(int argc, char *argv[])
//start the basic thread :
eSystem::Init();
// get the icon file :
etk::File myIcon = APP_Icon();
etk::UString myIcon = APP_Icon();
//SetIcon(myIcon);
// Run ...

View File

@ -286,8 +286,9 @@ void guiInterface::SetTitle(etk::UString& title)
Pixmap icon_pixmap;
// TODO : I don't understand why it does not work ....
void SetIcon(etk::FSNode bitmapFile)
void SetIcon(etk::UString inputFile)
{
etk::FSNode bitmapFile(inputFile);
#ifdef DEBUG_X11_EVENT
EWOL_INFO("X11: try to set icon : " << bitmapFile);
#endif
@ -1175,7 +1176,7 @@ int main(int argc, char *argv[])
//start the basic thread :
eSystem::Init();
// get the icon file :
etk::FSNode myIcon = APP_Icon();
etk::UString myIcon = APP_Icon();
SetIcon(myIcon);
// Run ...

View File

@ -106,9 +106,9 @@ namespace guiInterface
//!< must be define in CPP by the application ... this are the main init and unInit of the Application
void APP_Init(void);
void APP_UnInit(void);
etk::FSNode APP_Icon(void);
void APP_Init(void);
void APP_UnInit(void);
etk::UString APP_Icon(void);
#define NB_MAX_INPUT (20)

View File

@ -6,15 +6,15 @@ LOCAL_MODULE := glew
#http://glew.sourceforge.net/index.html
ifeq ("$(SHADER)","1")
#ifneq ("$(CONFIG__VIDEO__OPENGL_ES_2)","")
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/glew/include/
LOCAL_EXPORT_LDLIBS := $(LOCAL_PATH)/glew/lib/glew32s.lib -lopengl32 -lgdi32
# to enable open gl 2 mode
LOCAL_CFLAGS += -D__VIDEO__OPENGL_ES_2
LOCAL_EXPORT_CFLAGS := -D__VIDEO__OPENGL_ES_2
else
LOCAL_EXPORT_LDLIBS := -lopengl32 -lgdi32
endif
#else
# LOCAL_EXPORT_LDLIBS := -lopengl32 -lgdi32
#endif
include $(BUILD_PREBUILT)