Tencent / mars

Mars is a cross-platform network component developed by WeChat.
Other
17.27k stars 3.63k forks source link

how to compile with vs2017? #700

Open FarAwayI opened 4 years ago

FarAwayI commented 4 years ago

for windows platform, i modify build_windows.py: change visual studio 2015 to vs2107 and 140 to 150,but still failed? can you help me,thanks.

FatsharkGo commented 4 years ago

I build mars on VS2017 with the following steps:

  1. Modify the solution generation tool mars/build_windows.py:

    WIN_BUILD_CMD = 'cmake ../.. -G "Visual Studio 15 2017" && cmake --build . --target install --config %s'
    WIN_GEN_PROJECT_CMD = 'cmake ../.. -G "Visual Studio 15 2017"'
  2. Porting the thread lib in vs2015 to vs2017: a. Copy the lib thread from vs2015; b. Add the following definetions befor the line "_C_LIB_DECL" in file thr/xthreads.h;

    #define _C_LIB_DECL        extern "C" {    /* C has extern "C" linkage */
    #define _END_C_LIB_DECL    }  

    c. Backup the thread lib in vs2017:

    mv %VS2017_HOME%\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\thr %VS2017_HOME%\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\thr2017

    d. Deploy the thread lib into vs2017

  3. Edit the file mars/comm/windows/unistd.c as follows:

    #include <thr/xtimec.h>
  4. Enjoy!