Skip to content
Snippets Groups Projects
Commit beb72446 authored by Mayank Rathee's avatar Mayank Rathee
Browse files

Added CMake build system

parent 42278e88
No related branches found
No related tags found
No related merge requests found
...@@ -4,3 +4,4 @@ util/Miracl/ ...@@ -4,3 +4,4 @@ util/Miracl/
*.log *.log
**/*.swp **/*.swp
lib_eigen/ lib_eigen/
**/build/
...@@ -7,7 +7,7 @@ OBJ_FILES += $(patsubst src/%.cpp, src/%.o, $(SRC_CPP_FILES)) ...@@ -7,7 +7,7 @@ OBJ_FILES += $(patsubst src/%.cpp, src/%.o, $(SRC_CPP_FILES))
OBJ_FILES += $(patsubst util/%.cpp, util/%.o, $(OBJ_CPP_FILES)) OBJ_FILES += $(patsubst util/%.cpp, util/%.o, $(OBJ_CPP_FILES))
HEADER_FILES = $(wildcard src/*.h) HEADER_FILES = $(wildcard src/*.h)
FLAGS := -w -std=c++14 -pthread -msse4.1 -maes -msse2 -mpclmul -fpermissive -fpic #-fopenmp FLAGS := -w -std=c++14 -pthread -msse4.1 -maes -msse2 -mpclmul -fpermissive -fpic -fopenmp
LIBS := -lcrypto -lssl LIBS := -lcrypto -lssl
OBJ_INCLUDES := -I 'lib_eigen/' -I 'src/' OBJ_INCLUDES := -I 'lib_eigen/' -I 'src/'
UTIL_INCLUDES := $($(OBJ_INCLUDES), -L./) UTIL_INCLUDES := $($(OBJ_INCLUDES), -L./)
......
cmake_minimum_required (VERSION 3.0)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(APPLE)
set(CMAKE_C_COMPILER "/usr/local/bin/gcc-9")
set(CMAKE_CXX_COMPILER "/usr/local/bin/g++-9")
endif()
project(Porthos)
set(NAME "Porthos")
find_package(OpenMP REQUIRED)
find_package(OpenSSL REQUIRED)
FILE(GLOB CXXSources *.cpp)
list(REMOVE_ITEM CXXSources ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
add_library(Porthos-Protocols ${CXXSources})
target_include_directories(Porthos-Protocols
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../lib_eigen/
${OPENSSL_INCLUDE_DIR})
target_link_libraries(Porthos-Protocols
PUBLIC OpenMP::OpenMP_CXX
${OPENSSL_LIBRARIES})
add_executable(Porthos3PC ${CMAKE_CURRENT_SOURCE_DIR}/example_neural_nets/mainResNet50.cpp)
target_link_libraries(Porthos3PC Porthos-Protocols)
target_compile_options(Porthos-Protocols
PUBLIC "-pthread;-Wall;-march=native;-msse4.1;-maes;-mpclmul;-mrdseed;-fpermissive;-fpic;-std=c++17;-w;-O3")
target_compile_options(Porthos3PC
PRIVATE "-pthread;-Wall;-march=native;-msse4.1;-maes;-mpclmul;-mrdseed;-fpermissive;-fpic;-std=c++17;-w;-O3")
...@@ -35,6 +35,16 @@ using namespace std::chrono; ...@@ -35,6 +35,16 @@ using namespace std::chrono;
#define Sockwrite(sock, data, size) write(sock, data, size) #define Sockwrite(sock, data, size) write(sock, data, size)
#define Sockread(sock, buff, bufferSize) read(sock, buff, bufferSize) #define Sockread(sock, buff, bufferSize) read(sock, buff, bufferSize)
//#define socklen_t int //#define socklen_t int
#elif __APPLE__
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define Sockwrite(sock, data, size) write(sock, data, size)
#define Sockread(sock, buff, bufferSize) read(sock, buff, bufferSize)
//#define socklen_t int
#elif _WIN32 #elif _WIN32
//#pragma comment (lib, "ws2_32.lib") //Winsock Library //#pragma comment (lib, "ws2_32.lib") //Winsock Library
#pragma comment (lib, "Ws2_32.lib") #pragma comment (lib, "Ws2_32.lib")
...@@ -46,7 +56,6 @@ using namespace std::chrono; ...@@ -46,7 +56,6 @@ using namespace std::chrono;
#define close closesocket #define close closesocket
#define Sockwrite(sock, data, size) send(sock, (char*)data, size, 0) #define Sockwrite(sock, data, size) send(sock, (char*)data, size, 0)
#define Sockread(sock, buff, bufferSize) recv(sock, (char*)buff, bufferSize, 0) #define Sockread(sock, buff, bufferSize) recv(sock, (char*)buff, bufferSize, 0)
#endif #endif
/*GLOBAL VARIABLES - LIST OF IP ADDRESSES*/ /*GLOBAL VARIABLES - LIST OF IP ADDRESSES*/
......
...@@ -12,7 +12,13 @@ ...@@ -12,7 +12,13 @@
//#include <stropts.h> //#include <stropts.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef __APPLE__
#include <net/if.h>
#else
#include <linux/netdevice.h> #include <linux/netdevice.h>
#endif
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <unistd.h> #include <unistd.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment