Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for windows compilation (SDL-Only) #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Changes for windows compilation (SDL-Only) #10

wants to merge 1 commit into from

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