diff --git a/CMakeLists.txt b/CMakeLists.txt index bc18fed28..a99399b3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,5 +44,5 @@ if(BUILD_WITH_CMAKE) endif(BUILD_WITH_CMAKE) if(RUN_TESTS) - include(tests) + include(testFOAM) endif(RUN_TESTS) diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists.txt index 074b2f11a..ed12fb572 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/CMakeLists.txt @@ -7,14 +7,53 @@ # the pqReader.xml file contains xml defining readers with their # file extensions and descriptions. -INCLUDE(${PARAVIEW_USE_FILE}) +# +# We a little hack here to support cmake and wmake-compiled FOAM +# libraries simultaneously. This uses the same trigger as externally +# compiled applications (FOAM_FOUND) +# + +if(NOT FOAM_FOUND) + # Config when compiling FOAM library with wmake + + cmake_minimum_required(VERSION 2.4) + + if(COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) + endif(COMMAND cmake_policy) + + FIND_PACKAGE(ParaView REQUIRED) + INCLUDE(${PARAVIEW_USE_FILE}) + + LINK_DIRECTORIES( + $ENV{FOAM_LIBBIN} + ) + + INCLUDE_DIRECTORIES( + $ENV{WM_PROJECT_DIR}/src/foam/lnInclude + $ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude + $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude + ${PROJECT_SOURCE_DIR}/../vtkPVFoam + ) + + ADD_DEFINITIONS( + -std=c++11 + -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} + ) + + # Set output library destination to plugin folder + SET( + LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH} + CACHE INTERNAL + "Single output directory for building all libraries." + ) +else() + # Config when compiling FOAM library with cmake + + INCLUDE(${PARAVIEW_USE_FILE}) +endif() -# Set output library destination to plugin folder -#SET( -# LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH} -# CACHE INTERNAL -# "Single output directory for building all libraries." -#) # Build the server-side plugin ADD_PARAVIEW_PLUGIN( @@ -23,6 +62,23 @@ ADD_PARAVIEW_PLUGIN( SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx ) -TARGET_LINK_LIBRARIES(PVFoamReader_SM PUBLIC vtkPVFoam pqCore) +if(NOT FOAM_FOUND) + # Config when compiling FOAM library with wmake + + TARGET_LINK_LIBRARIES( + PVFoamReader_SM + foam + finiteVolume + vtkPVFoam + pqCore + ) +else() + # Config when compiling FOAM library with cmake + + TARGET_LINK_LIBRARIES( + PVFoamReader_SM + PUBLIC vtkPVFoam pqCore + ) +endif() #----------------------------------------------------------------------------- diff --git a/cmake/tests.cmake b/cmake/testFOAM.cmake similarity index 98% rename from cmake/tests.cmake rename to cmake/testFOAM.cmake index 4cc4711f1..3e85f8540 100644 --- a/cmake/tests.cmake +++ b/cmake/testFOAM.cmake @@ -1,7 +1,7 @@ # /*-------------------------------------------------------------------------*\ # ========= | # \\ / F ield | foam-extend: Open Source CFD -# \\ / O peration | Version: 4.0 +# \\ / O peration | Version: 4.1 # \\ / A nd | Web: http://www.foam-extend.org # \\/ M anipulation | For copyright notice see file Copyright # ----------------------------------------------------------------------------- @@ -23,7 +23,7 @@ # # Description # CMakeLists.txt file for implementing a test harness for the compilation -# and test of foam-extend-3.2 using Kitware CTest/CMake/CDash +# and test of foam-extend-4.1 using Kitware CTest/CMake/CDash # # The results will be submitted to the CDash server identified by the file # CTestConfig.cmake @@ -48,13 +48,16 @@ function(GetHostName var) execute_process( COMMAND hostname OUTPUT_VARIABLE thisHostname + OUTPUT_STRIP_TRAILING_WHITESPACE ) else() execute_process( COMMAND hostname -f OUTPUT_VARIABLE thisHostname + OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() + set(${var} ${thisHostname} PARENT_SCOPE) endfunction() diff --git a/testHarness/OSIG/Turbomachinery/CMakeFiles/CMakeLists.txt b/testHarness/OSIG/Turbomachinery/CMakeFiles/CMakeLists.txt index 542716463..e3087a4d5 100644 --- a/testHarness/OSIG/Turbomachinery/CMakeFiles/CMakeLists.txt +++ b/testHarness/OSIG/Turbomachinery/CMakeFiles/CMakeLists.txt @@ -1,4 +1,5 @@ -# /*-------------------------------------------------------------------------*\# ======== | +# /*-------------------------------------------------------------------------*\ +# ========= | # \\ / F ield | foam-extend: Open Source CFD # \\ / O peration | # \\ / A nd | For copyright notice see file Copyright diff --git a/testHarness/foam-extend/4.1/CMakeFiles/CMakeLists.txt b/testHarness/foam-extend/4.1/CMakeFiles/CMakeLists.txt index 22a9ef43d..28b88def5 100644 --- a/testHarness/foam-extend/4.1/CMakeFiles/CMakeLists.txt +++ b/testHarness/foam-extend/4.1/CMakeFiles/CMakeLists.txt @@ -1,4 +1,5 @@ -# /*-------------------------------------------------------------------------*\# ======== | +# /*-------------------------------------------------------------------------*\ +# ========= | # \\ / F ield | foam-extend: Open Source CFD # \\ / O peration | Version: 4.1 # \\ / A nd | Web: http://www.foam-extend.org diff --git a/testHarness/foam-extend/4.1/runDir/Allrun_CMakeOnly b/testHarness/foam-extend/4.1/runDir/Allrun_CMakeOnly index 91117a1f9..73380f0ec 100755 --- a/testHarness/foam-extend/4.1/runDir/Allrun_CMakeOnly +++ b/testHarness/foam-extend/4.1/runDir/Allrun_CMakeOnly @@ -75,9 +75,9 @@ fi # We need cmake version 2.8.0 at least if [ "$WM_ARCH_BASE" == "mingw" ] then - cmake $WM_PROJECT_DIR -G "MSYS Makefiles" + cmake $WM_PROJECT_DIR -G "MSYS Makefiles" -DRUN_TESTS=ON -DBUILD_WITH_CMAKE=OFF else - cmake $WM_PROJECT_DIR -G "Unix Makefiles" + cmake $WM_PROJECT_DIR -G "Unix Makefiles" -DRUN_TESTS=ON -DBUILD_WITH_CMAKE=OFF fi # All set. Now we can run the available test harness diff --git a/testHarness/foam-extend/4.1/runDir/Allrun_Experimental b/testHarness/foam-extend/4.1/runDir/Allrun_Experimental index 186882d09..224d7ae0b 100755 --- a/testHarness/foam-extend/4.1/runDir/Allrun_Experimental +++ b/testHarness/foam-extend/4.1/runDir/Allrun_Experimental @@ -81,9 +81,9 @@ fi # We need cmake version 2.8.0 at least if [ "$WM_ARCH_BASE" == "mingw" ] then - cmake $WM_PROJECT_DIR -G "MSYS Makefiles" + cmake $WM_PROJECT_DIR -G "MSYS Makefiles" -DRUN_TESTS=ON -DBUILD_WITH_CMAKE=OFF else - cmake $WM_PROJECT_DIR -G "Unix Makefiles" + cmake $WM_PROJECT_DIR -G "Unix Makefiles" -DRUN_TESTS=ON -DBUILD_WITH_CMAKE=OFF fi # All set. Now we can run the available test harness diff --git a/testHarness/foam-extend/4.1/runDir/Allrun_Nightly b/testHarness/foam-extend/4.1/runDir/Allrun_Nightly index a21748e7c..ae49aa4a8 100755 --- a/testHarness/foam-extend/4.1/runDir/Allrun_Nightly +++ b/testHarness/foam-extend/4.1/runDir/Allrun_Nightly @@ -81,9 +81,9 @@ fi # We need cmake version 2.8.0 at least if [ "$WM_ARCH_BASE" == "mingw" ] then - cmake $WM_PROJECT_DIR -G "MSYS Makefiles" + cmake $WM_PROJECT_DIR -G "MSYS Makefiles" -DRUN_TESTS=ON -DBUILD_WITH_CMAKE=OFF else - cmake $WM_PROJECT_DIR -G "Unix Makefiles" + cmake $WM_PROJECT_DIR -G "Unix Makefiles" -DRUN_TESTS=ON -DBUILD_WITH_CMAKE=OFF fi # All set. Now we can run the available test harness