Parcourir la source

update environment module

Julien Dehos il y a 7 ans
Parent
commit
372c0394f2
3 fichiers modifiés avec 8 ajouts et 8 suppressions
  1. 1 0
      test_module/CMakeLists.txt
  2. 3 6
      test_module/README.md
  3. 4 2
      test_module/mytest.mod

+ 1 - 0
test_module/CMakeLists.txt

@@ -12,5 +12,6 @@ add_executable( mymain.out src/mymain.cpp )
 target_link_libraries( mymain.out mylib )
 
 install( TARGETS mymain.out DESTINATION bin )
+install( FILES mytest.mod DESTINATION modules )
 install( TARGETS mylib DESTINATION lib )
 

+ 3 - 6
test_module/README.md

@@ -3,16 +3,13 @@
 # build and install project
 mkdir build
 cd build
-cmake -DCMAKE_INSTALL_PREFIX=~/opt ..
+cmake -DCMAKE_INSTALL_PREFIX=~/opt/mytest ..
 make -j install
 cd ..
 
-# install environment module
-mkdir -p ~/opt/modules
-cp mytest.mod ~/opt/modules
-
 # use module
-module use ~/opt/modules
+module purge
+module use ~/opt/mytest/modules
 module load mytest.mod
 mymain.out
 ```

+ 4 - 2
test_module/mytest.mod

@@ -6,6 +6,8 @@ proc ModulesHelp { } {
 
 module-whatis "my test module"
 
-append-path  PATH             /nfs/home/lisic/jdehos/opt/bin
-append-path  LD_LIBRARY_PATH  /nfs/home/lisic/jdehos/opt/lib
+set          MYTEST_ROOT       "$::env(HOME)/opt/mytest"
+
+append-path  PATH             $MYTEST_ROOT/bin
+append-path  LD_LIBRARY_PATH  $MYTEST_ROOT/lib