Commit 9bcb7350dadef5e69517d92019903f150c42d63b

Authored by Benjamin Renard
1 parent 34bec609
Exists in master

Improve libcain compilation

cainlib/CMakeLists.txt
... ... @@ -8,6 +8,17 @@ set(CMAKE_BUILD_TYPE Release)
8 8  
9 9 set(CMAKE_CXX_FLAGS "-O3 -fPIC -fno-align-commons -fbounds-check -fbacktrace -ffixed-form")
10 10  
  11 +if(NOT DEFINED ENV{CAIN_COEF_DIR})
  12 + set(CAIN_COEF_DIR "${CMAKE_SOURCE_DIR}/src/")
  13 +else()
  14 + set(CAIN_COEF_DIR "$ENV{CAIN_COEF_DIR}")
  15 +endif()
  16 +
  17 +configure_file (
  18 + "${CMAKE_SOURCE_DIR}/src/cain.f90.in"
  19 + "${CMAKE_SOURCE_DIR}/src/cain.f90"
  20 +)
  21 +
11 22 file(
12 23 GLOB
13 24 source_files
... ... @@ -20,3 +31,6 @@ SET_TARGET_PROPERTIES(cainlib PROPERTIES LINKER_LANGUAGE CXX)
20 31  
21 32 install (TARGETS cainlib DESTINATION lib)
22 33 install (FILES src/include/cainlib.hh DESTINATION include)
  34 +if(DEFINED ENV{CAIN_COEF_DIR})
  35 + install (FILES src/FSU_mars90 DESTINATION ${CAIN_COEF_DIR})
  36 +endif()
... ...
cainlib/src/cain.in renamed to cainlib/src/cain.f90.in
... ... @@ -14,8 +14,7 @@
14 14 !-------------------------------------------------------------
15 15 implicit real (kind=8) (a-h,o-z)
16 16 external cread, gfield
17   - character(2000) :: coeffs_cain_file ="_path_&
18   - &/FSU_mars90"
  17 + character(2000) :: coeffs_cain_file ="@CAIN_COEF_DIR@/FSU_mars90"
19 18 integer l
20 19 common /trace/rm, maxln
21 20 ! real dlat,dlong,alt,Btt,Bpp,Brr,Bx,By,Bz,B
... ...
cainlib/src/postcompil.sh deleted
... ... @@ -1,3 +0,0 @@
1   -#!/bin/bash
2   -FULL_PATH="$(realpath "${0}" | xargs dirname)"
3   -rm -f $FULL_PATH/cain.f90
cainlib/src/precompil.sh deleted
... ... @@ -1,5 +0,0 @@
1   -#!/bin/bash
2   -FULL_PATH="$(realpath "${0}" | xargs dirname)"
3   -currentPath=$(echo $FULL_PATH | sed 's_/_\\/_g')
4   -cp $FULL_PATH/cain.in $FULL_PATH/cain.f90
5   -sed -i -e "s/_path_/${currentPath}/g" $FULL_PATH/cain.f90