[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi libCERTI/CMakeLists.txt test/utility/CMak... [br_CERTI
From: |
certi-cvs |
Subject: |
[certi-cvs] certi libCERTI/CMakeLists.txt test/utility/CMak... [br_CERTI_SHM_NEWGEN_dev] |
Date: |
Wed, 16 Sep 2009 14:31:24 +0000 |
CVSROOT: /sources/certi
Module name: certi
Branch: br_CERTI_SHM_NEWGEN_dev
Changes by: Adelantado <adele> 09/09/16 14:31:24
Modified files:
libCERTI : CMakeLists.txt
test/utility : CMakeLists.txt Main_SocketSHM.cc
Log message:
Update for WIN32 compilation of SHM stuff
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/CMakeLists.txt?cvsroot=certi&only_with_tag=br_CERTI_SHM_NEWGEN_dev&r1=1.25.4.4&r2=1.25.4.5
http://cvs.savannah.gnu.org/viewcvs/certi/test/utility/CMakeLists.txt?cvsroot=certi&only_with_tag=br_CERTI_SHM_NEWGEN_dev&r1=1.4.8.2&r2=1.4.8.3
http://cvs.savannah.gnu.org/viewcvs/certi/test/utility/Main_SocketSHM.cc?cvsroot=certi&only_with_tag=br_CERTI_SHM_NEWGEN_dev&r1=1.1.2.1&r2=1.1.2.2
Patches:
Index: libCERTI/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libCERTI/CMakeLists.txt,v
retrieving revision 1.25.4.4
retrieving revision 1.25.4.5
diff -u -b -r1.25.4.4 -r1.25.4.5
--- libCERTI/CMakeLists.txt 4 Sep 2009 08:53:23 -0000 1.25.4.4
+++ libCERTI/CMakeLists.txt 16 Sep 2009 14:31:24 -0000 1.25.4.5
@@ -120,11 +120,21 @@
)
if (WIN32)
- message(STATUS "Shared Memory communication is currently unsupported on
Windows")
-else(WIN32)
include_directories(${CERTI_SOURCE_DIR}/libHLA)
+ ADD_DEFINITIONS(-DDEBUG)
+ SET(CERTI_SHM_SRCS
+ SHM.hh)
-ADD_DEFINITIONS(-DDEBUG)
+ SET(CERTI_SEMAPHORE_SRCS
+ Semaphore.hh)
+
+ SET(CERTI_SOCKET_SHM_SRC
+ SocketSHM.cc SocketSHM.hh)
+
+ LIST(APPEND CERTI_SOCKET_SRCS ${CERTI_SHM_SRCS} ${CERTI_SEMAPHORE_SRCS}
${CERTI_SOCKET_SHM_SRC})
+else(WIN32)
+ include_directories(${CERTI_SOURCE_DIR}/libHLA)
+ ADD_DEFINITIONS(-DDEBUG)
SET(CERTI_SHM_SRCS
SHM.hh
Index: test/utility/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/test/utility/CMakeLists.txt,v
retrieving revision 1.4.8.2
retrieving revision 1.4.8.3
diff -u -b -r1.4.8.2 -r1.4.8.3
--- test/utility/CMakeLists.txt 4 Sep 2009 08:53:24 -0000 1.4.8.2
+++ test/utility/CMakeLists.txt 16 Sep 2009 14:31:24 -0000 1.4.8.3
@@ -18,11 +18,21 @@
ADD_TEST(CertiUtilTests CertiUtilTests)
ADD_EXECUTABLE(CertiProcessus_A Main_SocketSHM.cc SharedStruct.hh)
-TARGET_LINK_LIBRARIES(CertiProcessus_A CERTI rt)
+IF(WIN32)
+ TARGET_LINK_LIBRARIES(CertiProcessus_A CERTI)
+ELSE(WIN32)
+ TARGET_LINK_LIBRARIES(CertiProcessus_A CERTI rt)
+ENDIF(WIN32)
+
SET_TARGET_PROPERTIES(CertiProcessus_A PROPERTIES COMPILE_FLAGS -DSIDE_SC)
ADD_EXECUTABLE(CertiProcessus_B Main_SocketSHM.cc SharedStruct.hh)
-TARGET_LINK_LIBRARIES(CertiProcessus_B CERTI rt)
+
+IF(WIN32)
+ TARGET_LINK_LIBRARIES(CertiProcessus_B CERTI)
+ELSE(WIN32)
+ TARGET_LINK_LIBRARIES(CertiProcessus_B CERTI rt)
+ENDIF(WIN32)
INSTALL(TARGETS CertiProcessus_A CertiProcessus_B
RUNTIME DESTINATION bin
Index: test/utility/Main_SocketSHM.cc
===================================================================
RCS file: /sources/certi/certi/test/utility/Attic/Main_SocketSHM.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- test/utility/Main_SocketSHM.cc 4 Sep 2009 08:53:24 -0000 1.1.2.1
+++ test/utility/Main_SocketSHM.cc 16 Sep 2009 14:31:24 -0000 1.1.2.2
@@ -12,8 +12,16 @@
#include <limits>
// Specifics includes
+#ifdef _WIN32
+// FIXME Martin code win32
+//#include "SocketSHMWin32.hh"
+#include "SocketSHM.hh"
+#include <windows.h>
+#include <process.h>
+#else
#include "SocketSHMPosix.hh"
#include "SocketSHMSysV.hh"
+#endif
#include "SharedStruct.hh"
@@ -53,16 +61,15 @@
// CODE
// ************
+#ifdef _WIN32
+// FIXME Martin code win32
+//SocketSHMWin32 Socket_Win32(NAME_AB,Socket_Side,size) ;
+#else
// Posix Socket SHM
-SocketSHMPosix Socket_Posix_AB(NAME_AB,
- Socket_Side,
- size) ;
-
+SocketSHMPosix Socket_Posix_AB(NAME_AB,Socket_Side,size) ;
// SystemV Socket SHM
-SocketSHMSysV Socket_SysV_AB(NAME_AB,
- Socket_Side,
- size) ;
-
+SocketSHMSysV Socket_SysV_AB(NAME_AB,Socket_Side,size) ;
+#endif
// Wainting for User Command n1
@@ -76,9 +83,12 @@
std::cout << "************************************************************" <<
std::endl ;
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
+#ifdef _WIN32
+//Socket_Win32.connect();
+#else
Socket_Posix_AB.Connect() ; // Connect to created Semaphores
Socket_SysV_AB.Connect() ; // Connect to created Semaphores
-
+#endif
// Wainting for User Command n2
std::cout << "*******************************************************" <<
std::endl ;
@@ -89,9 +99,13 @@
std::cin >> command;
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
+#ifdef _WIN32
+//Socket_Win32.Open() ;
+#else
// Open the Socket
if (command=="Posix") Socket_Posix_AB.Open() ;
if (command=="SysV") Socket_SysV_AB.Open() ;
+#endif
// Wainting for User Command n3
std::cout << "************************************************************" <<
std::endl ;
@@ -104,9 +118,13 @@
#ifdef SIDE_SC
// Send to B For the First Time (INITIALIZE)
// Send to B
+#ifdef _WIN32
+//Socket_Win32.Send(&Data_Write);
+#else
if (command=="Posix") Socket_Posix_AB.Send(&Data_Write) ;
if (command=="SysV") Socket_SysV_AB.Send(&Data_Write) ;
#endif
+#endif
while(i<1000) {
std::cout << " *********** COMPUTING PHASE n°= " << i << "*************"
<< std ::endl ;
@@ -114,9 +132,13 @@
/**************************************/
/************* RECEIVING **************/
/**************************************/
+ #ifdef _WIN32
+ // Socket_Win32.Receive(&Data_Read) ;
+ #else
// Read from B
if (command=="Posix") Socket_Posix_AB.Receive(&Data_Read) ;
if (command=="SysV") Socket_SysV_AB.Receive(&Data_Read) ;
+ #endif
/**************************************/
/************* COMPUTE ****************/
@@ -141,8 +163,12 @@
/************* SENDING ****************/
/**************************************/
// Send to B
+ #ifdef _WIN32
+ // Socket_Win32.Send(&Data_Write) ;
+ #else
if (command=="Posix") Socket_Posix_AB.Send(&Data_Write) ;
if (command=="SysV") Socket_SysV_AB.Send(&Data_Write) ;
+ #endif
// On incremente le compteur
i++ ;
@@ -150,10 +176,18 @@
} // End of while (i<1000)
// Waiting the two process are out of while boucle
+#ifdef _WIN32
+Sleep(1000);
+#else
sleep(1) ;
+#endif
// Close the socket
+#ifdef _WIN32
+// Socket_Win32.Close();
+#else
if (command=="Posix") Socket_Posix_AB.Close() ;
if (command=="SysV") Socket_SysV_AB.Close() ;
+#endif
} // End of Main Program