Skip to content

Comments

Changes for windows compilation (SDL-Only)#10

Open
andychase wants to merge 1 commit intosinamas:masterfrom
andychase:windows-compile-sdl
Open

Changes for windows compilation (SDL-Only)#10
andychase wants to merge 1 commit intosinamas:masterfrom
andychase:windows-compile-sdl

Conversation

@andychase
Copy link

Windows is a special monkey and needs some assistance in compilation. These changes are for the standard VC2015 compilation not through CYGWIN and MINGW which may not need these changes.

This fixes the build for SDL. The QT version might need more changes.

Other version information:

  • Windows 10 SDK
  • x64 Native Compilation (64-bit)
  • VC2015
  • SCONS v2.4.1
  • SDL 1.2.15

Changes implementented:

  • Define -DNOMINMAX
    • This solves issues with Windows.h clobbering the STD::MIN, STD::MAX macros with their own and causing many obscure syntax errors during compilation.
  • Add -SUBSYSTEM:CONSOLE to linker options
  • Remove env.ParseConfig('sdl-config')
    • This utility script isn't available on windows.
    • Replace with the direct path to the libs and headers
    • SDL libs can be downloaded here: https://www.libsdl.org/download-1.2.php (SDL-devel-1.2.15-VC.zip (Visual C++) is needed)
    • Since Windows doesn't have a standard method for detecting header/lib paths, the paths were set manually to "C:\Program Files (x86)\SDL-1.2.15\include", etc.
  • Remove '-Wextra' under windows
    • This isn't defined in the Windows compiler.
    • Note that '-Wall' compilation is very slow. Perhaps consider removing this under windows also.
  • Add #include <algorithm> to cartridge.cpp
    • This adds a few macros needed to compile
  • Move -DHAVE_STDINT_H to the global compiler flags. The previous way of doing this caused linker issues (specifically 3 functions wouldn't link correctly).
  • Add #undef main in gambatte_sdl.cpp

Windows is a special monkey and needs some assistance in compilation. These changes are for the standard VC2015 compilation not through CYGWIN and MINGW which may not need these changes.

This fixes the build for SDL. The QT version might need more changes.

Other version information:

* Windows 10 SDK
* x64 Native Compilation (64-bit)
* VC2015
* SCONS v2.4.1
* SDL 1.2.15

Changes implementented:

* Define `-DNOMINMAX`
	* This solves issues with Windows.h clobbering the STD::MIN, STD::MAX macros with their own and causing many obscure syntax errors during compilation.
* Add `-SUBSYSTEM:CONSOLE` to linker options
	* Fixes error message: `LINK : fatal error LNK1561: entry point must be defined`
	* Source: http://stackoverflow.com/a/28256749
* Remove `env.ParseConfig('sdl-config')`
	* This utility script isn't available on windows.
	* Replace with the direct path to the libs and headers
	* SDL libs can be downloaded here: https://www.libsdl.org/download-1.2.php (SDL-devel-1.2.15-VC.zip (Visual C++) is needed)
	* Since Windows doesn't have a standard method for detecting header/lib paths, the paths were set manually to "C:\Program Files (x86)\SDL-1.2.15\include", etc.
* Remove '-Wextra' under windows
	* This isn't defined in the Windows compiler.
	* Note that '-Wall' compilation is very slow. Perhaps consider removing this under windows also.
* Add `#include <algorithm>` to `cartridge.cpp`
	* This adds a few macros needed to compile
* Move `-DHAVE_STDINT_H` to the global compiler flags. The previous way of doing this caused linker issues (specifically 3 functions wouldn't link correctly).
* Add `#undef main` in `gambatte_sdl.cpp`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant