diff --git a/.gitignore b/.gitignore index 0e609a70..5d0b3605 100644 --- a/.gitignore +++ b/.gitignore @@ -53,7 +53,6 @@ local.properties [Dd]ebug/ [Rr]elease/ x64/ -build/ [Bb]in/ [Oo]bj/ @@ -200,7 +199,6 @@ $RECYCLE.BIN/ *.egg *.egg-info dist/ -build/ eggs/ parts/ var/ diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt new file mode 100644 index 00000000..9a6299ff --- /dev/null +++ b/build/CMakeLists.txt @@ -0,0 +1,94 @@ + +cmake_minimum_required ( VERSION 2.8 ) + +project ( i2pd ) + +set ( SRC_DIR ".." ) +set ( INC_DIR ".." ) + +add_definitions ( "-std=c++0x -Wall" ) + +set ( SOURCES + AddressBook.cpp + Garlic.cpp + HTTPServer.cpp + i2p.cpp + Identity.cpp + Log.cpp + NTCPSession.cpp + RouterContext.cpp + SSU.cpp + TransitTunnel.cpp + Tunnel.cpp + TunnelGateway.cpp + UPnP.cpp + base64.cpp + HTTPProxy.cpp + I2NPProtocol.cpp + LeaseSet.cpp + NetDb.cpp + Reseed.cpp + RouterInfo.cpp + Streaming.cpp + Transports.cpp + TunnelEndpoint.cpp + TunnelPool.cpp + util.cpp +) + +set ( HEADERS + AddressBook.h + Garlic.h + HTTPServer.h + Identity.h + Log.h + NTCPSession.h + RouterContext.h + SSU.h + TransitTunnel.h + Tunnel.h + TunnelGateway.h + UPnP.h + base64.h + HTTPProxy.h + I2NPProtocol.h + LeaseSet.h + NetDb.h + Reseed.h + RouterInfo.h + Streaming.h + Transports.h + TunnelEndpoint.h + TunnelPool.h + util.h +) + +source_group ("Header Files" FILES ${HEADERS}) +source_group ("Source Files" FILES ${SOURCES}) + +find_package ( Threads REQUIRED ) + +find_package ( Boost COMPONENTS system filesystem regex program_options REQUIRED ) + +set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" ) +find_package ( CryptoPP REQUIRED ) + +include_directories ( ${Boost_INCLUDE_DIRS} ${CryptoPP_INCLUDE_DIRS}) + + +unset ( TMP ) +foreach ( src ${SOURCES} ) + list ( APPEND TMP "${SRC_DIR}/${src}" ) +endforeach () +set ( SOURCES ${TMP} ) + +unset ( TMP ) +foreach ( hdr ${HEADERS} ) + list ( APPEND TMP "${INC_DIR}/${hdr}" ) +endforeach () +set ( HEADERS ${TMP} ) + + +add_executable ( ${PROJECT_NAME} WIN32 ${HEADERS} ${SOURCES} ) + +target_link_libraries( ${PROJECT_NAME} ${Boost_LIBRARIES} ${CryptoPP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) diff --git a/build/cmake_modules/FindCryptoPP.cmake b/build/cmake_modules/FindCryptoPP.cmake new file mode 100644 index 00000000..68177b98 --- /dev/null +++ b/build/cmake_modules/FindCryptoPP.cmake @@ -0,0 +1,28 @@ +# Find Crypto++ library +# +# Output variables : +# CryptoPP_FOUND +# CryptoPP_INCLUDE_DIRS +# CryptoPP_LIBRARIES +# + + +FIND_PATH( CryptoPP_INCLUDE_DIR cryptopp/dsa.h ) + +FIND_LIBRARY( CryptoPP_LIBRARY NAMES cryptopp ) + +# handle the QUIETLY and REQUIRED arguments and set CRYPTOPP_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CryptoPP DEFAULT_MSG CryptoPP_LIBRARY CryptoPP_INCLUDE_DIR) + +set ( CryptoPP_FOUND FALSE ) + +if ( ${CRYPTOPP_FOUND} ) + set ( CryptoPP_FOUND TRUE ) + set ( CryptoPP_INCLUDE_DIRS ${CryptoPP_INCLUDE_DIR} ) + set ( CryptoPP_LIBRARIES ${CryptoPP_LIBRARY} ) +endif () + +MARK_AS_ADVANCED(CryptoPP_INCLUDE_DIR CryptoPP_LIBRARY) +