forked from BlinkyStitt/vanitygen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add CMakeLists.txt
- Loading branch information
KokaKiwi
committed
Aug 16, 2013
1 parent
cd1a728
commit 2a268b7
Showing
3 changed files
with
193 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
project(vanitygen) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") | ||
|
||
set(DEBUG OFF) | ||
set(USE_OPENCL OFF) | ||
|
||
if (DEBUG) | ||
set(OFLAGS "-ggdb3") | ||
else (DEBUG) | ||
set(OFLAGS "-O4 -march=native") | ||
endif (DEBUG) | ||
|
||
set(CMAKE_C_FLAGS "${OFLAGS} -Wall") | ||
|
||
find_package(Threads REQUIRED) | ||
|
||
set(LIBS | ||
pcre | ||
crypto | ||
m | ||
dl | ||
z | ||
${CMAKE_THREAD_LIBS_INIT} | ||
) | ||
|
||
add_executable(vanitygen | ||
vanitygen.c | ||
pattern.c | ||
util.c | ||
) | ||
target_link_libraries(vanitygen | ||
${LIBS} | ||
) | ||
|
||
add_executable(keyconv | ||
keyconv.c | ||
util.c | ||
) | ||
target_link_libraries(keyconv | ||
${LIBS} | ||
) | ||
|
||
find_package(OpenCL) | ||
if (OPENCL_FOUND AND USE_OPENCL) | ||
include_directories(${OPENCL_INCLUDE_DIRS}) | ||
|
||
add_executable(oclvanitygen | ||
oclvanitygen.c | ||
oclengine.c | ||
pattern.c | ||
util.c | ||
) | ||
target_link_libraries(oclvanitygen | ||
${LIBS} | ||
${OPENCL_LIBRARIES} | ||
) | ||
|
||
add_executable(oclvanityminer | ||
oclvanityminer.c | ||
oclengine.c | ||
pattern.c | ||
util.c | ||
) | ||
target_link_libraries(oclvanityminer | ||
${LIBS} | ||
${OPENCL_LIBRARIES} | ||
curl | ||
) | ||
endif (OPENCL_FOUND AND USE_OPENCL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,41 @@ | ||
LIBS=-lpcre -lcrypto -lm -lpthread | ||
CFLAGS=-ggdb -O3 -Wall | ||
OBJS=vanitygen.o oclvanitygen.o oclvanityminer.o oclengine.o keyconv.o pattern.o util.o | ||
PROGS=vanitygen keyconv oclvanitygen oclvanityminer | ||
CFLAGS := -O4 -march=native -Wall | ||
# CFLAGS := -O3 | ||
|
||
PLATFORM=$(shell uname -s) | ||
SRCS := vanitygen.c \ | ||
oclvanitygen.c \ | ||
oclvanityminer.c \ | ||
oclengine.c \ | ||
keyconv.c \ | ||
pattern.c \ | ||
util.c | ||
OBJS := $(SRCS:.c=.o) | ||
|
||
UTIL_OBJS := pattern.o util.o | ||
|
||
PROGS := vanitygen keyconv oclvanitygen oclvanityminer | ||
|
||
LIBS := -lpcre -lcrypto -lm -lpthread | ||
|
||
PLATFORM = $(shell uname -s) | ||
ifeq ($(PLATFORM),Darwin) | ||
OPENCL_LIBS=-framework OpenCL | ||
OPENCL_LIBS := -framework OpenCL | ||
else | ||
OPENCL_LIBS=-lOpenCL | ||
OPENCL_LIBS := -lOpenCL | ||
endif | ||
|
||
all: $(PROGS) | ||
|
||
most: vanitygen keyconv | ||
|
||
all: $(PROGS) | ||
|
||
vanitygen: vanitygen.o pattern.o util.o | ||
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) | ||
vanitygen: vanitygen.o $(UTIL_OBJS) | ||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
oclvanitygen: oclvanitygen.o oclengine.o pattern.o util.o | ||
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) | ||
keyconv: keyconv.o util.o | ||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) | ||
|
||
oclvanityminer: oclvanityminer.o oclengine.o pattern.o util.o | ||
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) $(OPENCL_LIBS) -lcurl | ||
oclvanitygen: oclvanitygen.o oclengine.o $(UTIL_OBJS) | ||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(OPENCL_LIBS) | ||
|
||
keyconv: keyconv.o util.o | ||
$(CC) $^ -o $@ $(CFLAGS) $(LIBS) | ||
oclvanityminer: oclvanityminer.o oclengine.o $(UTIL_OBJS) | ||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(OPENCL_LIBS) -lcurl | ||
|
||
clean: | ||
rm -f $(OBJS) $(PROGS) $(TESTS) | ||
rm -f $(OBJS) $(PROGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# | ||
# This file taken from FindOpenCL project @ http://gitorious.com/findopencl | ||
# | ||
# - Try to find OpenCL | ||
# This module tries to find an OpenCL implementation on your system. It supports | ||
# AMD / ATI, Apple and NVIDIA implementations, but shoudl work, too. | ||
# | ||
# Once done this will define | ||
# OPENCL_FOUND - system has OpenCL | ||
# OPENCL_INCLUDE_DIRS - the OpenCL include directory | ||
# OPENCL_LIBRARIES - link these to use OpenCL | ||
# | ||
# WIN32 should work, but is untested | ||
|
||
FIND_PACKAGE( PackageHandleStandardArgs ) | ||
|
||
SET (OPENCL_VERSION_STRING "0.1.0") | ||
SET (OPENCL_VERSION_MAJOR 0) | ||
SET (OPENCL_VERSION_MINOR 1) | ||
SET (OPENCL_VERSION_PATCH 0) | ||
|
||
IF (APPLE) | ||
|
||
FIND_LIBRARY(OPENCL_LIBRARIES OpenCL DOC "OpenCL lib for OSX") | ||
FIND_PATH(OPENCL_INCLUDE_DIRS OpenCL/cl.h DOC "Include for OpenCL on OSX") | ||
FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS OpenCL/cl.hpp DOC "Include for OpenCL CPP bindings on OSX") | ||
|
||
ELSE (APPLE) | ||
|
||
IF (WIN32) | ||
|
||
FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h) | ||
FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp) | ||
|
||
# The AMD SDK currently installs both x86 and x86_64 libraries | ||
# This is only a hack to find out architecture | ||
IF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" ) | ||
SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86_64") | ||
SET(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86_64") | ||
ELSE (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") | ||
SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86") | ||
SET(OPENCL_LIB_DIR "$ENV{ATIINTERNALSTREAMSDKROOT}/lib/x86") | ||
ENDIF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" ) | ||
|
||
# find out if the user asked for a 64-bit build, and use the corresponding | ||
# 64 or 32 bit NVIDIA library paths to the search: | ||
STRING(REGEX MATCH "Win64" ISWIN64 ${CMAKE_GENERATOR}) | ||
IF("${ISWIN64}" STREQUAL "Win64") | ||
FIND_LIBRARY(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/x64) | ||
ELSE("${ISWIN64}" STREQUAL "Win64") | ||
FIND_LIBRARY(OPENCL_LIBRARIES OpenCL.lib ${OPENCL_LIB_DIR} $ENV{CUDA_LIB_PATH} $ENV{CUDA_PATH}/lib/Win32) | ||
ENDIF("${ISWIN64}" STREQUAL "Win64") | ||
|
||
GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE) | ||
|
||
# On Win32 search relative to the library | ||
FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include) | ||
FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS "${_OPENCL_INC_CAND}" $ENV{CUDA_INC_PATH} $ENV{CUDA_PATH}/include) | ||
|
||
ELSE (WIN32) | ||
|
||
# Unix style platforms | ||
FIND_LIBRARY(OPENCL_LIBRARIES OpenCL | ||
ENV LD_LIBRARY_PATH | ||
) | ||
|
||
GET_FILENAME_COMPONENT(OPENCL_LIB_DIR ${OPENCL_LIBRARIES} PATH) | ||
GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE) | ||
|
||
# The AMD SDK currently does not place its headers | ||
# in /usr/include, therefore also search relative | ||
# to the library | ||
FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include") | ||
FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include") | ||
|
||
ENDIF (WIN32) | ||
|
||
ENDIF (APPLE) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS( OpenCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS ) | ||
|
||
IF( _OPENCL_CPP_INCLUDE_DIRS ) | ||
SET( OPENCL_HAS_CPP_BINDINGS TRUE ) | ||
LIST( APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS} ) | ||
# This is often the same, so clean up | ||
LIST( REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS ) | ||
ENDIF( _OPENCL_CPP_INCLUDE_DIRS ) | ||
|
||
MARK_AS_ADVANCED( | ||
OPENCL_INCLUDE_DIRS | ||
) |