Building CUnit on Windows

前端 未结 4 1462
南旧
南旧 2020-12-10 20:18

Has anyone managed to build the CUnit library for Windows?

I want to run the same unit tests under Windows that I have currently developed under linux, so I need a w

相关标签:
4条回答
  • 2020-12-10 20:49

    For whatever reason, the source archives don't have the support files for Jam. You can get them from Cunit's SVN repo on SourceForge. You will also need the linker export definition file (libcunit_dll.def)

    I opted to patch the Jamfiles (for all of the subdirectories) back onto the released 2.1-2 tree. It looks like there are a couple breaking changes / unclosed defects in the SVN trunk.

    Once you have the files:

    export MINGW=gcc
    export JAM_TOOLSET=MINGW
    jam.exe -f Jambase libcunit
    

    will build a proper Windows dll.

    0 讨论(0)
  • 2020-12-10 20:53

    Anyone interested in building CUnit using Eclipse? I tried and can build it successfully!

    [Note]

    • I used CUnit-2.1-2, CUnit-2.1-3 package lacks header file "Cunit.h".
    • Some compilers do not support "curse", so I don't build it.
    • I do not use the makefile in the CUnit package, too.

    [Howto]

    1. Create a static-library-C-project in Eclipse using Cygwin or Mingw compiler.
    2. Copy all .h files in CUnit\Headers except Curses.h into your new project then include the folder into build
    3. Copy all .c files in CUnit\Sources\Framework into your project
    4. Copy Automated.c, Basic.c, Console.c into your project
    5. Build the project, you will get the libCUnitLib.a in Archieves folder.
    0 讨论(0)
  • 2020-12-10 20:56

    The answer above is wrong. The correct answer is as follows:

    libtoolize
    
    automake --add-missing 
    
    autoreconf
    
    ./configure --prefix=/mingw
    
    make
    
    make install
    
    0 讨论(0)
  • 2020-12-10 20:58

    nailed it with the following (already had MinGw and MSYS installed)

    mkdir c:/tmp
    cd CUnit-2.1-2
    bash ./configure --prefix=c:/tmp
    make
    make install
    

    but i only get libcunit.a not libcunit.dll

    i noticed that when i originally built under linux i got a libcunit.so

    so looks like only static linking but i think i can live with that

    0 讨论(0)
提交回复
热议问题