cmake: improve build system and support win32

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/13/head
Thorsten Liebig 2015-05-19 22:13:28 +02:00
parent 0a74792424
commit 29ffbb66ab
7 changed files with 36 additions and 21 deletions

View File

@ -66,13 +66,19 @@ INCLUDE_DIRECTORIES( ${FPARSER_ROOT_DIR}/include )
# CSXCAD # CSXCAD
# $ cmake -D CSXCAD_ROOT_DIR=~/opt/openEMS . # $ cmake -D CSXCAD_ROOT_DIR=~/opt/openEMS .
# SET(CSXCAD_ROOT_DIR ~/opt/openEMS) # SET(CSXCAD_ROOT_DIR ~/opt/openEMS)
find_library(CSXCAD_LIBRARIES NAMES CSXCAD find_library(CSXCAD_LIBRARIES
HINTS NAMES CSXCAD
${CSXCAD_ROOT_DIR}/lib HINTS ${CSXCAD_ROOT_DIR}/lib
) )
message(STATUS "CSXCAD: ${CSXCAD_LIBRARIES}" ) message(STATUS "CSXCAD_LIBRARIES: ${CSXCAD_LIBRARIES}" )
#TODO test if CSXCADs was found #TODO test if CSXCADs was found
INCLUDE_DIRECTORIES( ${CSXCAD_ROOT_DIR}/include/CSXCAD ) find_path(CSXCAD_INCLUDE_DIR
NAMES ContinuousStructure.h
HINTS ${CSXCAD_ROOT_DIR}/include
PATH_SUFFIXES "CSXCAD" ${CSXCAD_INCLUDE_DIR}
)
message(STATUS "CSXCAD_INCLUDE_DIR: ${CSXCAD_INCLUDE_DIR}" )
INCLUDE_DIRECTORIES( ${CSXCAD_INCLUDE_DIR} )
# TinyXML module from https://github.com/ros/cmake_modules # TinyXML module from https://github.com/ros/cmake_modules
find_package(TinyXML REQUIRED) find_package(TinyXML REQUIRED)
@ -96,7 +102,14 @@ find_package(Boost 1.46 COMPONENTS
) )
# vtk # vtk
if (WIN32)
find_package(VTK 6.1 REQUIRED)
else()
# prefer >=6.1, fallback to >=5.4
find_package(VTK REQUIRED) find_package(VTK REQUIRED)
endif()
message(STATUS "Found package VTK. Using version " ${VTK_VERSION})
if("${VTK_MAJOR_VERSION}" EQUAL 6) if("${VTK_MAJOR_VERSION}" EQUAL 6)
set( vtk_LIBS set( vtk_LIBS
vtkCommonCore vtkCommonCore
@ -105,7 +118,6 @@ if("${VTK_MAJOR_VERSION}" EQUAL 6)
vtkIOXML vtkIOXML
vtkIOGeometry vtkIOGeometry
vtkIOPLY vtkIOPLY
vtkIOMPIParallel
vtksys vtksys
vtkIOCore vtkIOCore
) )
@ -122,10 +134,13 @@ else()
) )
endif() endif()
message(STATUS "Found package VTK. Using version " ${VTK_VERSION})
include(${VTK_USE_FILE}) include(${VTK_USE_FILE})
INCLUDE_DIRECTORIES (${VTK_INCLUDE_DIR}) INCLUDE_DIRECTORIES (${VTK_INCLUDE_DIR})
if(WIN32)
set(CMAKE_CXX_FLAGS "-msse")
endif()
# independent tool # independent tool
ADD_SUBDIRECTORY( nf2ff ) ADD_SUBDIRECTORY( nf2ff )
@ -155,16 +170,17 @@ TARGET_LINK_LIBRARIES( openEMS
${CSXCAD_LIBRARIES} ${CSXCAD_LIBRARIES}
${fparser_LIBRARIES} ${fparser_LIBRARIES}
tinyxml tinyxml
hdf5 ${HDF5_LIBRARIES}
hdf5_hl
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${vtk_LIBS} ${vtk_LIBS}
) )
INSTALL( TARGETS openEMS DESTINATION bin ) INSTALL( TARGETS openEMS DESTINATION bin )
if (UNIX)
INSTALL( FILES openEMS.sh INSTALL( FILES openEMS.sh
DESTINATION bin DESTINATION bin
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
endif ()
INSTALL( DIRECTORY matlab DESTINATION share/openEMS ) INSTALL( DIRECTORY matlab DESTINATION share/openEMS )
# TODO mpi, tarball, debug, release # TODO mpi, tarball, debug, release

View File

@ -17,5 +17,5 @@ set( SOURCES
) )
# Common lib # Common lib
add_library( Common ${SOURCES} ) add_library( Common STATIC ${SOURCES} )

View File

@ -21,5 +21,5 @@ set(SOURCES
) )
# FDTD lib # FDTD lib
add_library( FDTD ${SOURCES} ) add_library( FDTD STATIC ${SOURCES} )

View File

@ -26,9 +26,9 @@
#include <boost/fusion/container/list/list_fwd.hpp> #include <boost/fusion/container/list/list_fwd.hpp>
#include <boost/fusion/include/list_fwd.hpp> #include <boost/fusion/include/list_fwd.hpp>
#ifdef WIN32 //#ifdef WIN32
#include <Winsock2.h> // for struct timeval //#include <Winsock2.h> // for struct timeval
#endif //#endif
#include <sys/time.h> #include <sys/time.h>

View File

@ -26,5 +26,5 @@ set(SOURCES
) )
# FDTD/extensions lib # FDTD/extensions lib
add_library( extensions ${SOURCES} ) add_library( extensions STATIC ${SOURCES} )

View File

@ -25,8 +25,7 @@ ADD_EXECUTABLE( nf2ff ${SOURCES} )
TARGET_LINK_LIBRARIES( nf2ff TARGET_LINK_LIBRARIES( nf2ff
tools tools
tinyxml tinyxml
hdf5 ${HDF5_LIBRARIES}
hdf5_hl
${Boost_LIBRARIES} ${Boost_LIBRARIES}
) )

View File

@ -22,5 +22,5 @@ set(SOURCES
#) #)
# tools lib # tools lib
add_library(tools ${SOURCES} ) add_library(tools STATIC ${SOURCES} )