added static runtim for msvc
@@ -7,13 +7,29 @@ if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
+if(MSVC)
+
+ # use static runtime
+ foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
+
+ if(${flag_var} MATCHES "/MD")
+ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MD")
+ endforeach(flag_var)
+
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /O2")
+else()
+
set(CMAKE_C_STANDARD 99)
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
+ if(CMAKE_BUILD_TYPE MATCHES "Debug")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb3")
+ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
endif()
-set(CMAKE_CXX_FLAGS_RELEASE "-O3")
+endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@@ -334,7 +350,10 @@ if(APPLE)
endif()
if(WIN32)
- add_executable(tic80 WIN32 ${TIC80_SRC} build/windows/tic/tic80.rc)
+ # TODO: uncomment this (temporary disabled for VS2017)
+ # set(TIC80_SRC ${TIC80_SRC} build/windows/tic/tic80.rc)
+
+ add_executable(tic80 WIN32 ${TIC80_SRC})
else()
add_executable(tic80 ${TIC80_SRC})
endif()
