building on MSVC

This commit is contained in:
Daniel Prilik 2017-10-26 10:29:37 -07:00
parent 911d36f23f
commit a4519a76db
3 changed files with 13 additions and 2 deletions

View file

@ -12,7 +12,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -std=c++11 -Wno-gnu-zero-variadic-macro-arguments")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
@ -20,6 +20,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
endif()
endif()
# since there is no standard install directory for sdl2 on windows, change this
# variable to suit your needs
set(SDL2_MORE_INCLUDE_DIR "C:/sdl2")
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR})

View file

@ -1,3 +1,5 @@
# Slighlty modified by Daniel Prilik
#
# Locate SDL2 library
# This module defines
# SDL2_LIBRARY, the name of the library to link against
@ -118,6 +120,7 @@ FIND_PATH(SDL2_INCLUDE_DIR SDL.h
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
${SDL2_MORE_INCLUDE_DIR}
)
# Lookup the 64 bit libs on x64
@ -133,6 +136,7 @@ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
/opt/local
/opt/csw
/opt
${SDL2_MORE_INCLUDE_DIR}
)
# On 32bit build find the 32bit libs
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -147,6 +151,7 @@ ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
/opt/local
/opt/csw
/opt
${SDL2_MORE_INCLUDE_DIR}
)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -170,6 +175,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
/opt/local
/opt/csw
/opt
${SDL2_MORE_INCLUDE_DIR}
)
# On 32bit build find the 32bit libs
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -185,6 +191,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
/opt/local
/opt/csw
/opt
${SDL2_MORE_INCLUDE_DIR}
)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")

View file

@ -7,7 +7,7 @@
#include <SDL.h>
int main(int argc, const char* argv[]) {
int main(int argc, char* argv[]) {
// Parse args
if (argc < 2) {
std::cerr << "usage: anese [.nes]\n";