cmake_minimum_required ( VERSION 3.1.0 FATAL_ERROR )
# Set cmake modules directory
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/external/monero-cpp/external/monero-project/cmake" )
project ( neroshop ) # tested on Ubuntu 20.04 LTS (focal) with gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, manjaro-xfce-21.2.6 (Qonos) with gcc (GCC) 11.2.0
set ( VERSION_MAJOR "0" )
set ( VERSION_MINOR "1" )
set ( VERSION_PATCH "0" )
set ( PROJECT_VERSION ${ VERSION_MAJOR } . ${ VERSION_MINOR } . ${ VERSION_PATCH } )
######################################
if ( WIN32 )
set ( WINDOWS TRUE )
endif ( )
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "Linux" )
set ( LINUX TRUE )
option ( NEROSHOP_CLANG "use clang" OFF ) # clang
option ( NEROSHOP_GCC "use gcc" ON ) # gcc - shipped with Ubuntu by default
set ( CMAKE_C_COMPILER /usr/bin/gcc )
set ( CMAKE_CXX_COMPILER /usr/bin/g++ )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I'/usr/include/postgresql/'" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie" ) # detach
include_directories ( /usr/include/ )
link_directories ( /usr/lib/x86_64-linux-gnu/ ) # Debian/Ubuntu
link_directories ( /usr/lib/ ) # Arch
#link_directories(/usr/lib64/ ) # Fedora
endif ( )
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "Darwin" )
set ( MACOSX TRUE )
endif ( )
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "Android" )
set ( ANDROID TRUE )
endif ( )
######################################
if ( LINUX ) # if user chooses to compile with clang
if ( NEROSHOP_CLANG ) # cmake -DNEROSHOP_CLANG=ON -G"Unix Makefiles"
if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) # check if clang is set as the current compiler
set ( NEROSHOP_GCC OFF )
set ( NEROSHOP_CLANG ON ) # use clang (if not using gcc)
set ( CMAKE_C_COMPILER /usr/bin/clang )
set ( CMAKE_CXX_COMPILER /usr/bin/clang++ )
set ( CMAKE_CXX_FLAGS "-w" ) #-w=ignores all warnings
#set(CMAKE_CXX_FLAGS "-fno-PIE" ) #-fPIE, -fno-PIE, -fPIC, -fno-PIC, -nopie, -no-pie
message ( "using clang" )
include_directories ( /usr/include/ )
link_directories ( /usr/lib/x86_64-linux-gnu/ )
else ( )
message ( WARNING "clang is not set as the default compiler!" )
message ( "using gcc/g++" )
endif ( )
endif ( )
endif ( )
######################################
# use a specific C++ version
set ( CMAKE_CXX_STANDARD 14 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
######################################
######################################
set ( MONERO_PROJECT "${CMAKE_SOURCE_DIR}/external/monero-cpp/external/monero-project" )
set ( MONERO_PROJECT_SRC "${MONERO_PROJECT}/src" )
# header includes
include_directories ( "${MONERO_PROJECT}/contrib/epee/include" )
include_directories ( "${MONERO_PROJECT}/external/" )
include_directories ( "${MONERO_PROJECT}/external/easylogging++" )
include_directories ( "${MONERO_PROJECT}/external/rapidjson/include" )
include_directories ( "${MONERO_PROJECT_SRC}/" )
include_directories ( "${MONERO_PROJECT_SRC}/wallet" )
include_directories ( "${MONERO_PROJECT_SRC}/wallet/api" )
include_directories ( "${MONERO_PROJECT_SRC}/crypto/crypto_ops_builder/include/" )
set ( EXTERNAL_LIBS_DIR ${ CMAKE_SOURCE_DIR } /monero-cpp/external-libs )
message ( STATUS EXTERNAL_LIBS_DIR : ${ EXTERNAL_LIBS_DIR } )
######################################
# Extra libraries
if ( APPLE )
if ( DEPENDS )
list ( APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit -framework AppKit" )
else ( )
find_library ( COREFOUNDATION CoreFoundation )
find_library ( IOKIT IOKit )
find_library ( APPKIT AppKit )
list ( APPEND EXTRA_LIBRARIES ${ IOKIT } )
list ( APPEND EXTRA_LIBRARIES ${ COREFOUNDATION } )
list ( APPEND EXTRA_LIBRARIES ${ APPKIT } )
endif ( )
endif ( )
if ( WIN32 )
list ( APPEND EXTRA_LIBRARIES setupapi )
endif ( )
message ( STATUS EXTRA_LIBRARIES: ${ EXTRA_LIBRARIES } )
######################################
# Protobuf (recent)
include ( FindProtobuf )
find_package ( Protobuf )
message ( STATUS "Protobuf lib: ${Protobuf_LIBRARY}, inc: ${Protobuf_INCLUDE_DIR}, protoc: ${Protobuf_PROTOC_EXECUTABLE}" )
include_directories ( ${ Protobuf_INCLUDE_DIR } )
######################################
# LibUSB (recent)
find_library ( usb_LIBRARY NAMES usb-1.0 libusb usb )
set ( LibUSB_LIBRARIES ${ usb_LIBRARY } )
######################################
# Boost - sudo apt install libboost-dev, sudo apt-get install libboost-all-dev
set ( Boost_NO_BOOST_CMAKE 1 )
set ( Boost_USE_MULTITHREADED ON )
find_package ( Boost 1.58 QUIET REQUIRED COMPONENTS chrono date_time filesystem program_options regex serialization wserialization system thread )
message ( STATUS "Using Boost include dir at ${Boost_INCLUDE_DIR}" )
include_directories ( ${ Boost_INCLUDE_DIR } )
add_definitions ( -DBOOST_BIND_GLOBAL_PLACEHOLDERS ) # to ignore warnings
######################################
# OpenSSL - sudo apt-get install libssl-dev
if ( APPLE AND NOT IOS )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11" )
if ( NOT OPENSSL_ROOT_DIR )
EXECUTE_PROCESS ( COMMAND brew --prefix openssl
O U T P U T _ V A R I A B L E O P E N S S L _ R O O T _ D I R
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
message ( STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}" )
endif ( )
endif ( )
find_package ( OpenSSL REQUIRED )
message ( STATUS "Using OpenSSL include dir at ${OPENSSL_INCLUDE_DIR}" )
include_directories ( ${ OPENSSL_INCLUDE_DIR } )
if ( STATIC AND NOT IOS )
if ( UNIX )
set ( OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS};${CMAKE_THREAD_LIBS_INIT}" )
endif ( )
endif ( )
######################################
# libsodium
include_directories ( external/monero-cpp/external/libsodium/include )
include_directories ( external/monero-cpp/external/libsodium/include/sodium )
find_library ( SODIUM_LIBRARY sodium REQUIRED )
message ( STATUS "Using libsodium library at ${SODIUM_LIBRARY}" )
#[[include_directories(monero-cpp/external/libsodium/include/sodium) # export.h
set ( SODIUM_LIBRARIES monero-cpp/external/libsodium/src/crypto_verify/verify.c ) ] ]
#set(sodium_src /usr/lib/x86_64-linux-gnu/libsodium.so)
######################################
# HIDAPI - https://github.com/libusb/hidapi/releases / sudo apt-get install libhidapi-dev / sudo apt-get install libusb-1.0-0-dev, sudo apt-get install libudev-dev (libudev.h)
if ( APPLE )
include_directories ( SYSTEM /usr/include/malloc )
if ( POLICY CMP0042 )
cmake_policy ( SET CMP0042 NEW )
endif ( )
endif ( )
if ( APPLE AND NOT IOS )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11" )
if ( NOT OPENSSL_ROOT_DIR )
EXECUTE_PROCESS ( COMMAND brew --prefix openssl
O U T P U T _ V A R I A B L E O P E N S S L _ R O O T _ D I R
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
message ( STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}" )
endif ( )
endif ( )
find_package ( HIDAPI )
if ( HIDAPI_FOUND )
message ( STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}" )
add_definitions ( -DHAVE_HIDAPI )
include_directories ( ${ HIDAPI_INCLUDE_DIR } )
link_directories ( ${ LIBHIDAPI_LIBRARY_DIRS } )
endif ( )
if ( NOT HIDAPI_FOUND )
message ( "HIDAPI libraries not found. Will manually set libraries." )
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "Linux" )
set ( UDEV_LIBRARY libudev.so )
set ( HIDAPI_LIBRARY ${ UDEV_LIBRARY } libhidapi-libusb.so ) # or libhidapi-hidraw.so # has to be dynamically linked or you'll get "undefined reference to `libusb_get_device_address'" error
endif ( )
endif ( )
######################################
# Monero (monero-0.17.2.3 contents pasted in "monero-cpp/external/monero-project")
set ( MONERO_PROJECT_BUILD "${MONERO_PROJECT}/build/release" )
message ( STATUS "Using monero-project build" : ${ MONERO_PROJECT_BUILD } )
add_library ( wallet_merged STATIC IMPORTED )
set_target_properties ( wallet_merged PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / l i b / l i b w a l l e t _ m e r g e d . a )
add_library ( wallet STATIC IMPORTED )
set_target_properties ( wallet PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / l i b / l i b w a l l e t . a )
add_library ( wallet_crypto STATIC IMPORTED )
set_target_properties ( wallet_crypto PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / c r y p t o / w a l l e t / l i b w a l l e t - c r y p t o . a )
add_library ( lmdb STATIC IMPORTED )
set_target_properties ( lmdb PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / e x t e r n a l / d b _ d r i v e r s / l i b l m d b / l i b l m d b . a )
add_library ( epee STATIC IMPORTED )
set_target_properties ( epee PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / c o n t r i b / e p e e / s r c / l i b e p e e . a )
add_library ( unbound STATIC IMPORTED )
set_target_properties ( unbound PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / e x t e r n a l / u n b o u n d / l i b u n b o u n d . a )
add_library ( easylogging STATIC IMPORTED )
set_target_properties ( easylogging PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / e x t e r n a l / e a s y l o g g i n g + + / l i b e a s y l o g g i n g . a )
add_library ( cryptonote_core STATIC IMPORTED )
set_target_properties ( cryptonote_core PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / c r y p t o n o t e _ c o r e / l i b c r y p t o n o t e _ c o r e . a )
add_library ( cryptonote_basic STATIC IMPORTED )
set_target_properties ( cryptonote_basic PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / c r y p t o n o t e _ b a s i c / l i b c r y p t o n o t e _ b a s i c . a )
# new addition [2021-10-02]
add_library ( cryptonote_format_utils_basic STATIC IMPORTED )
set_target_properties ( cryptonote_format_utils_basic PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / c r y p t o n o t e _ b a s i c / l i b c r y p t o n o t e _ f o r m a t _ u t i l s _ b a s i c . a )
add_library ( mnemonics STATIC IMPORTED )
set_target_properties ( mnemonics PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / m n e m o n i c s / l i b m n e m o n i c s . a )
add_library ( common STATIC IMPORTED )
set_target_properties ( common PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / c o m m o n / l i b c o m m o n . a )
add_library ( cncrypto STATIC IMPORTED )
set_target_properties ( cncrypto PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / c r y p t o / l i b c n c r y p t o . a )
add_library ( ringct STATIC IMPORTED )
set_target_properties ( ringct PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / r i n g c t / l i b r i n g c t . a )
add_library ( ringct_basic STATIC IMPORTED )
set_target_properties ( ringct_basic PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / r i n g c t / l i b r i n g c t _ b a s i c . a )
add_library ( blockchain_db STATIC IMPORTED )
set_target_properties ( blockchain_db PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / b l o c k c h a i n _ d b / l i b b l o c k c h a i n _ d b . a )
add_library ( blocks STATIC IMPORTED )
set_target_properties ( blocks PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / b l o c k s / l i b b l o c k s . a )
add_library ( checkpoints STATIC IMPORTED )
set_target_properties ( checkpoints PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / c h e c k p o i n t s / l i b c h e c k p o i n t s . a )
add_library ( device STATIC IMPORTED )
set_target_properties ( device PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / d e v i c e / l i b d e v i c e . a )
add_library ( device_trezor STATIC IMPORTED )
set_target_properties ( device_trezor PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / d e v i c e _ t r e z o r / l i b d e v i c e _ t r e z o r . a )
add_library ( multisig STATIC IMPORTED )
set_target_properties ( multisig PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / m u l t i s i g / l i b m u l t i s i g . a )
add_library ( version STATIC IMPORTED )
set_target_properties ( version PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / s r c / l i b v e r s i o n . a )
add_library ( randomx STATIC IMPORTED )
set_target_properties ( randomx PROPERTIES IMPORTED_LOCATION
$ { M O N E R O _ P R O J E C T _ B U I L D } / e x t e r n a l / r a n d o m x / l i b r a n d o m x . a )
######################################
set ( monero_src wallet_merged wallet_crypto #[[wallet_api]] wallet lmdb epee unbound easylogging cryptonote_core cryptonote_basic cryptonote_format_utils_basic mnemonics ringct ringct_basic common cncrypto blockchain_db blocks checkpoints device device_trezor multisig version randomx
$ { B o o s t _ L I B R A R I E S } $ { P r o t o b u f _ L I B R A R Y } $ { L i b U S B _ L I B R A R I E S } $ { O P E N S S L _ L I B R A R I E S } $ { S O D I U M _ L I B R A R Y } $ { H I D A P I _ L I B R A R Y } $ { E X T R A _ L I B R A R I E S } )
######################################
# monero-cpp (wrapper) v0.5.1 => v0.5.5 => v0.5.10 => v0.6.4 => v0.7.0
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/monero-cpp/src/ )
set ( monero_cpp_src ${ CMAKE_CURRENT_SOURCE_DIR } /build/libmonero-cpp.a ) #set(monero_cpp_src external/monero-cpp/src/utils/gen_utils.cpp external/monero-cpp/src/utils/monero_utils.cpp external/monero-cpp/src/daemon/monero_daemon_model.cpp external/monero-cpp/src/daemon/monero_daemon.cpp external/monero-cpp/src/wallet/monero_wallet_model.cpp external/monero-cpp/src/wallet/monero_wallet_keys.cpp external/monero-cpp/src/wallet/monero_wallet_full.cpp)
######################################
# libbcrypt (deprecated)
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/libbcrypt )
set ( bcrypt_src ${ CMAKE_CURRENT_SOURCE_DIR } /build/libbcrypt.a ) #set(bcrypt_src external/libbcrypt/crypt_blowfish/crypt_blowfish.c external/libbcrypt/crypt_blowfish/crypt_gensalt.c external/libbcrypt/crypt_blowfish/wrapper.c external/libbcrypt/bcrypt.c)
######################################
# sqlite3
#[[find_package(SQLite3)
if ( SQLite3_FOUND )
message ( STATUS "Using SQLite3: ${SQLite3_LIBRARY} (v${SQLite3_VERSION})" )
include_directories ( ${ SQLite3_INCLUDE_DIRS } )
set ( sqlite_src ${ SQLite3_LIBRARY } ) # or ${SQLite3_LIBRARIES}
endif ( )
if ( NOT SQLite3_FOUND )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/sqlite )
set ( sqlite_src ${ CMAKE_CURRENT_SOURCE_DIR } /external/sqlite/sqlite3.c ) # amalgamation - runs a bit faster
endif ( ) ] ]
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/sqlite )
set ( sqlite_src ${ CMAKE_CURRENT_SOURCE_DIR } /build/libsqlite3.a ) #set(sqlite_src ${CMAKE_CURRENT_SOURCE_DIR}/external/sqlite/sqlite3.c)
######################################
# QR-Code-generator
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/QR-Code-generator/cpp )
set ( qr_code_generator_src ${ CMAKE_CURRENT_SOURCE_DIR } /build/libqrcodegen.a ) #set(qr_code_generator_src ${CMAKE_CURRENT_SOURCE_DIR}/external/QR-Code-generator/cpp/qrcodegen.cpp) # or ${CMAKE_CURRENT_SOURCE_DIR}/external/QR-Code-generator/c/qrcodegen.c
######################################
# json
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/json/single_include )
######################################
# curl
find_package ( CURL ) # if curl is found on the system, use the system default shared library, otherwise use the curl that we've built from source
if ( CURL_FOUND )
message ( STATUS "Using CURL: ${CURL_LIBRARIES} (v${CURL_VERSION_STRING})" )
include_directories ( ${ CURL_INCLUDE_DIRS } )
set ( curl_src ${ CURL_LIBRARIES } )
endif ( )
if ( NOT CURL_FOUND )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/curl/include ${ CMAKE_CURRENT_SOURCE_DIR } /external/curl/lib )
set ( curl_src ${ CMAKE_CURRENT_SOURCE_DIR } /external/curl/lib/.libs/libcurl.a )
add_definitions ( -DCURL_STATICLIB )
set ( CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lldap -llber -lnghttp2 -lpsl -lidn2 -lbrotlidec -lzstd -lrtmp" ) # for Arch (Manjaro) # https://stackoverflow.com/questions/68368557/linking-nghttp2-static-library#comment120830125_68368557
endif ( )
######################################
# postgresql (deprecated)
include_directories ( ${ PostgreSQL_INCLUDE_DIRS } ${ PostgreSQL_INCLUDE_DIRS } /server )
set ( PostgreSQL_TYPE_INCLUDE_DIR "/usr/include/postgresql/" )
######################################
# lmdb
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/monero-cpp/external/monero-project/external/db_drivers/liblmdb ) # or ${CMAKE_CURRENT_SOURCE_DIR}/external/lmdb/libraries/liblmdb/
######################################
# libuv (supports Android :D)
find_package ( LIBUV )
if ( LIBUV_FOUND )
message ( STATUS "Using LIBUV: ${LIBUV_LIBRARIES}" )
include_directories ( ${ LIBUV_INCLUDE_DIRS } )
set ( libuv_src ${ LIBUV_LIBRARIES } )
endif ( )
if ( NOT LIBUV_FOUND )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/libuv/include ${ CMAKE_CURRENT_SOURCE_DIR } /external/libuv/src )
set ( libuv_src ${ CMAKE_CURRENT_SOURCE_DIR } /external/libuv/.libs/libuv.a ) # In case user chooses to build libuv themselves instead of installing it on the system
endif ( )
######################################
# willemt/raft (BSD and has zero dependencies :D)
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/raft/include )
set ( raft_src ${ CMAKE_CURRENT_SOURCE_DIR } /build/libraft.a ) #set(raft_src ${CMAKE_CURRENT_SOURCE_DIR}/external/raft/src/raft_log.c ${CMAKE_CURRENT_SOURCE_DIR}/external/raft/src/raft_node.c ${CMAKE_CURRENT_SOURCE_DIR}/external/raft/src/raft_server.c ${CMAKE_CURRENT_SOURCE_DIR}/external/raft/src/raft_server_properties.c)
######################################
# dokun-ui_dependencies
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/lua/lua-5.4.1/src ) # lua
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/glew/include )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/png ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/zlib )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/freetype/include # public headers - ft2build.h
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / f r e e t y p e / i n c l u d e / f r e e t y p e # public headers
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / f r e e t y p e / i n c l u d e / f r e e t y p e / c o n f i g # public config headers
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / f r e e t y p e / i n c l u d e / f r e e t y p e / i n t e r n a l ) # private headers - added 2019-07-29
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/ogg/include )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/vorbis/include
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / v o r b i s / l i b )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/theora/include )
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/dokun-ui/external/utf8/source)
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/openal/include
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / o p e n a l - s o f t / i n c l u d e )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/jpeg
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / j p e g / j p e g - 6 b )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/tiff/libtiff )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/gif/lib )
include_directories ( #[[${CMAKE_CURRENT_SOURCE_DIR}/external/flac]] # config.h
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / f l a c / i n c l u d e
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / d o k u n - u i / e x t e r n a l / f l a c / s r c / l i b F L A C / i n c l u d e ) # for "private/cpu.h"
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/external/glm )
if ( WIN32 )
set ( winsocket_src ws2_32.lib ) # -lglfw3 -lgdi32 -lopengl32 -limm32
endif ( )
if ( LINUX )
set ( OpenGL_GL_PREFERENCE "LEGACY" ) # LEGACY(libGL.so) OR GLVND(libOpenGL.so and libGLX.so)
set ( posix_src libpthread.so libdl.so libm.so )
endif ( ) # -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
######################################
# dokun-ui
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/include )
set ( dokun_ui_src ${ CMAKE_CURRENT_SOURCE_DIR } /external/dokun-ui/src/libdokun-ui.a ) # definitions added: DOKUN_OPENGL, DOKUN_BUILD_LIBRARY#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/dokun-ui)
######################################
# neroshop-daemon
set ( daemon_executable "neromon" )
add_executable ( ${ daemon_executable } src/daemon.cpp src/server.cpp ) #target_link_libraries(daemon ${curl_src} ${OPENSSL_LIBRARIES}) # curl requires both openssl(used in monero) and zlib(used in dokun-ui)
target_link_libraries ( ${ daemon_executable } ${ dokun_ui_src } ) #set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl") # fixes undefined reference to symbol 'dlsym@@GLIBC_2.2.5' error
######################################
# neroshop
set ( neroshop_executable "neroshop" )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /external )
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /include )
link_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } /src ${ CMAKE_CURRENT_SOURCE_DIR } /build )
set ( neroshop_src src/buyer.cpp #[[src/carrier.cpp]] src/cart.cpp src/catalog.cpp src/client.cpp src/converter.cpp src/database.cpp src/encryptor.cpp src/icon.cpp src/item.cpp src/main.cpp src/message.cpp src/order.cpp src/qr.cpp src/seller.cpp src/server.cpp src/user.cpp src/validator.cpp src/wallet.cpp)
add_definitions ( -DNEROSHOP_DEBUG ) # for more detailed debugging, use -DNEROSHOP_DEBUG0
add_executable ( ${ neroshop_executable } ${ neroshop_src } ) #add_executable(${neroshop_executable} ${neroshop_src} ${monero_cpp_src} ${bcrypt_src} ${sqlite_src} ${qr_code_generator_src} ${raft_src})
target_link_libraries ( ${ neroshop_executable } ${ monero_cpp_src } ${ sqlite_src } ${ qr_code_generator_src } ${ raft_src } ${ curl_src } ${ monero_src } ${ dokun_ui_src } ${ libuv_src } ) #target_link_libraries(${neroshop_executable} #[[${sqlite_src}]] ${curl_src} ${monero_src} ${dokun_ui_src} ${libuv_src})
######################################
if ( DEFINED NEROSHOP_USE_LIBBCRYPT ) # -DNEROSHOP_USE_LIBBCRYPT=1
message ( STATUS "Using libbcrypt: ${bcrypt_src}" )
target_compile_definitions ( ${ neroshop_executable } PUBLIC -DNEROSHOP_USE_LIBBCRYPT )
target_link_libraries ( ${ neroshop_executable } ${ bcrypt_src } )
endif ( )
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "Linux" )
target_link_libraries ( ${ neroshop_executable } ${ posix_src } )
target_link_libraries ( ${ daemon_executable } ${ posix_src } )
find_package ( X11 REQUIRED )
if ( X11_FOUND )
target_link_libraries ( ${ neroshop_executable } ${ X11_LIBRARIES } )
target_link_libraries ( ${ daemon_executable } ${ X11_LIBRARIES } )
endif ( )
endif ( )
find_package ( OpenGL REQUIRED )
if ( OPENGL_FOUND )
target_link_libraries ( ${ neroshop_executable } ${ OPENGL_LIBRARIES } )
target_link_libraries ( ${ daemon_executable } ${ OPENGL_LIBRARIES } )
endif ( )
find_package ( PostgreSQL )
if ( PostgreSQL_FOUND )
if ( DEFINED NEROSHOP_USE_POSTGRESQL ) # -DNEROSHOP_USE_POSTGRESQL=1
message ( STATUS "Using PostgreSQL: ${PostgreSQL_LIBRARIES} (v${PostgreSQL_VERSION_STRING})" )
target_compile_definitions ( ${ neroshop_executable } PUBLIC -DNEROSHOP_USE_POSTGRESQL )
target_link_libraries ( ${ neroshop_executable } ${ PostgreSQL_LIBRARIES } )
target_link_libraries ( ${ daemon_executable } ${ PostgreSQL_LIBRARIES } )
endif ( )
endif ( )
######################################