cmake_minimum_required (VERSION 3.8)

set(EIGEN3
	"Eigen/Eigen"
)

set(JSON
	"nlohmann/json.hpp"
	"nlohmann/json_fwd.hpp"
)

set(PARSER
	"parser/mpCompat.h"
	"parser/mpDefines.h"
	"parser/mpError.cpp"
	"parser/mpError.h"
	"parser/mpFuncCmplx.cpp"
	"parser/mpFuncCmplx.h"
	"parser/mpFuncCommon.cpp"
	"parser/mpFuncCommon.h"
	"parser/mpFuncMatrix.cpp"
	"parser/mpFuncMatrix.h"
	"parser/mpFuncNonCmplx.cpp"
	"parser/mpFuncNonCmplx.h"
	"parser/mpFuncStr.cpp"
	"parser/mpFuncStr.h"
	"parser/mpFwdDecl.h"
	"parser/mpICallback.cpp"
	"parser/mpICallback.h"
	"parser/mpIfThenElse.cpp"
	"parser/mpIfThenElse.h"
	"parser/mpIOprt.cpp"
	"parser/mpIOprt.h"
	"parser/mpIOprtBinShortcut.cpp"
	"parser/mpIOprtBinShortcut.h"
	"parser/mpIPackage.cpp"
	"parser/mpIPackage.h"
	"parser/mpIPrecedence.h"
	"parser/mpIToken.cpp"
	"parser/mpIToken.h"
	"parser/mpIValReader.cpp"
	"parser/mpIValReader.h"
	"parser/mpIValue.cpp"
	"parser/mpIValue.h"
	"parser/mpMatrix.h"
	"parser/mpMatrixError.h"
	"parser/mpOprtBinAssign.cpp"
	"parser/mpOprtBinAssign.h"
	"parser/mpOprtBinCommon.cpp"
	"parser/mpOprtBinCommon.h"
	"parser/mpOprtBinShortcut.cpp"
	"parser/mpOprtBinShortcut.h"
	"parser/mpOprtCmplx.cpp"
	"parser/mpOprtCmplx.h"
	"parser/mpOprtIndex.cpp"
	"parser/mpOprtIndex.h"
	"parser/mpOprtMatrix.cpp"
	"parser/mpOprtMatrix.h"
	"parser/mpOprtNonCmplx.cpp"
	"parser/mpOprtNonCmplx.h"
	"parser/mpOprtPostfixCommon.cpp"
	"parser/mpOprtPostfixCommon.h"
	"parser/mpPackageCmplx.cpp"
	"parser/mpPackageCmplx.h"
	"parser/mpPackageCommon.cpp"
	"parser/mpPackageCommon.h"
	"parser/mpPackageMatrix.cpp"
	"parser/mpPackageMatrix.h"
	"parser/mpPackageNonCmplx.cpp"
	"parser/mpPackageNonCmplx.h"
	"parser/mpPackageStr.cpp"
	"parser/mpPackageStr.h"
	"parser/mpPackageUnit.cpp"
	"parser/mpPackageUnit.h"
	"parser/mpParser.cpp"
	"parser/mpParser.h"
	"parser/mpParserBase.cpp"
	"parser/mpParserBase.h"
	"parser/mpParserMessageProvider.cpp"
	"parser/mpParserMessageProvider.h"
	"parser/mpRPN.cpp"
	"parser/mpRPN.h"
	"parser/mpScriptTokens.cpp"
	"parser/mpScriptTokens.h"
	"parser/mpStack.h"
	"parser/mpTest.cpp"
	"parser/mpTest.h"
	"parser/mpTokenReader.cpp"
	"parser/mpTokenReader.h"
	"parser/mpTypes.h"
	"parser/mpValReader.cpp"
	"parser/mpValReader.h"
	"parser/mpValue.cpp"
	"parser/mpValue.h"
	"parser/mpValueCache.cpp"
	"parser/mpValueCache.h"
	"parser/mpVariable.cpp"
	"parser/mpVariable.h"
	"parser/suSortPred.h"
	"parser/suStringTokens.h"
	"parser/utGeneric.h"
)

set(COMMON
	"common/define.h"
	"common/util.cpp"
	"common/util.h"
)

set(GAUSS
	"function/Gauss.h"
	"function/Gauss.cpp"
	"function/Gauss_Line.h"
	"function/Gauss_Prism.h"
	"function/Gauss_Quadrangle.h"
	"function/Gauss_Tetrahedron.h"
	"function/Gauss_Triangle.h"
)

set(BF
	"function/BF.h"
	"function/BF.cpp"
	"function/BF_Line.cpp"
	"function/BF_Prism.cpp"
	"function/BF_Quadrangle.cpp"
	"function/BF_Tetrahedron.cpp"
	"function/BF_Triangle.cpp"
)

set(MESH
	"mesh/Mesh_Base.cpp"
	"mesh/Mesh_Base.h"
	"mesh/Mesh_Find.cpp"
	"mesh/Mesh_Interface.cpp"
)

set(MATERIAL
	"material/Material_Base.h"
	"material/Material_Base.cpp"
	"material/Material_Interface.cpp"
)

set(PHY
	"phy/Phy_Base.h"
	"phy/Phy_Base.cpp"
	"phy/Phy_Interface.cpp"
)

set(SOLVER
	"solver/Solver_Base.cpp"
	"solver/Solver_Base.h"
	"solver/interface.cpp"
	"solver/interface.h"
	"solver/framework.h"
	"solver/Solver_Interface.cpp"
	"solver/eigen_solver.h"
	"solver/eigen_solver.cpp"
)

set(POST
	"post/Post_Base.h"
	"post/Post_Base.cpp"
	"post/Post_Power.cpp"
	"post/Post_CalEletric.cpp"
	"post/Post_Output.cpp"
)

set(KERNEL
	"kernel/Assemble_Base.h"
	"kernel/Assemble_Base.cpp"
	"kernel/Assemble_EigenFreq_Boundary.cpp"
	"kernel/Assemble_EigenFreq_Equation.cpp"
	"kernel/Assemble_EigenMode_Boundary.cpp"
	"kernel/Assemble_EigenMode_Equation.cpp"
	"kernel/Assemble_kernel.cpp"
	"kernel/Assemble_Scatter_2D_Boundary.cpp"
	"kernel/Assemble_Scatter_3D_Boundary.cpp"
	
	"kernel/Assemble_Scatter_Equation.cpp"
	
)

set(TEST
	"test/Test_ReadData.cpp"
	"test/Test_OutputData.cpp"
	"test/interfaceClass.h"
)

set(INTERFACE
	"Interface/FEM_Interface.h"
	"Interface/FEM_Interface.cpp"
)

add_executable (OpticsFEM "test/Test_Main.cpp" ${EIGEN3} ${JSON} ${PARSER} ${COMMON} ${GAUSS} ${BF} ${MESH} ${MATERIAL} ${PHY} ${SOLVER} ${POST} ${KERNEL} ${TEST} ${INTERFACE} "post/Post_GetEb.cpp")

#add_library (OpticsFEM SHARED ${EIGEN3} ${JSON} ${PARSER} ${COMMON} ${GAUSS} ${BF} ${MESH} ${MATERIAL} ${PHY} ${SOLVER} ${POST} ${KERNEL} ${TEST} ${INTERFACE})

# 静态链接 eigen_solver.cpp，不再依赖 lib/eigensolver.lib
target_compile_definitions(OpticsFEM PRIVATE EIGENSOLVER_STATIC)

set(CMAKE_CXX_STANDARD 17)
