###  CMakeLists.txt ---

#  Author(s): Christophe Prud'homme <christophe.prudhomme@ujf-grenoble.fr>
#       Date: 2010-06-12
#
#  Copyright (C) 2010 Universite Joseph Fourier (Grenoble I)
#
# Distributed under the GPL(GNU Public License):
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(gen_feel_perf_stokes ALL )
foreach(S "Simplex" "Hypercube")
set( CR1P0 "// this file is automatically generated
#include <stokes.hpp>
namespace Feel{
 template class Stokes<2, CrouzeixRaviart<1, Vectorial>,Lagrange<0, Scalar,Discontinuous>, ${S}>\\;
}
")
OVERWITE_IF_DIFFERENT(gen_feel_perf_stokes "feel_perf_stokes_${S}_cr1p0.cpp" "${CR1P0}" stokes.hpp)
set(cr1p0 "${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_${S}_cr1p0.cpp;${cr1p0}")
endforeach()

#foreach(N 2 3 4 5)
foreach(S "Simplex" "Hypercube")
foreach(D 2)
  foreach(N 2 5 )
    math (EXPR P '${N}-1')
    set( LAG "// this file is automatically generated
#include <stokes.hpp>
namespace Feel {
  template class Stokes<${D}, Lagrange<${N}, Vectorial>,Lagrange<${P}, Scalar>, ${S}>\\;
}
")
    OVERWITE_IF_DIFFERENT(gen_feel_perf_stokes "feel_perf_stokes_${S}_${D}D_p${N}p${P}.cpp" "${LAG}" stokes.hpp)
    set(taylor_hood "${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_${S}_${D}D_p${N}p${P}.cpp;${taylor_hood}")
  endforeach()
endforeach()
endforeach()

#add_executable(feel_perf_stokes  ${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_cr1p0.cpp ${taylor_hood}  bench.cpp)
add_executable(feel_perf_stokes  ${taylor_hood} ${cr1p0}  bench.cpp)
#add_executable(feel_perf_stokes  ${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_cr1p0.cpp  bench.cpp)
#add_executable(feel_perf_stokes  ${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_Hypercube_2D_p2p1.cpp ${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_Hypercube_cr1p0.cpp bench.cpp)
#add_executable(feel_perf_stokes  ${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_Hypercube_cr1p0.cpp bench.cpp)
#add_executable(feel_perf_stokes  ${taylor_hood}   bench.cpp)
add_dependencies(feel_perf_stokes gen_feel_perf_stokes)
#add_executable(feel_perf_stokes  ${CMAKE_CURRENT_BINARY_DIR}/feel_perf_stokes_cr1p0.cpp  bench.cpp)
#target_link_libraries(feel_perf_stokes ${FEELPP_LIBRARIES} /opt/local/lib/libprofiler.dylib)
target_link_libraries(feel_perf_stokes ${FEELPP_LIBRARIES})


configure_file(stokes.cfg stokes.cfg)




# add_executable(feel_perf_stokes_s  stokes_bench.cpp )
# add_executable(feel_perf_stokes_hc  stokes_bench_hc.cpp )
# target_link_libraries(feel_perf_stokes_s ${FEELPP_LIBRARIES} )
# target_link_libraries(feel_perf_stokes_hc ${FEELPP_LIBRARIES} )

