- updated cmake file for hal to compile with Visual Studio

pull/72/head
Michael Zillgith 7 years ago
parent de04f3630b
commit e6765585cf

@ -13,6 +13,17 @@ set(LIBHAL_VERSION_MAJOR "2")
set(LIBHAL_VERSION_MINOR "0")
set(LIBHAL_VERSION_PATCH "0")
if(WIN32)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../third_party/winpcap/Lib/wpcap.lib")
message("Found winpcap -> compile ethernet HAL layer (required for GOOSE/SV support)")
set(WITH_WPCAP 1)
else()
message("winpcap not found -> skip ethernet HAL layer (no GOOSE/SV support)")
endif()
endif(WIN32)
include_directories(
${CMAKE_CURRENT_LIST_DIR}/inc
)
@ -29,7 +40,6 @@ set (libhal_linux_SRCS
set (libhal_windows_SRCS
${CMAKE_CURRENT_LIST_DIR}/socket/win32/socket_win32.c
${CMAKE_CURRENT_LIST_DIR}/ethernet/win32/ethernet_win32.c
${CMAKE_CURRENT_LIST_DIR}/thread/win32/thread_win32.c
${CMAKE_CURRENT_LIST_DIR}/filesystem/win32/file_provider_win32.c
${CMAKE_CURRENT_LIST_DIR}/time/win32/time.c
@ -37,6 +47,12 @@ set (libhal_windows_SRCS
${CMAKE_CURRENT_LIST_DIR}/memory/lib_memory.c
)
if(WITH_WPCAP)
set (libhal_windows_SRCS ${libhal_windows_SRCS}
${CMAKE_CURRENT_LIST_DIR}/ethernet/win32/ethernet_win32.c
)
endif(WITH_WPCAP)
set (libhal_bsd_SRCS
${CMAKE_CURRENT_LIST_DIR}/socket/bsd/socket_bsd.c
${CMAKE_CURRENT_LIST_DIR}/ethernet/bsd/ethernet_bsd.c
@ -53,7 +69,10 @@ message("Found winpcap -> can compile with GOOSE support")
set(WITH_WPCAP 1)
endif()
IF(MSVC)
set_source_files_properties(${libhal_windows_SRCS}
PROPERTIES LANGUAGE CXX)
ENDIF()
set (libhal_SRCS
${libhal_windows_SRCS}

@ -24,6 +24,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

@ -326,7 +326,6 @@ bool
Socket_connect(Socket self, const char* address, int port)
{
struct sockaddr_in serverAddress;
int ec;
if (wsaStartUp() == false)
return false;

Loading…
Cancel
Save