diff --git a/CMakeLists.txt b/CMakeLists.txt index 876d68d..2391a0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() @@ -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() @@ -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() @@ -100,6 +121,14 @@ else() add_definitions("-DCONF_NO_HWLOC") endif() +################################################################################ +# Windows Sockets +################################################################################ + +if(WIN32) + set(LIBS ${LIBS} wsock32 ws2_32) +endif() + ################################################################################ # Compile & Link ################################################################################ @@ -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}