diff options
author | Siddhesh Wani | 2017-05-04 16:15:18 +0530 |
---|---|---|
committer | Siddhesh Wani | 2017-05-04 16:15:18 +0530 |
commit | e36eac94dd517bb69d3e5782516ee58942451991 (patch) | |
tree | 54347eba02cd5287ac5884ab84a5ca0c99f33edb /macros/CCodeGeneration | |
parent | c7e9597db39140c1d982f796a8e1f03bb54e7905 (diff) | |
download | Scilab2C_fossee_old-e36eac94dd517bb69d3e5782516ee58942451991.tar.gz Scilab2C_fossee_old-e36eac94dd517bb69d3e5782516ee58942451991.tar.bz2 Scilab2C_fossee_old-e36eac94dd517bb69d3e5782516ee58942451991.zip |
Basic functions and image processing working with MSVC on windows x64
Diffstat (limited to 'macros/CCodeGeneration')
-rw-r--r-- | macros/CCodeGeneration/C_GenerateMakefile.sci | 37 | ||||
-rw-r--r-- | macros/CCodeGeneration/C_GenerateMakefile_msvc.sci | 57 | ||||
-rw-r--r-- | macros/CCodeGeneration/lib | bin | 0 -> 1020 bytes | |||
-rw-r--r-- | macros/CCodeGeneration/names | 23 |
4 files changed, 65 insertions, 52 deletions
diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci index 07891c5..7dfb4da 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.sci +++ b/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -71,31 +71,20 @@ else PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('CXXFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('LDFLAGS = -llapack -lrefblas -lgfortran -lwiringPi',FileInfo.MakefileFilename,'file','y','y'); - if(SharedInfo.OpenCVUsed == %T) - PrintStringInfo('LDFLAGS += -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_gpu',FileInfo.MakefileFilename,'file','y','y'); - PrintStringInfo('LDFLAGS += -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree',FileInfo.MakefileFilename,'file','y','y'); - PrintStringInfo('LDFLAGS += -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres',FileInfo.MakefileFilename,'file','y','y'); - PrintStringInfo('LDFLAGS += -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_core -lrt -lpthread -lm -ldl', FileInfo.MakefileFilename,'file','y','y'); - PrintStringInfo('LDFLAGS += -lIlmImf -ljpeg -ljasper -ltiff -lpng -lzlib -lstdc++',FileInfo.MakefileFilename,'file','y','y'); - end else PrintStringInfo('CC = gcc',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('CXX = g++',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('CXXFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('LDFLAGS = -lblas -llapack -lm ',FileInfo.MakefileFilename,'file','y','y'); - if(SharedInfo.OpenCVUsed == %T) - //PrintStringInfo('LDFLAGS += `pkg-config --libs opencv`',FileInfo.MakefileFilename,'file','y','y'); - //PrintStringInfo('CFLAGS += `pkg-config --cflags opencv`',FileInfo.MakefileFilename,'file','y','y'); - //PrintStringInfo('CXXFLAGS += `pkg-config --cflags opencv`',FileInfo.MakefileFilename,'file','y','y'); + end + if(SharedInfo.OpenCVUsed == %T) PrintStringInfo('LDFLAGS += -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_gpu',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('LDFLAGS += -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('LDFLAGS += -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('LDFLAGS += -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_core -lrt -lpthread -lm -ldl', FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('LDFLAGS += -lIlmImf -ljpeg -ljasper -ltiff -lpng -lzlib -lstdc++',FileInfo.MakefileFilename,'file','y','y'); - end - end - + end end //If ode function is used, add libgsl. if(size(SharedInfo.Includelist) <> 0) @@ -110,28 +99,8 @@ PrintStringInfo('EXEFILE = $(SCI2CDIR)/$(EXEFILENAME)', FileInfo.MakefileFilenam // Sources //Check the output format selected and insert files according to it -target = SharedInfo.Target; PrintStringInfo('SRC = $(wildcard $(CSRCDIR)/*.c)', FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('SRCC = $(wildcard $(CSRCDIR)/*.cpp)', FileInfo.MakefileFilename,'file','y','y'); -// allSources = getAllSources(SharedInfo); -// nbSources = size(allSources); - -// for i = 1:(nbSources(1) - 1) -// [tmppath,tmpfile,tmpext] = fileparts(allSources(i)); - -// if(~isempty(strstr(allSources(i),'dode'))) -// if(size(SharedInfo.Includelist) <> 0) -// if((mtlb_strcmp(part(SharedInfo.Includelist(1),1:5),'odefn') == %T)) -// PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); -// end -// end -// else -// PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', FileInfo.MakefileFilename,'file','y','y'); -// end -// end - -// [tmppath,tmpfile,tmpext] = fileparts(allSources(nbSources(1))); -// PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext, FileInfo.MakefileFilename,'file','y','y'); // Objects PrintStringInfo('OBJ = $(SRC:.c=.o)', FileInfo.MakefileFilename,'file','y','y'); diff --git a/macros/CCodeGeneration/C_GenerateMakefile_msvc.sci b/macros/CCodeGeneration/C_GenerateMakefile_msvc.sci index b49a2c3..00ffb63 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile_msvc.sci +++ b/macros/CCodeGeneration/C_GenerateMakefile_msvc.sci @@ -24,6 +24,8 @@ MakefileFilename = FileInfo.MakefileFilename + '.mak'; PrintStepInfo('Generating Builder '+MakefileFilename,... FileInfo.GeneralReport,'both'); +target = SharedInfo.Target; + PrintStringInfo('# SCI2C Makefile (Visual Studio 2008)',MakefileFilename,'file','y','y'); PrintStringInfo('# hArtes EU Project.',MakefileFilename,'file','y','y'); PrintStringInfo('# Authors: PoliBa & Inria & DIGITEO',MakefileFilename,'file','y','y'); @@ -35,37 +37,54 @@ PrintStringInfo('# --- DIRECTORIES AND FILES ---',MakefileFilename,'file','y','y makecsrcdir = pathconvert('src/c', %f, %f, 'u'); makehsrcdir = pathconvert('includes', %f, %f, 'u'); makeisrcdir = pathconvert('interfaces', %f, %f, 'u'); +makelibdir = pathconvert('libraries', %f, %f, 'u'); makesci2cdir = FileInfo.CStyleOutCCCodeDir; + PrintStringInfo('CSRCDIR = '+makecsrcdir,MakefileFilename,'file','y','y'); PrintStringInfo('HSRCDIR = '+makehsrcdir,MakefileFilename,'file','y','y'); PrintStringInfo('ISRCDIR = '+makeisrcdir,MakefileFilename,'file','y','y'); PrintStringInfo('SCI2CDIR = .',MakefileFilename,'file','y','y'); PrintStringInfo('DIR_OBJ=Release',MakefileFilename,'file','y','y'); -PrintStringInfo('LAPACK_LIB =$(SCI2CDIR)/external-libs/lapack.lib',MakefileFilename,'file','y','y'); -PrintStringInfo('BLAS_LIB = $(SCI2CDIR)/external-libs/blasplus.lib',MakefileFilename,'file','y','y'); +//PrintStringInfo('LAPACK_LIB =$(SCI2CDIR)/libraries/lapack.lib',MakefileFilename,'file','y','y'); +//PrintStringInfo('BLAS_LIB = $(SCI2CDIR)/libraries/blasplus.lib',MakefileFilename,'file','y','y'); +PrintStringInfo('LIB_PATH = $(SCI2CDIR)/libraries',MakefileFilename,'file','y','y'); +PrintStringInfo('LIBS = lapack.lib blasplus.lib',MakefileFilename,'file','y','y'); +PrintStringInfo('LIBS = $(LIBS) kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib',MakefileFilename,'file','y','y'); PrintStringInfo('CC = cl',MakefileFilename,'file','y','y'); PrintStringInfo('LINKER = link',MakefileFilename,'file','y','y'); PrintStringInfo('LINKER_OPTIMISATION_MODE=/RELEASE ',MakefileFilename,'file','y','y'); -PrintStringInfo('CC__OPTIMISATION_MODE=-Z7 -O2 -MD',MakefileFilename,'file','y','y'); +PrintStringInfo('CC__OPTIMISATION_MODE=-Z7 -O2 -MT',MakefileFilename,'file','y','y'); PrintStringInfo('CC_OPTIONS = $(CC_COMMON) -W3 -Gd $(CC__OPTIMISATION_MODE) /Fo""$(DIR_OBJ)/"" /Fd""$(DIR_OBJ)/"" ',MakefileFilename,'file','y','y'); PrintStringInfo('CFLAGS = $(CC_OPTIONS) -I""$(HSRCDIR)"" -I""$(ISRCDIR)"" /EHsc /TP ',MakefileFilename,'file','y','y'); -PrintStringInfo('EXEFILENAME = mytest',MakefileFilename,'file','y','y'); +PrintStringInfo('EXEFILENAME = '+SharedInfo.SCIMainFunName,MakefileFilename,'file','y','y'); PrintStringInfo('EXEFILE = $(SCI2CDIR)\\$(EXEFILENAME)',MakefileFilename,'file','y','y'); PrintStringInfo('MAIN_SRC = $(SCI2CDIR)/main.c',MakefileFilename,'file','y','y'); -// Sources -PrintStringInfo('SRC = \\', MakefileFilename,'file','y','y'); -allSources = getAllSources(); -nbSources = size(allSources); -for i = 1:(nbSources(1) - 1) - [tmppath,tmpfile,tmpext] = fileparts(allSources(i)); - PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', MakefileFilename,'file','y','y'); +if(SharedInfo.OpenCVUsed == %T) + PrintStringInfo('LIBS = $(LIBS) opencv_calib3d2413.lib opencv_contrib2413.lib opencv_features2d2413.lib',MakefileFilename,'file','y','y'); + PrintStringInfo('LIBS = $(LIBS) opencv_flann2413.lib opencv_gpu2413.lib opencv_highgui2413.lib ',MakefileFilename,'file','y','y'); + PrintStringInfo('LIBS = $(LIBS) opencv_imgproc2413.lib opencv_legacy2413.lib opencv_ml2413.lib opencv_nonfree2413.lib',MakefileFilename,'file','y','y'); + PrintStringInfo('LIBS = $(LIBS) opencv_objdetect2413.lib opencv_ocl2413.lib opencv_photo2413.lib opencv_stitching2413.lib',MakefileFilename,'file','y','y'); + PrintStringInfo('LIBS = $(LIBS) opencv_superres2413.lib opencv_ts2413.lib opencv_video2413.lib opencv_videostab2413.lib opencv_core2413.lib',MakefileFilename,'file','y','y'); + PrintStringInfo('LIBS = $(LIBS) IlmImf.lib libjpeg.lib libjasper.lib libtiff.lib libpng.lib zlib.lib',MakefileFilename,'file','y','y'); end -[tmppath,tmpfile,tmpext] = fileparts(allSources(nbSources(1))); -PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext, MakefileFilename,'file','y','y'); +// Sources +PrintStringInfo('SRC = $(CSRCDIR)/*.c', MakefileFilename,'file','y','y'); +PrintStringInfo('SRCC = $(CSRCDIR)/*.cpp', MakefileFilename,'file','y','y'); + +//PrintStringInfo('SRC = \\', MakefileFilename,'file','y','y'); +//allSources = getAllSources(); +//nbSources = size(allSources); +//for i = 1:(nbSources(1) - 1) +// [tmppath,tmpfile,tmpext] = fileparts(allSources(i)); +// PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext+' \\', MakefileFilename,'file','y','y'); +//end +//[tmppath,tmpfile,tmpext] = fileparts(allSources(nbSources(1))); +//PrintStringInfo(' $(CSRCDIR)/'+tmpfile+tmpext, MakefileFilename,'file','y','y'); PrintStringInfo('OBJ = $(SRC:.c=.obj) $(MAIN_SRC:.c=.obj)',MakefileFilename,'file','y','y'); +PrintStringInfo('OBJC = $(SRCC:.cpp=.o)', MakefileFilename,'file','y','y'); PrintStringInfo('# ---------------',MakefileFilename,'file','y','y'); PrintStringInfo('# --- TARGETS ---',MakefileFilename,'file','y','y'); PrintStringInfo('# ---------------',MakefileFilename,'file','y','y'); @@ -75,12 +94,14 @@ PrintStringInfo('\t@echo ""============================""',MakefileFilename,'fil PrintStringInfo('\t@echo ""Generation of the executable""',MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo ""============================""',MakefileFilename,'file','y','y'); PrintStringInfo('\t-IF NOT EXIST $(DIR_OBJ) mkdir $(DIR_OBJ)',MakefileFilename,'file','y','y'); -PrintStringInfo('\t$(CC) $(CFLAGS) $(SRC) $(MAIN_SRC) /link $(LAPACK_LIB) $(BLAS_LIB) /out:$(EXEFILE).exe',MakefileFilename,'file','y','y'); +PrintStringInfo('\t$(CC) $(CFLAGS) $(SRC) $(SRCC) $(MAIN_SRC) /link /LIBPATH:$(LIB_PATH) $(LIBS) /out:$(EXEFILE).exe',MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); -PrintStringInfo('\t@echo ""==============""',MakefileFilename,'file','y','y'); -PrintStringInfo('\t@echo ""Executing code""',MakefileFilename,'file','y','y'); -PrintStringInfo('\t@echo ""==============""',MakefileFilename,'file','y','y'); -PrintStringInfo('\t$(EXEFILE).exe',MakefileFilename,'file','y','y'); +if(target == "StandAlone") + PrintStringInfo('\t@echo ""==============""',MakefileFilename,'file','y','y'); + PrintStringInfo('\t@echo ""Executing code""',MakefileFilename,'file','y','y'); + PrintStringInfo('\t@echo ""==============""',MakefileFilename,'file','y','y'); + PrintStringInfo('\t$(EXEFILE).exe',MakefileFilename,'file','y','y'); +end PrintStringInfo('clean:',MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo "" ""',MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo ""=============================""',MakefileFilename,'file','y','y'); diff --git a/macros/CCodeGeneration/lib b/macros/CCodeGeneration/lib Binary files differnew file mode 100644 index 0000000..ef0ea49 --- /dev/null +++ b/macros/CCodeGeneration/lib diff --git a/macros/CCodeGeneration/names b/macros/CCodeGeneration/names new file mode 100644 index 0000000..efbb400 --- /dev/null +++ b/macros/CCodeGeneration/names @@ -0,0 +1,23 @@ +C_FinalizeCode +C_ForExpression +C_Funcall +C_GenDeclarations +C_GenerateFunName +C_GenerateLaunchScript +C_GenerateMakefile +C_GenerateMakefile_msvc +C_GenerateSCI2CHeader +C_IfElseBlocks +C_IfExpression +C_IndentBlanks +C_InitHeader +C_MemAllocOutTempVars +C_SCI2CHeader +C_Type +C_WhileExpression +GenCFunDatFiles +GetClsFileName +GetSymbolDimension +GetWhileCondVariable +JoinDeclarAndCcode +Sci2AnnotationFile |