Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile cleanup #222

Merged
merged 5 commits into from
Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/
obj/
build/
xmr-stak-cpu.layout
xmr-stak-cpu.depend
config-debug.txt
Expand Down
19 changes: 17 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})

option(MICROHTTPD_ENABLE "Enable or disable the requirement of microhttp (http deamon)" ON)
if(MICROHTTPD_ENABLE)
find_path(MTHD_INCLUDE_DIR
NAMES
microhttpd.h
PATHS
/opt/local
/usr/local
/usr
ENV "PROGRAMFILES(X86)"
ENV "HWLOC_ROOT"
PATH_SUFFIXES
include)

find_library(MHTD
NAMES
microhttpd
Expand All @@ -62,6 +74,7 @@ if(MICROHTTPD_ENABLE)
message(FATAL_ERROR "microhttpd NOT found: use `-DMICROHTTPD_ENABLE=OFF` to build without http deamon support")
else()
set(LIBS ${LIBS} ${MHTD})
include_directories(AFTER ${MTHD_INCLUDE_DIR})
endif()
else()
add_definitions("-DCONF_NO_HTTPD")
Expand Down Expand Up @@ -134,8 +147,10 @@ endif()
################################################################################

# activate sse2 and aes-ni
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -maes")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -maes")
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -maes")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -maes")
endif()

# activate static libgcc and libstdc++ linking
if(CMAKE_LINK_STATIC)
Expand Down
4 changes: 2 additions & 2 deletions FREEBSDCOMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Install Dependencies

*Note: This guide is tested for FreeBSD 11.0-RELEASE using the 'dev' branch*
*Note: This guide is tested for FreeBSD 11.0-RELEASE*

From the root shell, run the following commands:

Expand All @@ -17,4 +17,4 @@ Type 'y' and hit enter to proceed with installing the packages.

Now you have the binary located at "bin/xmr-stak-cpu". Either move this file to your desired location or run "make install" to install it to your path.

You can edit the prebuilt [config.txt](config.txt) file found in the root of the repository or you can make your own. This file is required to run xmr-stak-cpu.
You can edit the prebuilt [config.txt](config.txt) file found in the root of the repository or you can make your own. This file is required to run xmr-stak-cpu.
38 changes: 38 additions & 0 deletions LINUXCOMPILE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Compile **xmr-stak** for Linux

### GNU Compiler
```
# Ubuntu / Debian
sudo apt-get install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev
cmake .
make install

# Arch
sudo pacman -S base-devel hwloc openssl cmake libmicrohttpd
cmake .
make install

# Fedora
sudo dnf install gcc gcc-c++ hwloc-devel libmicrohttpd-devel openssl-devel cmake
cmake .
make install

# CentOS
sudo yum install centos-release-scl cmake3 hwloc-devel libmicrohttpd-devel openssl-devel
sudo yum install devtoolset-4-gcc*
sudo scl enable devtoolset-4 bash
cmake3 .
make install
```

- g++ version 5.1 or higher is required for full C++11 support. CMake release compile scripts, as well as CodeBlocks build environment for debug builds is included.

### To do a static build for a system without gcc 5.1+
```
cmake -DCMAKE_LINK_STATIC=ON .
make install
```
Note - cmake caches variables, so if you want to do a dynamic build later you need to specify '-DCMAKE_LINK_STATIC=OFF'



38 changes: 4 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,42 +41,12 @@ xXl2Nm/u3cPP/eQVrZz5H8eACwIv+LL1EV+9uLanWUa+IO5hHr3KElvKNKD6vN0=
=vGQV
-----END PGP SIGNATURE-----
```
## Compile for Windows
## Compile guides

- see [WINCOMPILE.md](WINCOMPILE.md)
- [Free BSD](FREEBSDCOMPILE.md)
- [Linux](LINUXCOMPILE.md)
- [Windows](WINCOMPILE.md)

## Compile on Linux

### GNU Compiler
```
# Ubuntu / Debian
sudo apt-get install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev
cmake .

# Fedora
sudo dnf install gcc gcc-c++ hwloc-devel libmicrohttpd-devel openssl-devel cmake
cmake .

# CentOS
sudo yum install centos-release-scl cmake3 hwloc-devel libmicrohttpd-devel openssl-devel
sudo yum install devtoolset-4-gcc*
sudo scl enable devtoolset-4 bash
cmake3 .

make install
```

- g++ version 5.1 or higher is required for full C++11 support. CMake release compile scripts, as well as CodeBlocks build environment for debug builds is included.

### To do a static build for a system without gcc 5.1+
```
cmake -DCMAKE_LINK_STATIC=ON .
make install
```
Note - cmake caches variables, so if you want to do a dynamic build later you need to specify '-DCMAKE_LINK_STATIC=OFF'


You can find a complete compile guide under [Advanced Compile Options](#advanced-compile-options).

#### CPU mining performance

Expand Down
4 changes: 1 addition & 3 deletions httpd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@

#include "webdesign.h"

#include <microhttpd.h>
#ifdef _WIN32
#include "libmicrohttpd/microhttpd.h"
#define strcasecmp _stricmp
#else
#include <microhttpd.h>
#endif // _WIN32

httpd* httpd::oInst = nullptr;
Expand Down
Loading