diff --git a/CMakeLists.txt b/CMakeLists.txt index b0533f2..d21dc43 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,7 @@ if (WIN32) ) else() # MSVC specific steps - list(APPEND PLATFORM_SPECIFIC_LIBRARIES "delayimp.lib") + list(APPEND PLATFORM_SPECIFIC_LIBRARIES "delayimp.lib" "winmm.lib") # We need to load wpcap add_link_options(/DELAYLOAD:wpcap.dll) @@ -90,6 +90,7 @@ if (WIN32) # We have no GUI anyway! add_definitions(-DNOGDI) + set(BOOST_ROOT "c:/boost" CACHE STRING "Where boost is located") set(PCAP_ROOT_DIR "c:/npcapsdk" CACHE STRING "Where the npcap sdk is located") set(PDCURSES_ROOT_DIR "c:/pdcurses/" CACHE STRING "Where the pdcurses directory is located") diff --git a/Sources/UserInterface/AboutWindow.cpp b/Sources/UserInterface/AboutWindow.cpp index 33643c5..d1c7117 100644 --- a/Sources/UserInterface/AboutWindow.cpp +++ b/Sources/UserInterface/AboutWindow.cpp @@ -1,7 +1,8 @@ /* Copyright (c) 2021 [Rick de Bondt] - AboutWindow.cpp */ - #include "UserInterface/AboutWindow.h" +#include + #include "UserInterface/Button.h" #include "UserInterface/DefaultElements.h" diff --git a/Sources/UserInterface/HUDWindow.cpp b/Sources/UserInterface/HUDWindow.cpp index 6c5bac6..88346b9 100644 --- a/Sources/UserInterface/HUDWindow.cpp +++ b/Sources/UserInterface/HUDWindow.cpp @@ -1,7 +1,8 @@ /* Copyright (c) 2021 [Rick de Bondt] - HUDWindow.cpp */ - #include "UserInterface/HUDWindow.h" +#include + #include "UserInterface/Button.h" #include "UserInterface/CheckBox.h" #include "UserInterface/DefaultElements.h" diff --git a/Sources/WifiInterfaceWindows.cpp b/Sources/WifiInterfaceWindows.cpp index eee3de8..2f08f9c 100644 --- a/Sources/WifiInterfaceWindows.cpp +++ b/Sources/WifiInterfaceWindows.cpp @@ -18,6 +18,12 @@ #define UNICODE #endif +#ifndef _MSC_VER +#define STDCALL __attribute__((stdcall)) +#else +#define STDCALL __stdcall +#endif + // available network flags #define WLAN_AVAILABLE_NETWORK_CONNECTED 0x00000001 // This network is currently connected #define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 0x00000002 // There is a profile for this network @@ -105,7 +111,7 @@ static std::wstring GenerateXML(const std::wstring& aSSID) return lFirst + aSSID + lSecond; } -static void __attribute__((stdcall)) WlanCallback(WLAN_NOTIFICATION_DATA* aScanNotificationData, PVOID aContext) +static void STDCALL WlanCallback(WLAN_NOTIFICATION_DATA* aScanNotificationData, PVOID aContext) { // Get the data from my struct. If it's null, nothing to do auto* lCallbackInfo = static_cast(aContext); diff --git a/cmake/addcompilerandlinkerflags.cmake b/cmake/addcompilerandlinkerflags.cmake index 4fc6b0d..ab6edb5 100644 --- a/cmake/addcompilerandlinkerflags.cmake +++ b/cmake/addcompilerandlinkerflags.cmake @@ -34,6 +34,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") set(CMAKE_CXX_FLAGS_RELEASE "/O2 /MT") set(CMAKE_CXX_FLAGS_DEBUG "/Od /MTd /ZI") set(PROJECT_COMPILE_WARNING_FLAGS /Wall /sdl /WX) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") else() set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") diff --git a/cmake/wrapfindboost.cmake b/cmake/wrapfindboost.cmake index efaed60..cd20349 100644 --- a/cmake/wrapfindboost.cmake +++ b/cmake/wrapfindboost.cmake @@ -22,12 +22,15 @@ # wrapfindboost.cmake - Finds boost under our terms. # Usage: Set Boost_ARCHITECTURE if the default arch is not OK, set BOOST_ROOT as well. - if (BUILD_STATIC) set(Boost_NO_SYSTEM_PATHS ON) set(Boost_USE_STATIC_LIBS ON) endif () +if (MSVC) + set(Boost_USE_STATIC_RUNTIME ON) +endif () + # Needed because otherwise the libraries cannot be found. if (BUILD_X32) set(Boost_ARCHITECTURE "-x32")