顯示具有 Tools 標籤的文章。 顯示所有文章
顯示具有 Tools 標籤的文章。 顯示所有文章

2012年11月8日 星期四

[CMake] Error: The source "Path1/CMakeLists.txt" does not match the source "Path2/CMakeLists.txt" us ed to generate cache.

Error:

CMake Error: The source "Path1/CMakeLists.txt" does not match the source "Path2/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

Solution:
Delete CMakeCache.txt in the target folder.



2012年10月31日 星期三

[bash] $'\r': command not found


Error:
I got message below when I execute a bash script.
D:/asmbin/gnuasm: line 2: $'\r': command not found
D:/asmbin/gnuasm: line 4: $'\r': command not found

Solution:
It is caused by end of line is Windows style '\n\r'
Unix think the eol should be '\n'
Mac think the eol should be '\r'

The bash is unix environment, so we have to change '\n\r' to 'n'.
I use notepad++ as editor to fix the script.

Reference:
http://stackoverflow.com/questions/11616835/cgywin-r-command-not-found-bashrc-bash-profile
http://chunshucaca.blog.163.com/blog/static/6045100020082317363713/

[bash] MS-DOS style path detected


Error:
I got message below when I execute a bash script.
cygwin warning:
  MS-DOS style path detected: D:/asmbin/gnuasm
  Preferred POSIX equivalent is: /cygdrive/d/asmbin/gnuasm
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

Solution:
To ignore the message, please add "set CYGWIN=nodosfilewarning" in head of script

Reference:
http://blog.csdn.net/liuhongjavaen/article/details/7254077

2012年10月30日 星期二

[.Net] Dumpbin to see the contents of windows library (*.lib)


To view what functions inside lib file, we can open "Visual Studio Command Prompt", and type "Dumpbin /exports [file_path]" to show all functions be implemented.

C:\Program Files\Microsoft Visual Studio 9.0\VC>dumpbin /exports "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\libegl.lib"
Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\libegl.lib

File Type: LIBRARY

     Exports

       ordinal    name

            14    eglBindAPI
            20    eglBindTexImage
             7    eglChooseConfig
            33    eglCopyBuffers
            23    eglCreateContext
            18    eglCreatePbufferFromClientBuffer
            10    eglCreatePbufferSurface
            11    eglCreatePixmapSurface
             9    eglCreateWindowSurface
            24    eglDestroyContext
            12    eglDestroySurface
             8    eglGetConfigAttrib
             6    eglGetConfigs
            26    eglGetCurrentContext
            28    eglGetCurrentDisplay
            27    eglGetCurrentSurface
             2    eglGetDisplay
             1    eglGetError
            34    eglGetProcAddress
             3    eglInitialize
            25    eglMakeCurrent
            15    eglQueryAPI
            29    eglQueryContext
             5    eglQueryString
            13    eglQuerySurface
            21    eglReleaseTexImage
            17    eglReleaseThread
            19    eglSurfaceAttrib
            32    eglSwapBuffers
            22    eglSwapInterval
             4    eglTerminate
            16    eglWaitClient
            30    eglWaitGL
            31    eglWaitNative

  Summary

          C3 .debug$S
          14 .idata$2
          14 .idata$3
           4 .idata$4
           4 .idata$5
           C .idata$6


You also can type "Dumpbin /exports /out:[outFile] [file_path]" to list all functions in text file if functions are too many to show in screen.

Reference:

2012年10月22日 星期一

[CMake] Some settings for VS project file

This is a simple note that showing some statement in CMakeList.txt to configure setting of VS project.

To add Preprocessor Definitions.
add_definitions(-DNOENTRY)










To add Additional Include Directories.

INCLUDE_DIRECTORIES(${VCInstallDir}/include/sys)










To modify Runtime Library.
STRING(REPLACE "/MTd" "/MDd" CMAKE_CXX_FLAGS_DEBUG
${CMAKE_CXX_FLAGS_DEBUG})
STRING(REPLACE "/MT" "/MD" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
STRING(REPLACE "/MT" "/MD" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
STRING(REPLACE "/MT" "/MD" CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL})








To Exclude Build Project from solution.
If project is added by this line add_library(foo EXCLUDE_FROM_ALL foo.c)
Add statement below to exclude project from build.
set_target_properties(foo PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)



2012年10月1日 星期一

[CMake] Re-run cmake with a different source directory.

Problem:
CMake Error: The source "Path1/CMakeLists.txt" does not match the source "Path2/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source
directory.


I got above error message when I execute below cmake command to generate solution for webkit.
cmake -G "Visual Studio 9 2008" -DCMAKE_WINCE_SDK="SDK_Name" -DPORT=WinCE -D3RDPARTY_DIR=Path1 Path2


Solve:
Delete CMakeCache.txt in the folder you executing cmake.









2012年5月2日 星期三

[CLOC] A freeware to get line count of code

Official website:  http://cloc.sourceforge.net/

It is easy to use.
Just download it from official website.
Open command line program and execute it 
C:\> cloc <directory path>
F:\Work\Melco\Source>cloc-1.56 F:\Work\Melco\Source\work_R4.4
  110067 text files.
   94873 unique files.
   62916 files ignored.

http://cloc.sourceforge.net v 1.56  T=7040.0 s (6.3 files/s, 1282.8 lines/s)
---------------------------------------------------------------

Language              files       blank     comment        code

---------------------------------------------------------------

C                      2285      271788      338944     1526777

HTML                  17635      203290       20777     1093148

C++                    4044      190284      185459      925764

C/C++ Header           9196      251235      723200      833570

Python                 3269      124116      180884      580909

Javascript             4629      102041      151691      397103

Bourne Shell            190       27479       30154      200180

PHP                     413       17722       35413       84820

Perl                    470       20386       25871       75488

Objective C++           255       15993       12059       68903

m4                       31        5097         892       44023

XML                     641       11305        7312       35004

IDL                     546        3986           0       33302

CSS                     278        4877        2060       25497

make                    190        4587        3483       22708

Tcl/Tk                   90        2906        7257       19903

Assembly                 36        1493        1584        9347

Java                     99        2026        3234        8317

DTD                      19        2100        2442        7763

Objective C              71        1835        2150        6861

Teamcenter def           35         264         250        5800

Lisp                      4         542         532        3711

yacc                      3         462         142        3690

Expect                   29           9           1        3281

C#                       21         175         213        2547

CMake                     8         182          74        2278

XSLT                     47         133         124        1796

DOS Batch                37          84          93        1639

Ruby                     15         315         249        1320

XSD                       8         165         122         621

Visual Basic              6          70          25         351

Korn Shell                1          39          46         223

Bourne Again Shell        2          25          76         173

vim script                1          36           7         104

MSBuild scripts           2           0          14         103

YAML                      5          20          16          84

NAnt scripts              4           2           0          60

awk                       1           2          26          48

sed                       4           1          10          34

D                         1           3          24          13

ASP.Net                   1           0           0           1

---------------------------------------------------------------

SUM:                  44622     1267075     1736910     6027264

---------------------------------------------------------------

Reference: 
http://blog.miniasp.com/post/2009/08/24/Useful-tool-CLOC-Count-Lines-of-Code.aspx