SUBDIRS(cmake)
SUBDIRS(src)
+SUBDIRS(appli)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/src)
--- /dev/null
+SUBDIRS(creaNewProject)
+IF(WIN32)
+ SUBDIRS(creaSed)
+ENDIF(WIN32)
--- /dev/null
+# Installs creaNewProject.bat/.sh
+# used to creates the file architecture for a new project
+# and configures/installs the empty project structure used by creaNewProject
+
+SET(INPUT_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NewProject)
+FILE(GLOB_RECURSE NAMES RELATIVE ${INPUT_PROJECT_DIR} *.txt *.in *.cmake )
+
+IF(WIN32)
+
+
+ # Build tree
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/creaNewProject.bat.in
+ ${EXECUTABLE_OUTPUT_PATH}/Debug/creaNewProject.bat
+ @ONLY IMMEDIATE
+ )
+ CREA_MKDIR(${EXECUTABLE_OUTPUT_PATH}/Debug/creaNewProject_data)
+ FOREACH( NAME ${NAMES} )
+ STRING(SUBSTRING ${NAME} 0 3 subStrTmp )
+ MESSAGE(ERROR ${subStrTmp})
+ IF( NOT ${subStrTmp} STREQUAL "../" )
+ CONFIGURE_FILE(${INPUT_PROJECT_DIR}/${NAME}
+ ${EXECUTABLE_OUTPUT_PATH}/Debug/creaNewProject_data/${NAME}
+ COPYONLY
+ )
+ ENDIF( NOT ${subStrTmp} STREQUAL "../" )
+ ENDFOREACH(NAME)
+
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/creaNewProject.bat.in
+ ${EXECUTABLE_OUTPUT_PATH}/Release/creaNewProject.bat
+ @ONLY IMMEDIATE
+ )
+ CREA_MKDIR(${EXECUTABLE_OUTPUT_PATH}/Release/creaNewProject_data)
+ FOREACH( NAME ${NAMES})
+ STRING(SUBSTRING ${NAME} 0 3 subStrTmp )
+ IF( NOT ${subStrTmp} STREQUAL "../" )
+ CONFIGURE_FILE(${INPUT_PROJECT_DIR}/${NAME}
+ ${EXECUTABLE_OUTPUT_PATH}/Release/creaNewProject_data/${NAME}
+ COPYONLY )
+ ENDIF( NOT ${subStrTmp} STREQUAL "../" )
+ ENDFOREACH(NAME)
+
+
+ # install tree
+ INSTALL(
+ PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/Debug/creaNewProject.bat
+ DESTINATION bin
+ )
+ INSTALL(
+ DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Debug/creaNewProject_data
+ DESTINATION bin
+ )
+
+ELSE(WIN32)
+
+
+
+ # Build tree
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/creaNewProject.sh.in
+ ${EXECUTABLE_OUTPUT_PATH}/creaNewProject
+ @ONLY IMMEDIATE
+ )
+ CREA_MKDIR(${EXECUTABLE_OUTPUT_PATH}/creaNewProject_data)
+ FOREACH( NAME ${NAMES})
+ STRING(SUBSTRING ${NAME} 0 3 subStrTmp )
+ IF( NOT ${subStrTmp} STREQUAL "../" )
+ CONFIGURE_FILE(${INPUT_PROJECT_DIR}/${NAME}
+ ${EXECUTABLE_OUTPUT_PATH}/creaNewProject_data/${NAME}
+ COPYONLY )
+ ENDIF( NOT ${subStrTmp} STREQUAL "../" )
+ ENDFOREACH(NAME)
+
+ # Install tree
+ INSTALL(
+ FILES ${EXECUTABLE_OUTPUT_PATH}/creaNewProject
+ DESTINATION bin
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ )
+ INSTALL(
+ DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/creaNewProject_data
+ DESTINATION bin
+ )
+
+ENDIF(WIN32)
+
+
+
+
--- /dev/null
+PROJECT(PROJECT_NAME)
--- /dev/null
+@echo off
+
+rem echo creates the file architecture for a new project
+
+
+if %0%1==%0 goto ERROR01
+
+
+rem creaNewProject path
+set BINPATH=%~dp0
+rem Input data path
+set INPUT="%BINPATH%\creaNewProject_data"
+
+set OUTPUT=%1
+set PROJECT=%2
+
+
+rem echo output = %OUTPUT%
+rem echo bin = %BINPATH%
+rem echo input = %INPUT%
+rem echo project= %PROJECT%
+
+IF EXIST %OUTPUT%\%PROJECT% GOTO ERROR02
+
+echo "** Creating new project '%PROJECT%' in folder '%OUTPUT%'"
+
+mkdir %OUTPUT%\%PROJECT%
+xcopy %INPUT% %OUTPUT%\%PROJECT% /S
+"%BINPATH%\creaSed" %OUTPUT%\%PROJECT%\CMakeLists.txt.in PROJECT_NAME "%PROJECT%" > %OUTPUT%\%PROJECT%\CMakeLists.txt
+del "%OUTPUT%\%PROJECT%\CMakeLists.txt.in"
+
+echo "Done !"
+echo "Edit the file '%OUTPUT%\%PROJECT%\CMakeLists.txt' to customize your project"
+
+
+
+goto END
+
+
+:ERROR01
+echo creaNewProject.bat "<project-path> <project-name>"
+goto END
+
+:ERROR02
+echo "ERROR : Directory '%OUTPUT%/%PROJECT%' already exists !"
+goto end
+
+
+
+:END
+
--- /dev/null
+#!/bin/bash
+# creates the file architecture for a new project
+
+if [ $# -lt 2 ]
+ then
+ echo "usage : creaNewProject <project-path> <project-name>"
+ exit
+fi
+
+# creaNewProject path
+TMP=$(which $0|rev)
+BINPATH=$(echo ${TMP#*/}|rev)
+# Input data path
+INPUT=${BINPATH}/creaNewProject_data
+
+OUTPUT=$1
+PROJECT=$2
+
+#echo "output = " $OUTPUT
+#echo "bin = " $BINPATH
+#echo "input = " $INPUT
+#echo "project= " $PROJECT
+
+if [ -d $OUTPUT/${PROJECT} ]
+ then
+ echo "ERROR : Directory '$OUTPUT/${PROJECT}' already exists !"
+ exit
+fi
+
+echo "** Creating new project '$PROJECT' in folder '$OUTPUT'"
+
+if [ ! -d $OUTPUT ]
+ then
+ echo "ERROR : Directory '$OUTPUT' does not exist !"
+ exit
+fi
+
+cp -R ${INPUT} "$OUTPUT/$PROJECT"
+cd $OUTPUT/$PROJECT
+
+cat CMakeLists.txt.in | sed s,PROJECT_NAME,"${PROJECT}", > CMakeLists.txt
+rm CMakeLists.txt.in
+
+echo "Done !"
+echo "Edit the file '$OUTPUT/${PROJECT}/CMakeLists.txt' to customize your project"
--- /dev/null
+ADD_EXECUTABLE(creaSed creaSed)
+INSTALL(PROGRAMS creaSed DESTINATION bin)
--- /dev/null
+
+#include <stdio.h>
+#include <stdio.h>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+
+
+
+ void replace( std::string& str,
+ const std::string& from,
+ const std::string& to )
+ {
+ using std::string;
+ string::size_type pos = str.find( from );
+ while ( pos != string::npos )
+ {
+ str.replace( pos, from.size(), to );
+ pos = str.find( from, pos+from.size()-1 );
+ }
+ }
+
+
+
+
+//==========================================================================
+int main(int argc, char **argv)
+{
+
+ if (argc!=4)
+ {
+ std::cerr << "usage : "<< argv[0] <<" fileIn \"FindString\" \"ReplaceString\"" << std::endl;
+ return 1;
+ }
+
+ FILE *ffIn;
+ std::string fileIn;
+ std::string fileOut;
+ std::string findstring;
+ std::string replacestring;
+ std::string lineStr;
+ char strTmp[255];
+
+ fileIn = argv[1];
+ findstring = argv[2];
+ replacestring = argv[3];
+
+ ffIn = fopen(fileIn.c_str(),"r");
+ if (ffIn){
+ while(!feof(ffIn)){
+ fgets( strTmp , 255, ffIn );
+ lineStr=strTmp;
+ if( feof(ffIn) && (lineStr.length()==1) ) {
+ } else {
+ replace( lineStr,findstring, replacestring );
+ std::cout << lineStr;
+ }
+ }
+ fclose(ffIn);
+ } else {
+ std::cerr << "ERROR. File : "<< argv[1] <<" Not exists." << std::endl;
+ return 1;
+ }
+
+
+ return 0;
+}
+//==========================================================================
+
+