externalisation of build

This commit is contained in:
Edouard Dupin 2011-12-13 14:35:00 +01:00
parent 4b38c0f201
commit 4b380780e7
5 changed files with 12 additions and 449 deletions

View File

@ -49,7 +49,6 @@ DEFAULT_PLATFORM=X11
# default platform can be overridden
PLATFORM?=$(DEFAULT_PLATFORM)
#DATA_MODE=MEMORY
ifeq ($(PLATFORM), X11)
CXXFILES += base/guiX11.cpp
@ -57,16 +56,12 @@ else ifeq ($(PLATFORM), DoubleBuffer)
CXXFILES += base/guiDoubleBuffer.cpp
else ifeq ($(PLATFORM), IPhone)
CXXFILES += base/guiIPhone.cpp
DATA_MODE=MEMORY
else ifeq ($(PLATFORM), IPad)
CXXFILES += base/guiIPad.cpp
DATA_MODE=MEMORY
else ifeq ($(PLATFORM), Android)
CXXFILES += base/guiAndroid.cpp
DATA_MODE=MEMORY
else ifeq ($(PLATFORM), AndroidTablet)
CXXFILES += base/guiAndroidTablet.cpp
DATA_MODE=MEMORY
else
$(error you must specify a corect platform : make PLATFORM=$(SUPPORTED_PLATFORM))
endif
@ -105,14 +100,14 @@ X11FLAGS+= -lX11 -DEWOL_X11_MODE__XF86V -lXxf86vm
#X11FLAGS+= -lX11 -DEWOL_X11_MODE__XRENDER -lXrandr
#ifeq ($(shell if `pkg-config --exists freetype2` ; then echo "yes"; else echo "no"; fi), yes)
# FREETYPE_CFLAGS= `pkg-config --cflags freetype2` -DEWOL_USE_FREE_TYPE
# FREETYPE_LDFLAGS= `pkg-config --libs freetype2` -DEWOL_USE_FREE_TYPE
#else
ifeq ($(shell if `pkg-config --exists freetype2` ; then echo "yes"; else echo "no"; fi), yes)
FREETYPE_CFLAGS= `pkg-config --cflags freetype2` -DEWOL_USE_FREE_TYPE
FREETYPE_LDFLAGS= `pkg-config --libs freetype2` -DEWOL_USE_FREE_TYPE
else
FREETYPE_CFLAGS=
FREETYPE_LDFLAGS=
$(Info libFreeType-dev is not installed)
#endif
endif
###############################################################################
@ -145,10 +140,6 @@ CXXFLAGS+= -D_REENTRANT
CXXFLAGS+= $(DEFINE)
# remove warning from the convertion char*
CXXFLAGS+= -Wno-write-strings
#set data in memory
ifeq ($(DATA_MODE), MEMORY)
CXXFLAGS+= -DDATA_INTERNAL_BINARY
endif
CFLAGS= $(CXXFLAGS) -std=c99
@ -190,12 +181,6 @@ MAKE_DEPENDENCE=Makefile
### Files Listes ###
###############################################################################
#data File of the program :
ifeq ($(DATA_MODE), MEMORY)
CXXFILES += GeneratedData.cpp
endif
# tiny XML (extern OPEN Sources) :
CXXFILES += tinyXML/tinyxml.cpp \
tinyXML/tinyxmlparser.cpp \
@ -296,20 +281,6 @@ build: .encadrer .versionFile $(OUTPUT_NAME)
@echo $(CADRE_HAUT_BAS)
@mkdir -p $(addprefix $(OBJECT_DIRECTORY)/, $(LISTE_MODULES))
# Tool used to create a binary version of every element png or other needed by the application
fileToCpp: tools/fileToCpp.cpp
@echo $(F_ROUGE)" (bin) $@"$(F_NORMALE)
@$(CXX) $< -o $@
@strip -s $@
# Generate basic user Data
$(FILE_DIRECTORY)/GeneratedData.cpp: $(DATA_FILE) $(MAKE_DEPENDENCE) fileToCpp
@echo $(F_BLUE)" (.cpp) "$(DATA_FOLDER)" ==> $@"$(F_NORMALE)
@#echo ./pngToCpp $@ $(DATA_FILE)
./fileToCpp $@ $(DATA_FILE)
.versionFile:
@rm -f $(OBJECT_DIRECTORY)/ewol/ewol.o

View File

@ -1,161 +0,0 @@
/**
*******************************************************************************
* @file Main.cpp
* @brief main fonction
* @author Edouard DUPIN
* @date 13/10/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.
*
*******************************************************************************
*/
#include <ewol/ewol.h>
#include <ewol/Font.h>
#include <ewol/themeManager.h>
#include <ewol/widget/Button.h>
#include <ewol/widget/CheckBox.h>
#include <ewol/widget/SizerHori.h>
#include <ewol/widget/SizerVert.h>
#include <ewol/widget/Test.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// need to run xcompmgr to have transparency
class Plop :public ewol::Windows
{
public:
Plop(void)
{
// generate the display :
ewol::SizerHori * mySizer = new ewol::SizerHori();
SetSubWidget(mySizer);
ewol::Button * myButton = new ewol::Button("LB");
mySizer->SubWidgetAdd(myButton);
ewol::SizerVert * mySizerVert = new ewol::SizerVert();
mySizer->SubWidgetAdd(mySizerVert);
myButton = new ewol::Button("BT 3");
myButton->SetExpendX(true);
//myButton->SetExpendY(true);
mySizerVert->SubWidgetAdd(myButton);
ewol::Test * myTest = new ewol::Test();
mySizerVert->SubWidgetAdd(myTest);
ewol::CheckBox * myCheckBox = new ewol::CheckBox("mon label d'eK");
mySizerVert->SubWidgetAdd(myCheckBox);
myCheckBox = new ewol::CheckBox("Exemple 2");
mySizerVert->SubWidgetAdd(myCheckBox);
myCheckBox = new ewol::CheckBox("Exemple 3 et éà$");
mySizerVert->SubWidgetAdd(myCheckBox);
myTest = new ewol::Test();
myTest->SetExpendY(true);
mySizerVert->SubWidgetAdd(myTest);
myButton = new ewol::Button("4 4 BT");
myButton->SetExpendY(true);
mySizerVert->SubWidgetAdd(myButton);
myButton = new ewol::Button("Exemple 2");
myButton->SetExpendX(true);
mySizer->SubWidgetAdd(myButton);
};
~Plop(void)
{
};
};
static Plop * myWindowsExample = NULL;
/**
* @brief main application function Initialisation
*/
void APP_Init(int argc, char *argv[])
{
ewol::ChangeSize(800, 600);
/*
if (true == ewol::AddFont("dataTest/TextMonospace.ebt", true, true, true) ) {
//fontID = GetFontIdWithFileName("dataTest/TextMonospace.ebt");
}
*/
ewol::SetFontFolder("Font");
//ewol::SetDefaultFont("freefont/FreeMono", 14);
//ewol::SetDefaultFont("ebtfont/Monospace", 14);
ewol::SetDefaultFont("ebtfont/Monospace", 33);
//ewol::theme::LoadDefault("dataTest/exemple.eol");
/*
etk::File fileTmp("exemple.eol", etk::FILE_TYPE_DATA);
ewol::theme::LoadDefault(fileTmp);
*/
/*
etk::File tmpFile("/data/data/com.example.EwolActivity.app/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
tmpFile = ("/data/data/com.example.EwolActivity/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
tmpFile=("/data/com.example.EwolActivity.app/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
tmpFile=("/data/com.example.EwolActivity/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
tmpFile=("/data/data/com.example.ewolactivity.app/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
tmpFile=("/data/data/com.example.ewolactivity/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
tmpFile=("/data/com.example.ewolactivity.app/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
tmpFile=("/data/com.example.ewolactivity/assets/theme/exemple.eol");
if (tmpFile.Exist() ) {
EWOL_WARNING("file existed : " << tmpFile);
}
*/
myWindowsExample = new Plop();
// create the specific windows
ewol::DisplayWindows(myWindowsExample);
}
/**
* @brief main application function Un-Initialisation
*/
void APP_UnInit(void)
{
delete(myWindowsExample);
}

View File

@ -2,13 +2,14 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_BUILD_PATH := $(LOCAL_PATH)/Object_android
LOCAL_MODULE := ewolabstraction
LOCAL_STATIC_LIBRARIES := libzip libpng ewoltestExemple
LOCAL_MODULE := ewol
LOCAL_STATIC_LIBRARIES := libzip libpng
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Sources $(LOCAL_PATH)/../libzip/ $(LOCAL_PATH)/../libpng/
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../Sources
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM -ldl -llog -lz
LOCAL_CFLAGS := -D__PLATFORM__Android \
-Wno-write-strings \
-DETK_DEBUG_LEVEL=3 \
@ -17,10 +18,6 @@ LOCAL_CFLAGS := -D__PLATFORM__Android \
-DVERSION_BUILD_TIME="\"pasd_heure\"" \
-DDATA_IN_APK \
# -DDATA_INTERNAL_BINARY
# ../../Sources/GeneratedData.cpp \
LOCAL_SRC_FILES := \
../../Sources/base/guiAndroid.cpp \
../../Sources/tinyXML/tinyxml.cpp \
@ -68,8 +65,7 @@ LOCAL_SRC_FILES := \
#for freetype : https://github.com/cdave1/freetype2-android
# Ewol Test Software :
CXXFILES += Main.cpp
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lz
include $(BUILD_SHARED_LIBRARY)
#include $(BUILD_STATIC_LIBRARY)
#include $(BUILD_SHARED_LIBRARY)
include $(BUILD_STATIC_LIBRARY)

View File

@ -1,23 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_BUILD_PATH := $(LOCAL_PATH)/Object_android
LOCAL_MODULE := ewoltestExemple
#LOCAL_STATIC_LIBRARIES := ewolabstraction
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Sources
LOCAL_CFLAGS := -D__PLATFORM__Android \
-Wno-write-strings \
LOCAL_SRC_FILES := \
../../Sources/Main.cpp \
# Ewol Test Software :
CXXFILES += Main.cpp
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
#include $(BUILD_SHARED_LIBRARY)
include $(BUILD_STATIC_LIBRARY)

View File

@ -1,220 +0,0 @@
/**
*******************************************************************************
* @file pngToCpp.cpp
* @brief convert a binary file into a C source vector
* @author Sandro Sigala
* @date 26/01/2011
* @par Project
* ---
*
* @version $Id$
*
* @par Copyright
* THE "BEER-WARE LICENSE" (Revision 3.1415):
* sandro AT sigala DOT it wrote this file. As long as you retain this notice you can do
* whatever you want with this stuff. If we meet some day, and you think this stuff is
* worth it, you can buy me a beer in return. Sandro Sigala
*
* @compilation g++ pngToCpp -o pngToCpp
*
*******************************************************************************
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
bool zeroTerminated = false;
int myfgetc(FILE *f)
{
int c = fgetc(f);
if (c == EOF && zeroTerminated)
{
zeroTerminated = 0;
return 0;
}
return c;
}
void generateHeader(FILE *file)
{
fprintf(file, "/**\n");
fprintf(file, " ******************************************************************************* \n");
fprintf(file, " * \n");
fprintf(file, " * @par Project\n");
fprintf(file, " * Edn\n");
fprintf(file, " * \n");
fprintf(file, " * Automatic generated file for Edn Software\n");
fprintf(file, " * Please do not save this file on File configuration server\n");
fprintf(file, " * \n");
fprintf(file, " * @par Copyright\n");
fprintf(file, " * The copyright of the data depend on the source file but generated file is on GPL v3\n");
fprintf(file, " * \n");
fprintf(file, " * Copyright 2010 Edouard DUPIN, all right reserved\n");
fprintf(file, " * \n");
fprintf(file, " * This is free software; you can redistribute it and/or modify it under the\n");
fprintf(file, " * terms of the GNU General Public License as published by the Free Software\n");
fprintf(file, " * Foundation; either version 3 of the License, or (at your option) any later\n");
fprintf(file, " * version.\n");
fprintf(file, " * \n");
fprintf(file, " * This software is distributed in the hope that it will be useful, but WITHOUT\n");
fprintf(file, " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n");
fprintf(file, " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n");
fprintf(file, " * for more details.\n");
fprintf(file, " * \n");
fprintf(file, " ******************************************************************************* \n");
fprintf(file, " */\n\n");
}
char endTable[256000] = "";
FILE *ofile=NULL;
FILE *ofileH=NULL;
void process(const char *ifname)
{
printf(" Import File : \"%s\"\n", ifname);
FILE *ifile=NULL;
ifile = fopen(ifname, "rb");
if (ifile == NULL)
{
fprintf(stderr, "cannot open %s for reading\n", ifname);
exit(1);
}
char buf[PATH_MAX], *p;
const char *cp;
if ((cp = strrchr(ifname, '/')) != NULL)
{
++cp;
} else {
if ((cp = strrchr(ifname, '\\')) != NULL)
++cp;
else
cp = ifname;
}
strcpy(buf, cp);
for (p = buf; *p != '\0'; ++p)
{
if (!isalnum(*p))
*p = '_';
}
fprintf(ofile, "unsigned char %s[] = {", buf);
int n = 0;
unsigned char c = 0;
while(fread(&c, 1, 1, ifile) == 1)
{
if(n%100 == 0) {
fprintf(ofile, "\n\t\t");
}
fprintf(ofile, "0x%02x,", c);
n++;
}
fprintf(ofile, "\n\t\t0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00");
fprintf(ofile, "\n};\n");
//fprintf(ofileH, "extern unsigned char %s[];\n", buf);
//fprintf(ofileH, "extern unsigned long int %s_size;\n", buf);
char tmpVar[4096];
sprintf(tmpVar, " {\"%s\", %d , %s},\n", ifname, n, buf);
strcat (endTable, tmpVar);
fclose(ifile);
}
void usage(void)
{
fprintf(stderr, "usage: pngToCpp <output_file>.xxx <input_file>\n");
exit(1);
}
int main(int argc, char **argv)
{
//zeroTerminated = true;
if (argc < 3) {
usage();
}
// dynamic output name :
char tmpOutput[PATH_MAX*2] = "";
strcpy(tmpOutput, argv[1]);
int32_t sizeName = strlen(tmpOutput);
if (6>=sizeName) {
usage();
}
if (tmpOutput[sizeName-1] == '.') {
tmpOutput[sizeName-1] = '\0';
} else if (tmpOutput[sizeName-2] == '.') {
tmpOutput[sizeName-2] = '\0';
} else if (tmpOutput[sizeName-3] == '.') {
tmpOutput[sizeName-3] = '\0';
} else if (tmpOutput[sizeName-4] == '.') {
tmpOutput[sizeName-4] = '\0';
} else if (tmpOutput[sizeName-5] == '.') {
tmpOutput[sizeName-5] = '\0';
} else if (tmpOutput[sizeName-6] == '.') {
tmpOutput[sizeName-6] = '\0';
}
//fprintf(stderr, "writing to %s\n", tmpOutput);
char tmpOutputCPP[PATH_MAX*2] = "";
char tmpOutputH[PATH_MAX*2] = "";
// Generate the output filename
sprintf(tmpOutputCPP,"%s.cpp", tmpOutput);
sprintf(tmpOutputH,"%s.h", tmpOutput);
// open destination name :
ofile = fopen(tmpOutputCPP, "wb");
if (ofile == NULL)
{
fprintf(stderr, "cannot open %s for writing\n", tmpOutputCPP);
exit(1);
}
generateHeader(ofile);
ofileH = fopen(tmpOutputH, "wb");
if (ofileH == NULL)
{
fprintf(stderr, "cannot open %s for writing\n", tmpOutputH);
exit(1);
}
generateHeader(ofileH);
fprintf(ofileH, "#ifndef __INPUT_PNG_FILE_GENERATED_H__\n");
fprintf(ofileH, "#define __INPUT_PNG_FILE_GENERATED_H__\n\n");
fprintf(ofileH, "extern \"C\" {\n");
fprintf(ofileH, " typedef struct {\n");
fprintf(ofileH, " char filename[1024];\n");
fprintf(ofileH, " long int fileLenght;\n");
fprintf(ofileH, " unsigned char * data;\n");
fprintf(ofileH, " } internalData_ts;\n\n\n");
// Generate the output
int32_t i;
for(i=2; i<argc; i++) {
process(argv[i]);
}
// set the pointer on the table
fprintf(ofileH, " extern internalData_ts internalDataFiles[];\n");
// set the number of files
fprintf(ofileH, " extern long int internalDataFilesSize;\n");
fprintf(ofileH, "}\n");
fprintf(ofileH, "#endif\n\n");
fprintf(ofile, "#include \"GeneratedData.h\"\n");
fprintf(ofile, "internalData_ts internalDataFiles[] = {\n");
fprintf(ofile, "%s", endTable);
fprintf(ofile, "};\n");
fprintf(ofile, "long int internalDataFilesSize = sizeof(internalDataFiles) / sizeof(internalData_ts);\n");
// Close destination files
fclose(ofile);
fclose(ofileH);
return 0;
}