From 9ab37589f483b7dbbf72db5c6a4d482108eb4c6d Mon Sep 17 00:00:00 2001 From: jean-pierre roux Date: Thu, 31 Mar 2011 23:11:01 +0000 Subject: [PATCH] Add sample lib + sample appli --- .../NewProject/appli/CMakeLists.txt | 1 + .../appli/myFierceAppli/CMakeLists.txt | 64 +++++++++++++++++++ .../NewProject/appli/myFierceAppli/main.cxx | 32 ++++++++++ .../NewProject/lib/CMakeLists.txt | 19 +++--- 4 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 appli/creaNewProject/NewProject/appli/myFierceAppli/CMakeLists.txt create mode 100644 appli/creaNewProject/NewProject/appli/myFierceAppli/main.cxx diff --git a/appli/creaNewProject/NewProject/appli/CMakeLists.txt b/appli/creaNewProject/NewProject/appli/CMakeLists.txt index 7aa7b13..8e41883 100644 --- a/appli/creaNewProject/NewProject/appli/CMakeLists.txt +++ b/appli/creaNewProject/NewProject/appli/CMakeLists.txt @@ -1,3 +1,4 @@ # USER! : Add a ADD_SUBDIRECTORY command for each one of your applications # ADD_SUBDIRECTORY(MyApp1) # ADD_SUBDIRECTORY(MyApp2) +ADD_SUBDIRECTORY(myFierceAppli) diff --git a/appli/creaNewProject/NewProject/appli/myFierceAppli/CMakeLists.txt b/appli/creaNewProject/NewProject/appli/myFierceAppli/CMakeLists.txt new file mode 100644 index 0000000..d7e96c4 --- /dev/null +++ b/appli/creaNewProject/NewProject/appli/myFierceAppli/CMakeLists.txt @@ -0,0 +1,64 @@ +#---------------------------------------------------------------------------- +# USER! : SET THE NAME OF YOUR EXECUTABLE +# Replace 'MyExe' by the name you want to give your executable. +# (a good policy is to give the executable the same name that the directory) + +######################### +SET ( EXE_NAME myFierceAppli ) +######################### + +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# EXECUTABLE SOURCES (TO BE COMPILED) +# EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE: + +FILE(GLOB ${EXE_NAME}_SOURCES *.cxx *.cpp *.cc) + +# OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION) +# SET ( ${EXE_NAME}_SOURCES +# +# ) +#---------------------------------------------------------------------------- + +INCLUDE_DIRECTORIES ( + +# USER! : Add here the directories holding the extra .h files you need +# e.g. + ../../lib/mySampleLib + +) + +#---------------------------------------------------------------------------- +# DEPENDENCIES (LIBRARIES TO LINK WITH) +SET ( ${EXE_NAME}_LINK_LIBRARIES + # ${crea_LIBRARIES} + # ${WXWIDGETS_LIBRARIES} + # ${KWWidgets_LIBRARIES} + # ${VTK_LIBRARIES} + # ${ITK_LIBRARIES} + # ${GDCM_LIBRARIES} + # ${BOOST_LIBRARIES} + + # USER! : Add here those agmonst the various (?) PROJECT LIBRARIES + # you need for the current executable + # (If you created only one Library, don't forget it !...) + + mySampleLib + + ) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# USER! : UNCOMMENT NEXT LINE IF YOU WANT A CONSOLE ON WINDOWS +# NB : YOUR MAIN MUST BE ADAPTED ALSO +# SEE THE MACRO CREA_WXMAIN_WITH_CONSOLE IN creaWx.h +#SET(${EXE_NAME}_CONSOLE TRUE) +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# CREATES AND INSTALLS THE EXE +CREA_ADD_EXECUTABLE( ${EXE_NAME} ) +#---------------------------------------------------------------------------- + + diff --git a/appli/creaNewProject/NewProject/appli/myFierceAppli/main.cxx b/appli/creaNewProject/NewProject/appli/myFierceAppli/main.cxx new file mode 100644 index 0000000..870943d --- /dev/null +++ b/appli/creaNewProject/NewProject/appli/myFierceAppli/main.cxx @@ -0,0 +1,32 @@ +#include +#include "myFierceClass.h" +#include "myFierceClass2.h" +#include // for std::cout +int main() +{ + printf("..Hi..!\n"); + + double u=5.; + double v=10.; + + // + // dummy example + // + myFierceClass A; + double p1=A.Calculate(u, v); + std::cout << "result from myFierceClass :" << p1 << std::endl; + + // + // dummy example + // with Setters and Getters + // + + myFierceClass2 B; + B.SetX(u); + B.SetY(v); + B.Execute(); + double p2=B.GetPercent(); + std::cout << "result from myFierceClass2 :" << p2 << std::endl; + + return 0; +} diff --git a/appli/creaNewProject/NewProject/lib/CMakeLists.txt b/appli/creaNewProject/NewProject/lib/CMakeLists.txt index dd38a15..5d46bdb 100644 --- a/appli/creaNewProject/NewProject/lib/CMakeLists.txt +++ b/appli/creaNewProject/NewProject/lib/CMakeLists.txt @@ -2,12 +2,13 @@ # USER! : Set the library name (global one) - SET(LIBRARY_NAME ___Library_name___here___) + SET(LIBRARY_NAME mySampleLib) + # SET(LIBRARY_NAME ___Library_name___here___) SET(LIBRARY_NAME_BASE ${LIBRARY_NAME} ) SET(${LIBRARY_NAME}_INSTALL_FOLDER ${LIBRARY_NAME}) - + # USER! : Give the list of your Libraries - + SET(${LIBRARY_NAME}_LIBRARIES ___Your_library_one___here___ ___Your_library_two___here___ @@ -18,9 +19,9 @@ SET(${LIBRARY_NAME}_LIBRARIES # USER! : Give the list of directories holding the '.h' and '.txx' to be installed SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_INCLUDE_PATHS - lib/___Your_include_directory_one___here___ - lib/___Your_include_directory_two___here___ - lib/___Your_include_directory_tree___here___ + lib/mySampleLib + # lib/___Your_include_directory_two___here___ + # lib/___Your_include_directory_tree___here___ ) # USER! : Hands off, here! @@ -46,9 +47,9 @@ SET(${LIBRARY_NAME}_LIBRARIES # Invoke the advanced macro CREA_ADVANCED_INSTALL_LIBRARY_FOR_CMAKE(${LIBRARY_NAME}) - + # USER! : Up to you again, now! - + # USER! : Add a ADD_SUBDIRECTORY command for each one of your libraries -# ADD_SUBDIRECTORY(MyLib1) + ADD_SUBDIRECTORY(mySampleLib) -- 2.45.1