]> Creatis software - crea.git/commitdiff
Add sample lib
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Thu, 31 Mar 2011 23:13:49 +0000 (23:13 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Thu, 31 Mar 2011 23:13:49 +0000 (23:13 +0000)
appli/creaNewProject/NewProject/lib/mySampleLib/CMakeLists.txt [new file with mode: 0644]
appli/creaNewProject/NewProject/lib/mySampleLib/creaSystem.h [new file with mode: 0644]
appli/creaNewProject/NewProject/lib/mySampleLib/creaSystem.h.in [new file with mode: 0644]
appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass.cxx [new file with mode: 0644]
appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass.h [new file with mode: 0644]
appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass2.cxx [new file with mode: 0644]
appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass2.h [new file with mode: 0644]

diff --git a/appli/creaNewProject/NewProject/lib/mySampleLib/CMakeLists.txt b/appli/creaNewProject/NewProject/lib/mySampleLib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ec88649
--- /dev/null
@@ -0,0 +1,86 @@
+#----------------------------------------------------------------------------
+# USER! : SET THE NAME OF YOUR LIBRARY
+# (Replace 'MyLib' by your own library name)
+
+#############################
+SET ( LIBRARY_NAME   MySampleLib  )
+#############################
+
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# CREATES A USER OPTION IN CMAKE
+OPTION ( BUILD_${LIBRARY_NAME}  "Build ${LIBRARY_NAME} library ?" ON)
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+IF ( BUILD_${LIBRARY_NAME} )
+#----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # BUILD LIBRARY
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY HEADERS (TO BE INSTALLED)
+  # EITHER LIST ALL .h, *.txx IN CURRENT DIR USING NEXT LINE:
+
+  FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h" "*.txx")
+  
+  # OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND
+  #  SET ( ${LIBRARY_NAME}_HEADERS
+  #
+  #      )
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY SOURCES (TO BE COMPILED)
+  # EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE:
+
+  FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc)
+
+  # OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
+  #  SET ( ${LIBRARY_NAME}_SOURCES 
+  #   
+  #      )
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # LIBRARY DEPENDENCIES (LIBRARIES TO LINK WITH)
+  #
+  # USER! : Uncomment the Libraries you need
+  #
+  SET ( ${LIBRARY_NAME}_LINK_LIBRARIES
+  #    ${crea_LIBRARIES}
+  #    ${WXWIDGETS_LIBRARIES}
+  #    ${KWWidgets_LIBRARIES}
+      ${VTK_LIBRARIES}
+  #    ${ITK_LIBRARIES}
+      ${GDCM_LIBRARIES}
+  #    ${BOOST_LIBRARIES}
+
+  # If this library must link against other libraries 
+  # USER! : Add here any extra Library you need
+
+      )
+  #----------------------------------------------------------------------------
+
+  #----------------------------------------------------------------------------
+  # MACRO WHICH DOES ALL THE JOB : BUILD AND INSTALL
+
+  # USER! : The default is to create a Dynamic Library.
+  # if you need to create a static library
+  # comment out the following line :
+
+  CREA_ADD_LIBRARY( ${LIBRARY_NAME} )
+
+  # and uncomment the 2 lines hereafter:
+
+  # ADD_LIBRARY(${LIBRARY_NAME} STATIC  ${${LIBRARY_NAME}_SOURCES})
+  # TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES} )
+
+  #
+  #----------------------------------------------------------------------------
+
+  #---------------------------------------------------------------------------
+ENDIF ( BUILD_${LIBRARY_NAME} )
diff --git a/appli/creaNewProject/NewProject/lib/mySampleLib/creaSystem.h b/appli/creaNewProject/NewProject/lib/mySampleLib/creaSystem.h
new file mode 100644 (file)
index 0000000..d91ccee
--- /dev/null
@@ -0,0 +1,26 @@
+
+#ifndef _$PROJECT_NAME$SYSTEM_H_
+#define _$PROJECT_NAME$SYSTEM_H_
+
+
+// Windoze related troubles (as usual)
+
+//-----------------------------------------------------------------------------
+
+#if defined(_WIN32)
+  #ifdef $PROJECT_NAME$_EXPORT_SYMBOLS
+    #define $PROJECT_NAME$_EXPORT __declspec( dllexport )
+#else
+    #define $PROJECT_NAME$_EXPORT __declspec( dllimport )
+  #endif
+  #define $PROJECT_NAME$_CDECL __cdecl
+#else
+  #define $PROJECT_NAME$_EXPORT
+  #define $PROJECT_NAME$_CDECL
+#endif // defined(_WIN32)
+
+#ifdef __BORLANDC__
+  #include <mem.h>
+#endif
+
+#endif
diff --git a/appli/creaNewProject/NewProject/lib/mySampleLib/creaSystem.h.in b/appli/creaNewProject/NewProject/lib/mySampleLib/creaSystem.h.in
new file mode 100644 (file)
index 0000000..d91ccee
--- /dev/null
@@ -0,0 +1,26 @@
+
+#ifndef _$PROJECT_NAME$SYSTEM_H_
+#define _$PROJECT_NAME$SYSTEM_H_
+
+
+// Windoze related troubles (as usual)
+
+//-----------------------------------------------------------------------------
+
+#if defined(_WIN32)
+  #ifdef $PROJECT_NAME$_EXPORT_SYMBOLS
+    #define $PROJECT_NAME$_EXPORT __declspec( dllexport )
+#else
+    #define $PROJECT_NAME$_EXPORT __declspec( dllimport )
+  #endif
+  #define $PROJECT_NAME$_CDECL __cdecl
+#else
+  #define $PROJECT_NAME$_EXPORT
+  #define $PROJECT_NAME$_CDECL
+#endif // defined(_WIN32)
+
+#ifdef __BORLANDC__
+  #include <mem.h>
+#endif
+
+#endif
diff --git a/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass.cxx b/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass.cxx
new file mode 100644 (file)
index 0000000..29b3b2b
--- /dev/null
@@ -0,0 +1,8 @@
+#include "myFierceClass.h"
+
+
+double /*CREA_EXPORT*/ myFierceClass::Calculate(double a, double b)
+{
+   return (a/b)*100;
+}
+
diff --git a/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass.h b/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass.h
new file mode 100644 (file)
index 0000000..6fc3838
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _myFierceClass_H_
+#define _myFierceClass_H_
+
+//#include "MySampleLib_EXPORT.h"
+//---------------------------------------------
+// dummy class 
+// the job is done by a function that receives arguments and returns a value
+//---------------------------------------------
+
+class /*MySampleLib_EXPORT*/ myFierceClass
+{
+   public :
+      myFierceClass() {};
+      ~myFierceClass(){};
+      double Calculate(double a, double b);
+      
+   private:
+
+};
+
+//-----------------------------------------------------------------------------
+#endif
diff --git a/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass2.cxx b/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass2.cxx
new file mode 100644 (file)
index 0000000..9a16ee4
--- /dev/null
@@ -0,0 +1,21 @@
+#include "myFierceClass2.h"
+
+void myFierceClass2::SetX (double x)
+{
+   X=x;
+}
+
+void myFierceClass2::SetY (double y)
+{
+   Y=y;
+}
+
+void myFierceClass2::Execute()
+{
+   Percent=(X/Y)*100;
+}
+
+double myFierceClass2::GetPercent()
+{
+   return Percent;
+}
diff --git a/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass2.h b/appli/creaNewProject/NewProject/lib/mySampleLib/myFierceClass2.h
new file mode 100644 (file)
index 0000000..96a8cd5
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef _myFierceClass2_H_
+#define _myFierceClass2_H_
+
+//---------------------------------------------
+// dummy class 
+// with Setters and Getters
+// the job is done by the function Execute
+
+//---------------------------------------------
+class /*CREA_EXPORT*/ myFierceClass2
+{
+   public :
+      myFierceClass2() : X(0.0), Y(0.0), Percent(0.0) {};
+      myFierceClass2(int a, int b) : X (a), Y(b) {};
+      ~myFierceClass2(){};
+      void SetX (double x);   
+      void SetY (double x);
+      void Execute();
+      double GetPercent();
+      
+   private:
+      float X;
+      float Y;
+      float Percent;
+};
+
+//-----------------------------------------------------------------------------
+#endif