Skip to content

Commit

Permalink
add Windows VS2017 support
Browse files Browse the repository at this point in the history
- add windows socket libraries
- search for windows name of all dependencies
- add missing link step to the intermediate static library
  • Loading branch information
psychocrypt committed Jun 15, 2017
1 parent ae13163 commit d46e805
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ list(APPEND CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
# https://github.com/fireice-uk/xmr-stak-nvidia/pull/10#issuecomment-290821792
# If you remove this guard to compile with older gcc versions the miner will produce
# a high rate of wrong shares.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
message(FATAL_ERROR "GCC version must be at least 5.1!")
endif()
Expand Down Expand Up @@ -50,7 +50,14 @@ set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})

option(MICROHTTPD_ENABLE "Enable or disable the requirement of microhttp (http deamon)" ON)
if(MICROHTTPD_ENABLE)
find_library(MHTD NAMES microhttpd)
find_library(MHTD
NAMES
microhttpd
libmicrohttpd.lib
PATHS
ENV "MICROHTTPD_ROOT"
PATH_SUFFIXES
lib)
if("${MHTD}" STREQUAL "MHTD-NOTFOUND")
message(FATAL_ERROR "microhttpd NOT found: use `-DMICROHTTPD_ENABLE=OFF` to build without http deamon support")
else()
Expand Down Expand Up @@ -83,13 +90,27 @@ endif()

option(HWLOC_ENABLE "Enable or disable the requirement of hwloc" ON)
if(HWLOC_ENABLE)
find_path(HWLOC_INCLUDE_DIR hwloc.h
$ENV{HWLOC_ROOT}/inlcude
/opt/local/include
/usr/local/include
/usr/include
)
find_library(HWLOC NAMES hwloc)
find_path(HWLOC_INCLUDE_DIR
NAMES
hwloc.h
PATHS
/opt/local
/usr/local
/usr
ENV "PROGRAMFILES(X86)"
ENV "HWLOC_ROOT"
PATH_SUFFIXES
include)

find_library(HWLOC
NAMES
libhwloc.lib
hwloc
PATHS
ENV "HWLOC_ROOT"
PATH_SUFFIXES
lib)

if("${HWLOC}" STREQUAL "MHTD-NOTFOUND" OR ${HWLOC_INCLUDE_DIR} STREQUAL "HWLOC_INCLUDE_DIR-NOTFOUND")
message(FATAL_ERROR "hwloc NOT found: use `-DHWLOC_ENABLE=OFF` to build without hwloc support")
else()
Expand All @@ -100,6 +121,14 @@ else()
add_definitions("-DCONF_NO_HWLOC")
endif()

################################################################################
# Windows Sockets
################################################################################

if(WIN32)
set(LIBS ${LIBS} wsock32 ws2_32)
endif()

################################################################################
# Compile & Link
################################################################################
Expand All @@ -124,6 +153,7 @@ add_library(xmr-stak-c
${SRCFILES_C}
)
set_property(TARGET xmr-stak-c PROPERTY C_STANDARD 99)
target_link_libraries(xmr-stak-c ${LIBS})

add_executable(xmr-stak-cpu
${SRCFILES_CPP}
Expand Down

0 comments on commit d46e805

Please sign in to comment.