diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7dc9fbc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,126 @@ + +PROJECT(openEMS CXX) +cmake_minimum_required(VERSION 2.8) + +# add git revision +IF(EXISTS ${PROJECT_SOURCE_DIR}/.git ) + FIND_PACKAGE(Git) + # Get the latest abbreviated commit hash of the working branch + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --tags + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE GITREV + ) + set(VERSION ${GITREV}) + string(STRIP ${VERSION} VERSION) + message(STATUS "Found Git repository, ${PROJECT_NAME} version tag: ${VERSION}") +ENDIF() + +ADD_DEFINITIONS(-DGIT_VERSION=\"${VERSION}\") + +# Set locations of extra CMake modules +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${openEMS_SOURCE_DIR}/cmake/modules/") + +# TinyXML module from https://github.com/ros/cmake_modules +find_package(TinyXML REQUIRED) +ADD_DEFINITIONS( -DTIXML_USE_STL ) + +find_package(HDF5 REQUIRED) +INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIR}) + +# hdf5 compat +ADD_DEFINITIONS( -DH5_USE_16_API ) + +find_package(Boost 1.46 COMPONENTS + thread + system + date_time + serialization + chrono +) + +find_package(VTK REQUIRED) + +if("${VTK_MAJOR_VERSION}" EQUAL 5) + set( vtk_LIBS + vtkCommon + vtkFiltering + vtkGraphics + vtkHybrid + vtkIO + vtkRendering + vtkWidgets + QVTK + ) +endif() + + +if("${VTK_MAJOR_VERSION}" EQUAL 6) + set( vtk_LIBS + vtkCommonCore + vtkCommonDataModel + vtkIOLegacy + vtkIOXML + vtkIOGeometry + vtkIOPLY + vtksys + vtkIOCore +) +endif() + +if(VTK_FOUND) + message(STATUS "Found package VTK. Using " ${VTK_USE_FILE}) + include(${VTK_USE_FILE}) +else(VTK_FOUND) + message(FATAL_ERROR "VTK not found. Please set VTK_DIR.") +endif(VTK_FOUND) + +INCLUDE_DIRECTORIES (${VTK_INCLUDE_DIR}) + +#message(status "vtk libs: ${vtk_LIBS}") + +# independent tool +ADD_SUBDIRECTORY( nf2ff ) + +# libs +ADD_SUBDIRECTORY( tools ) +ADD_SUBDIRECTORY( FDTD ) +ADD_SUBDIRECTORY( FDTD/extensions ) + +# depend on CSXCAD +ADD_SUBDIRECTORY( Common ) + +# main program +set(SOURCES + main.cpp + openems.cpp +) + + +INCLUDE_DIRECTORIES( ${openEMS_SOURCE_DIR} ) #find tools +INCLUDE_DIRECTORIES( ${CSXCAD_SOURCE_DIR}/src ) #find ContinuousStructure.h + + +ADD_EXECUTABLE( openEMS ${SOURCES} ) + +TARGET_LINK_LIBRARIES( openEMS + fparser + CSXCAD + FDTD + Common + tools + extensions + tinyxml + hdf5 + hdf5_hl + #${HDF_LIBRARIES} + ${Boost_LIBRARIES} + #${VTK_LIBRARIES} + ${vtk_LIBS} +) + +INSTALL( TARGETS openEMS DESTINATION bin ) + +INSTALL( DIRECTORY matlab DESTINATION share/openEMS ) + +# TODO mpi, tarball, debug, release diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt new file mode 100644 index 0000000..145374a --- /dev/null +++ b/Common/CMakeLists.txt @@ -0,0 +1,22 @@ + +INCLUDE_DIRECTORIES( ${openEMS_SOURCE_DIR} ) +INCLUDE_DIRECTORIES( ${CSXCAD_SOURCE_DIR}/src ) + +set( SOURCES + engine_interface_base.cpp + operator_base.cpp + processcurrent.cpp + processfieldprobe.cpp + processfields.cpp + processfields_fd.cpp + processfields_sar.cpp + processfields_td.cpp + processing.cpp + processintegral.cpp + processmodematch.cpp + processvoltage.cpp +) + +# Common lib +add_library( Common ${SOURCES} ) + diff --git a/FDTD/CMakeLists.txt b/FDTD/CMakeLists.txt new file mode 100644 index 0000000..598a1d7 --- /dev/null +++ b/FDTD/CMakeLists.txt @@ -0,0 +1,26 @@ + +INCLUDE_DIRECTORIES( ${openEMS_SOURCE_DIR} ) +INCLUDE_DIRECTORIES( ${CSXCAD_SOURCE_DIR}/src ) + +set(SOURCES + engine.cpp + operator.cpp + engine_multithread.cpp + operator_cylinder.cpp + engine_cylinder.cpp + engine_sse.cpp + operator_sse.cpp + operator_sse_compressed.cpp + engine_sse_compressed.cpp + operator_multithread.cpp + excitation.cpp + operator_cylindermultigrid.cpp + engine_cylindermultigrid.cpp + engine_interface_fdtd.cpp + engine_interface_sse_fdtd.cpp + engine_interface_cylindrical_fdtd.cpp +) + +# FDTD lib +add_library( FDTD ${SOURCES} ) + diff --git a/FDTD/extensions/CMakeLists.txt b/FDTD/extensions/CMakeLists.txt new file mode 100644 index 0000000..575c6a8 --- /dev/null +++ b/FDTD/extensions/CMakeLists.txt @@ -0,0 +1,28 @@ + +INCLUDE_DIRECTORIES( ${openEMS_SOURCE_DIR} ) +INCLUDE_DIRECTORIES( ${CSXCAD_SOURCE_DIR}/src ) + +set(SOURCES + engine_extension.cpp + operator_ext_dispersive.cpp + operator_ext_lorentzmaterial.cpp + operator_ext_conductingsheet.cpp + engine_ext_dispersive.cpp + engine_ext_lorentzmaterial.cpp + engine_ext_cylindermultigrid.cpp + operator_ext_upml.cpp + engine_ext_upml.cpp + operator_extension.cpp + engine_ext_mur_abc.cpp + operator_ext_mur_abc.cpp + operator_ext_cylinder.cpp + engine_ext_cylinder.cpp + operator_ext_excitation.cpp + engine_ext_excitation.cpp + operator_ext_tfsf.cpp + engine_ext_tfsf.cpp +) + +# FDTD/extensions lib +add_library( extensions ${SOURCES} ) + diff --git a/cmake/Modules/FindTinyXML.cmake b/cmake/Modules/FindTinyXML.cmake new file mode 100644 index 0000000..aabb323 --- /dev/null +++ b/cmake/Modules/FindTinyXML.cmake @@ -0,0 +1,74 @@ +################################################################################################## +# +# CMake script for finding TinyXML. +# +# Input variables: +# +# - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in +# ${TinyXML_ROOT_DIR}/include +# ${TinyXML_ROOT_DIR}/libs +# respectively, and the default CMake search order will be ignored. When unspecified, the default +# CMake search order is used. +# This variable can be specified either as a CMake or environment variable. If both are set, +# preference is given to the CMake variable. +# Use this variable for finding packages installed in a nonstandard location, or for enforcing +# that one of multiple package installations is picked up. +# +# +# Cache variables (not intended to be used in CMakeLists.txt files) +# +# - TinyXML_INCLUDE_DIR: Absolute path to package headers. +# - TinyXML_LIBRARY: Absolute path to library. +# +# +# Output variables: +# +# - TinyXML_FOUND: Boolean that indicates if the package was found +# - TinyXML_INCLUDE_DIRS: Paths to the necessary header files +# - TinyXML_LIBRARIES: Package libraries +# +# +# Example usage: +# +# find_package(TinyXML) +# if(NOT TinyXML_FOUND) +# # Error handling +# endif() +# ... +# include_directories(${TinyXML_INCLUDE_DIRS} ...) +# ... +# target_link_libraries(my_target ${TinyXML_LIBRARIES}) +# +################################################################################################## + +# Get package location hint from environment variable (if any) +if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR}) + set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH + "TinyXML base directory location (optional, used for nonstandard installation paths)") +endif() + +# Search path for nonstandard package locations +if(TinyXML_ROOT_DIR) + set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH) + set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH) +endif() + +# Find headers and libraries +find_path(TinyXML_INCLUDE_DIR NAMES tinyxml.h PATH_SUFFIXES "tinyxml" ${TinyXML_INCLUDE_PATH}) +find_library(TinyXML_LIBRARY NAMES tinyxml PATH_SUFFIXES "tinyxml" ${TinyXML_LIBRARY_PATH}) + +mark_as_advanced(TinyXML_INCLUDE_DIR + TinyXML_LIBRARY) + +# Output variables generation +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TinyXML DEFAULT_MSG TinyXML_LIBRARY + TinyXML_INCLUDE_DIR) + +set(TinyXML_FOUND ${TINYXML_FOUND}) # Enforce case-correctness: Set appropriately cased variable... +unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args + +if(TinyXML_FOUND) + set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR}) + set(TinyXML_LIBRARIES ${TinyXML_LIBRARY}) +endif() diff --git a/nf2ff/CMakeLists.txt b/nf2ff/CMakeLists.txt new file mode 100644 index 0000000..b8f0dfa --- /dev/null +++ b/nf2ff/CMakeLists.txt @@ -0,0 +1,28 @@ + +PROJECT(nf2ff CXX) +cmake_minimum_required(VERSION 2.8) + +set(SOURCES + main.cpp + nf2ff.cpp + nf2ff_calc.cpp +) + +set(HEADERS + nf2ff.h + nf2ff_calc.h +) + +ADD_EXECUTABLE( nf2ff ${SOURCES} ) + +TARGET_LINK_LIBRARIES( nf2ff + tools + tinyxml + ${HDF5_LIBRARIES} + ${Boost_LIBRARIES} +) + +INSTALL(TARGETS nf2ff DESTINATION bin) + + +#TODO tarball, debug, release diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..45ad321 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,27 @@ + +set(SOURCES + AdrOp.cpp + ErrorMsg.cpp + ExpenseLog.cpp + array_ops.cpp + global.cpp + hdf5_file_reader.cpp + hdf5_file_writer.cpp + sar_calculation.cpp + useful.cpp + vtk_file_writer.cpp +) + +#set(HEADERS +# constants.h +# array_ops.h +# global.h +# useful.h +# aligned_allocator.h +# hdf5_file_reader.h +# hdf5_file_writer.h +#) + +# tools lib +add_library(tools ${SOURCES} ) +