From b4abc73bbc72b7b992f9fefc665e7eabf565f2c7 Mon Sep 17 00:00:00 2001
From: Mayank Rathee <mayankrathee.japan@gmail.com>
Date: Tue, 2 Jun 2020 14:29:00 +0530
Subject: [PATCH] Completed shift to CMake

---
 Porthos/src/CMakeLists.txt                    | 20 ++++++++++++-------
 .../src/example_neural_nets/network_config.h  |  6 +++---
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Porthos/src/CMakeLists.txt b/Porthos/src/CMakeLists.txt
index 0fd6e4e..748d6fc 100644
--- a/Porthos/src/CMakeLists.txt
+++ b/Porthos/src/CMakeLists.txt
@@ -1,11 +1,14 @@
 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")
+		set(CMAKE_C_COMPILER "/usr/local/bin/gcc-9")
+		set(CMAKE_CXX_COMPILER "/usr/local/bin/g++-9")
 endif()
 
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+
 project(Porthos)
 set(NAME "Porthos")
 
@@ -24,13 +27,16 @@ 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)
+macro (add_network _name)
+	add_executable(${_name} ${CMAKE_CURRENT_SOURCE_DIR}/example_neural_nets/main${_name}.cpp)
+  target_link_libraries(${_name} Porthos-Protocols) 
+endmacro()
 
 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")
+add_network(DenseNet121)
+add_network(ResNet50)
+add_network(SqNetImgNet)
 
 
diff --git a/Porthos/src/example_neural_nets/network_config.h b/Porthos/src/example_neural_nets/network_config.h
index 3556c45..eff4a65 100644
--- a/Porthos/src/example_neural_nets/network_config.h
+++ b/Porthos/src/example_neural_nets/network_config.h
@@ -1,6 +1,6 @@
 //Which network to run
 //New set of main files - choose which one to run
 
-//#define F_RESNET50
-//#define F_DENSENET121
-//#define F_SQUEEZENET_IMAGENET
+#define F_RESNET50
+#define F_DENSENET121
+#define F_SQUEEZENET_IMAGENET
-- 
GitLab