simhadteam team mailing list archive
-
simhadteam team
-
Mailing list archive
-
Message #00018
[Branch ~simhadteam/simulationshadrontherapie/G4LPC] Rev 18: Ajout des fichiers "CMake" permettant de compiler les projet avec CMake.
------------------------------------------------------------
revno: 18
committer: Daniel Cussol <cussol@xxxxxxxx>
branch nick: G4LPC
timestamp: Mon 2013-04-22 15:54:25 +0200
message:
Ajout des fichiers "CMake" permettant de compiler les projet avec CMake.
Compilation de G4LPC --> CMakeLists.txt
Compilation d'un projet base sur G4LPC --> CMakeG4LPC.cmake
added:
CMakeG4LPC.cmake
CMakeLists.txt
--
lp:simulationshadrontherapie/g4lpc
https://code.launchpad.net/~simhadteam/simulationshadrontherapie/G4LPC
Your team Simulateurs pour la Hadronthérapie is subscribed to branch lp:simulationshadrontherapie/g4lpc.
To unsubscribe from this branch go to https://code.launchpad.net/~simhadteam/simulationshadrontherapie/G4LPC/+edit-subscription
=== added file 'CMakeG4LPC.cmake'
--- CMakeG4LPC.cmake 1970-01-01 00:00:00 +0000
+++ CMakeG4LPC.cmake 2013-04-22 13:54:25 +0000
@@ -0,0 +1,121 @@
+#module pour CMake: fabriquer une bibliotheque et un executable GEANT4
+#----------------------------------------------------------------------------
+# Setup the project
+message(
+ "\n---> Module ${module}"
+)
+
+project(${module})
+
+#----------------------------------------------------------------------------
+# first rename "GNUmakefile" if it already exists
+#
+if(EXISTS GNUmakefile)
+ message("Renaming GNUmakefile to GNUmakefileOldStyle")
+ file(RENAME GNUmakefile GNUmakefileOldStyle)
+endif()
+
+#----------------------------------------------------------------------------
+# Find Geant4 package, no UI and Vis drivers activated
+#
+
+set(Geant4_DIR $ENV{G4LIB})
+
+message("G4 version = $ENV{G4VERSION}")
+message("G4 directory = ${Geant4_DIR}")
+find_package(Geant4 REQUIRED)
+set(Geant4_INCLUDE_DIR $ENV{G4INCLUDE})
+message("G4 include = ${Geant4_INCLUDE_DIR}")
+
+#----------------------------------------------------------------------------
+# Set ROOT directories
+#
+set(ROOTSYS $ENV{ROOTSYS})
+execute_process(
+ COMMAND root-config --incdir
+ OUTPUT_VARIABLE root_inc_dir
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+execute_process(
+ COMMAND root-config --libs
+ OUTPUT_VARIABLE root_libs
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+set(root_libs "${root_libs} -lMinuit")
+message("root_libs = "${root_libs})
+
+set(CMAKE_INSTALL_PREFIX $ENV{G4WORKDIR})
+
+#----------------------------------------------------------------------------
+# Set additional compiler options
+#
+add_definitions("-Wno-unused -Wno-ignored-qualifiers")
+
+#----------------------------------------------------------------------------
+# Setup Geant4 include directories and compile definitions
+#
+include(${Geant4_USE_FILE})
+
+#----------------------------------------------------------------------------
+# Setup G4LPC libs
+#
+set(G4LPC_libs $ENV{G4WORKDIR}/lib-$ENV{G4VERSION}/libG4LPC.so)
+set(mod_libs $ENV{G4WORKDIR}/lib-$ENV{G4VERSION}/lib${module}.so)
+
+
+#----------------------------------------------------------------------------
+# Locate sources and headers for this project
+#
+
+file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
+file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
+include_directories(${PROJECT_SOURCE_DIR}/include
+ ${Geant4_INCLUDE_DIR}
+ ${root_inc_dir}
+ $ENV{G4WORKDIR}/MesApplis/G4LPC/include
+ )
+
+file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
+file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
+
+#----------------------------------------------------------------------------
+# Add the library to the project targets
+#
+add_library(
+ ${module}
+ SHARED
+ ${sources}
+ ${headers}
+)
+
+
+#----------------------------------------------------------------------------
+# Add the executable, and link it to the Geant4 libraries
+#
+add_executable(exe${module} ${module}.cc)
+target_link_libraries(${module} ${G4LPC_libs}
+ ${Geant4_LIBRARIES}
+ ${root_libs}
+ ${FMH_libs}
+ -Wl,--no-as-needed)
+
+target_link_libraries(exe${module} ${module}
+ ${G4LPC_libs}
+ ${Geant4_LIBRARIES}
+ ${root_libs}
+ -Wl,--no-as-needed)
+
+#----------------------------------------------------------------------------
+# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
+#
+install(TARGETS ${module}
+ DESTINATION $ENV{G4WORKDIR}/lib-$ENV{G4VERSION}/
+ PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE)
+install(FILES exe${module}
+ DESTINATION $ENV{G4WORKDIR}/exe-$ENV{G4VERSION}/
+ PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
+ RENAME ${module})
+install(CODE "file(REMOVE lib${module}.so)")
+install(CODE "file(REMOVE exe${module})")
=== added file 'CMakeLists.txt'
--- CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ CMakeLists.txt 2013-04-22 13:54:25 +0000
@@ -0,0 +1,93 @@
+#----------------------------------------------------------------------------
+# Setup the project
+cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
+project(G4LPC)
+
+#----------------------------------------------------------------------------
+# Find Geant4 package, no UI and Vis drivers activated
+#
+set(Geant4_DIR $ENV{G4LIB})
+
+message("G4 version = $ENV{G4VERSION}")
+message("G4 directory = ${Geant4_DIR}")
+
+find_package(Geant4 REQUIRED)
+
+#----------------------------------------------------------------------------
+# Set ROOT directories
+#
+set(ROOTSYS $ENV{ROOTSYS})
+execute_process(
+ COMMAND root-config --incdir
+ OUTPUT_VARIABLE root_inc_dir
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+execute_process(
+ COMMAND root-config --libs
+ OUTPUT_VARIABLE root_libs
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+set(root_libs "${root_libs} -lMinuit -lGed -lTreePlayer -lEG -lGeom -lRGL -lGui -lEve")
+message("root_libs = "${root_libs})
+
+set(CMAKE_INSTALL_PREFIX $ENV{G4WORKDIR})
+
+#----------------------------------------------------------------------------
+# Set additional compiler options
+#
+add_definitions("-Wno-unused -Wno-ignored-qualifiers")
+
+#----------------------------------------------------------------------------
+# Setup Geant4 include directories and compile definitions
+#
+include(${Geant4_USE_FILE})
+
+#----------------------------------------------------------------------------
+# Setup G4LPC libs
+#
+set(G4LPC_libs $ENV{G4WORKDIR}/lib-$ENV{G4VERSION}/libG4LPC.so)
+
+
+#----------------------------------------------------------------------------
+# Locate sources and headers for this project
+#
+include_directories(${PROJECT_SOURCE_DIR}/include
+ ${Geant4_INCLUDE_DIR}
+ ${root_inc_dir}
+ )
+file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
+file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
+
+#----------------------------------------------------------------------------
+# Add the library to the project targets
+#
+add_library(
+ G4LPC
+ SHARED
+ ${sources}
+ ${headers}
+)
+
+
+#----------------------------------------------------------------------------
+# Add the executable, and link it to the Geant4 libraries
+#
+add_executable(exeG4LPC G4LPC.cc)
+target_link_libraries(exeG4LPC ${G4LPC_libs}
+ ${Geant4_LIBRARIES}
+ ${root_libs}
+ -Wl,--no-as-needed)
+
+
+
+#----------------------------------------------------------------------------
+# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
+#
+install(TARGETS G4LPC DESTINATION $ENV{G4WORKDIR}/lib-$ENV{G4VERSION}/)
+install(FILES exeG4LPC
+ DESTINATION $ENV{G4WORKDIR}/exe-$ENV{G4VERSION}/
+ RENAME G4LPC)
+install(CODE "file(REMOVE libG4LPC.so)")
+install(CODE "file(REMOVE exeG4LPC)")