It's not a huge change. It would help to know how you've set up the
build-environment (e.g., cygwin or mingw with some given version of
Visual Studio, etc.), to save time.
I am currently building ncurses with conan, that is using msys2.
In it, you can read what options I'm passing to configure.
By submitting this script to
CCI, it will also be built for gcc@Linux, clang@Linux, apple-clang@Macos and all relevant MSVC versions on Windows.
So my setup is msys2+VS2017.
This script is fully automated.
For some more interactive building I've compiled the steps this script does:
- On Windows
- Start a msys2 terminal
- Install automake (`pacman -S automake`)
- export some variables:
export CC="/usr/share/automake-1.16/compile cl -nologo"
export CXX="/usr/share/automake-1.16/compile cl -nologo"
export LD="link -nologo"
export LDFLAGS=user32.lib
export NM="dumpbin -symbols"
export STRIP=:
export AR="/usr/share/automake-1.16/ar-lib lib"
export RANLIB=: - Run `cmd.exe` to start a cmd terminal inside msys2 (the path env variable of msys2 will be inherited)
- Run `cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"` to source the paths of VS2017.
(This path will be different for VS2019. I've found it by right clicking on "x64 Native Tools Command Prompt for VS 2017" in my start menu) - cd to your build directory (You are now in a cmd shell)
- Run `sh ../configure`
The first error should be missing `getopt` for building progs.
Running `sh ../configure --without-progs` does not work around this problem.
Since microsoft's compiler supports different arguments as gcc, I needed to wrap it using automake's compile.
Compiling and linking a simple hello world c program in one step can be done as:
cl hello.c /link /out:hello.exe
Skipping the /link /out:hello.exe, would only create a hello.obj file.
In my steps, I've added user32.lib to LDFLAGS, I'm not entirely sure this is needed but at one point some linking error forced me to.
If you happen to have some more questions, do not hesitate to ask me.
there's some special-case used for some platforms, which can be adapted...
Great!