diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index fae4af92d..1ca01bd99 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -41,7 +41,7 @@ IF(EXTERNAL_PATH) ELSE(TARGET_X64) SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin") ENDIF(TARGET_X64) - + # Using 32 or 64 bits libraries IF(TARGET_X64) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 30e507f85..25903be14 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -33,6 +33,12 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h ${WINSDKCURRENT_DIR}/Include ) +FIND_PROGRAM(WINSDK_SIGNTOOL signtool + PATHS + ${WINSDK71_DIR}/Bin + ${WINSDKCURRENT_DIR}/Bin +) + IF(WINSDK_INCLUDE_DIR) SET(WINSDK_FOUND TRUE) ELSE(WINSDK_INCLUDE_DIR) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 14a78d721..1524ebf46 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -37,9 +37,7 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### MACRO(NL_DEFAULT_PROPS name label) - IF(NOT MSVC10) - SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label}) - ENDIF(NOT MSVC10) + SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label}) GET_TARGET_PROPERTY(type ${name} TYPE) IF(${type} STREQUAL SHARED_LIBRARY) # Set versions only if target is a shared library @@ -49,6 +47,15 @@ MACRO(NL_DEFAULT_PROPS name label) SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX}) ENDIF(NL_LIB_PREFIX) ENDIF(${type} STREQUAL SHARED_LIBRARY) + + IF(${type} STREQUAL EXECUTABLE AND WIN32) + SET_TARGET_PROPERTIES(${name} PROPERTIES + VERSION ${NL_VERSION} + SOVERSION ${NL_VERSION_MAJOR} + COMPILE_FLAGS "/GA" + LINK_FLAGS "/VERSION:${NL_VERSION}") + ENDIF(${type} STREQUAL EXECUTABLE AND WIN32) + IF(WITH_STLPORT AND WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") ENDIF(WITH_STLPORT AND WIN32) @@ -308,25 +315,32 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) # ADD_DEFINITIONS(-DHAVE_IA64) # ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") - + IF(WIN32) IF(MSVC10) # /Ox is working with VC++ 2010, but custom optimizations don't exist SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") # without inlining it's unusable, use custom optimizations again SET(MIN_OPTIMIZATIONS "/Od /Ob1") - ELSE(MSVC10) + ELSEIF(MSVC90) # don't use a /O[012x] flag if you want custom optimizations SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") # without inlining it's unusable, use custom optimizations again SET(MIN_OPTIMIZATIONS "/Ob1") + ELSEIF(MSVC80) + # don't use a /O[012x] flag if you want custom optimizations + SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") + # without inlining it's unusable, use custom optimizations again + SET(MIN_OPTIMIZATIONS "/Od /Ob1") + ELSE(MSVC10) + MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") ENDIF(MSVC10) - SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") # Common link flags SET(PLATFORM_LINKFLAGS "-DEBUG") - + IF(TARGET_X64) # Fix a bug with Intellisense SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64") @@ -504,6 +518,10 @@ MACRO(SETUP_EXTERNAL) INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) IF(MSVC10) + IF(NOT MSVC10_REDIST_DIR) + # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC10_REDIST_DIR) GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE) # VC_ROOT_DIR is set to "registry" when a key is not found IF(VC_ROOT_DIR MATCHES "registry") diff --git a/code/snowballs2/client/src/snowballs_client.cpp b/code/snowballs2/client/src/snowballs_client.cpp index 3aa4d5540..bde24ac83 100644 --- a/code/snowballs2/client/src/snowballs_client.cpp +++ b/code/snowballs2/client/src/snowballs_client.cpp @@ -70,6 +70,10 @@ #include "internationalization.h" #include "game_time.h" +#ifdef NL_OS_WINDOWS +#include +#endif + using namespace std; using namespace NLMISC; using namespace NL3D; @@ -602,7 +606,7 @@ void loopLogin() string LSHost(ConfigFile->getVar("LSHost").asString()); Login = ConfigFile->getVar("Login").asString(); string Password = ConfigFile->getVar("Password").asString(); - CHashKeyMD5 hk = getMD5((uint8 *)Password.c_str(), Password.size()); + CHashKeyMD5 hk = getMD5((uint8 *)Password.c_str(), (uint32)Password.size()); string CPassword = hk.toString(); nlinfo("The crypted password is %s", CPassword.c_str()); string Application = ConfigFile->getVar("ClientApplication").asString(); @@ -1073,8 +1077,8 @@ sint main(int argc, char **argv) // extract the 2 first param (argv[1] and argv[2]) it must be cookie and addr string cmd = cmdline; - int pos1 = cmd.find_first_not_of (' '); - int pos2; + string::size_type pos1 = cmd.find_first_not_of (' '); + string::size_type pos2; if (pos1 != string::npos) { pos2 = cmd.find (' ', pos1); diff --git a/code/snowballs2/server/chat/src/main.cpp b/code/snowballs2/server/chat/src/main.cpp index 9a1a3d057..37f58eb92 100644 --- a/code/snowballs2/server/chat/src/main.cpp +++ b/code/snowballs2/server/chat/src/main.cpp @@ -36,6 +36,9 @@ // We're using the NeL Service framework, and layer 5 #include +#ifdef NL_OS_WINDOWS +#include +#endif using namespace std; using namespace NLMISC; diff --git a/code/snowballs2/server/collision/src/collision_service.cpp b/code/snowballs2/server/collision/src/collision_service.cpp index fc48d02c3..ffde0c725 100644 --- a/code/snowballs2/server/collision/src/collision_service.cpp +++ b/code/snowballs2/server/collision/src/collision_service.cpp @@ -17,6 +17,10 @@ #include "collision_service.h" #include +#ifdef NL_OS_WINDOWS +#include +#endif + using namespace SBSERVICE; using namespace NLMISC; using namespace NLNET; diff --git a/code/snowballs2/server/frontend/src/CMakeLists.txt b/code/snowballs2/server/frontend/src/CMakeLists.txt index 086ecfcd1..d24c6743e 100644 --- a/code/snowballs2/server/frontend/src/CMakeLists.txt +++ b/code/snowballs2/server/frontend/src/CMakeLists.txt @@ -1,6 +1,6 @@ FILE(GLOB SRC *.cpp *.h) -ADD_EXECUTABLE(snowballs_frontend_service ${SRC}) +ADD_EXECUTABLE(snowballs_frontend_service WIN32 ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) diff --git a/code/snowballs2/server/frontend/src/main.cpp b/code/snowballs2/server/frontend/src/main.cpp index ff036fe51..74ccdc50f 100644 --- a/code/snowballs2/server/frontend/src/main.cpp +++ b/code/snowballs2/server/frontend/src/main.cpp @@ -38,6 +38,10 @@ #include #include +#ifdef NL_OS_WINDOWS +#include +#endif + using namespace NLMISC; using namespace NLNET; using namespace std; diff --git a/code/snowballs2/server/position/src/main.cpp b/code/snowballs2/server/position/src/main.cpp index b908d1e73..44a94d560 100644 --- a/code/snowballs2/server/position/src/main.cpp +++ b/code/snowballs2/server/position/src/main.cpp @@ -41,6 +41,9 @@ #include "physics.h" +#ifdef NL_OS_WINDOWS +#include +#endif using namespace NLMISC; using namespace NLNET;