Skip to content

Commit

Permalink
Create GetCompilerPassthroughArgs.cmake to be reused in other testing (
Browse files Browse the repository at this point in the history
…#154)

This is getting ready for the work to add more automated testing involving
TribitsExampleProject and other projects.  This gets the configure arugments
for compilers, compiler options, etc that need to be passed down.
  • Loading branch information
bartlettroscoe committed Dec 10, 2016
1 parent fbaf169 commit 7bcc070
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 35 deletions.
37 changes: 2 additions & 35 deletions test/core/ExamplesUnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,43 +39,10 @@


#
# Common arguments
# Common arguments for all inner CMake and TriBITS projects
#

SET(SERIAL_PASSTHROUGH_CONFIGURE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
)

IF ({${PROJECT_NAME}_ENABLE_Fortran)
APPEND_SET(SERIAL_PASSTHROUGH_CONFIGURE_ARGS
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} )
ENDIF()

SET(COMMON_ENV_ARGS_PASSTHROUGH
-DTPL_ENABLE_MPI=${TPL_ENABLE_MPI}
-DHeaderOnlyTpl_INCLUDE_DIRS=${${PROJECT_NAME}_TRIBITS_DIR}/examples/tpls/HeaderOnlyTpl
)

IF (TPL_ENABLE_MPI)
APPEND_SET(COMMON_ENV_ARGS_PASSTHROUGH
-DMPI_C_COMPILER=${MPI_C_COMPILER}
-DMPI_CXX_COMPILER=${MPI_CXX_COMPILER}
-DMPI_Fortran_COMPILER=${MPI_Fortran_COMPILER}
-DMPI_EXEC=${MPI_EXEC}
-DMPI_EXEC_DEFAULT_NUMPROCS=${MPI_EXEC_DEFAULT_NUMPROCS}
-DMPI_EXEC_MAX_NUMPROCS=${MPI_EXEC_MAX_NUMPROCS}
-DMPI_EXEC_NUMPROCS_FLAG=${MPI_EXEC_NUMPROCS_FLAG}
-DMPI_EXEC_PRE_NUMPROCS_FLAGS=${MPI_EXEC_PRE_NUMPROCS_FLAGS}
-DMPI_EXEC_POST_NUMPROCS_FLAGS=${MPI_EXEC_POST_NUMPROCS_FLAGS}
)
SET(TEST_MPI_1_SUFFIX "_MPI_1")
ELSE()
APPEND_SET(COMMON_ENV_ARGS_PASSTHROUGH
${SERIAL_PASSTHROUGH_CONFIGURE_ARGS}
)
SET(TEST_MPI_1_SUFFIX "")
ENDIF()
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/GetCompilerPassthroughArgs.cmake)


########################################################################
Expand Down
79 changes: 79 additions & 0 deletions test/core/ExamplesUnitTests/GetCompilerPassthroughArgs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# @HEADER
# ************************************************************************
#
# TriBITS: Tribal Build, Integrate, and Test System
# Copyright 2013 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ************************************************************************
# @HEADER


#
# Gather up arguments to pass through to inner configures and builds of
# example/test CMake and TriBITS projects.
#

SET(SERIAL_PASSTHROUGH_CONFIGURE_ARGS
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
)

IF ({${PROJECT_NAME}_ENABLE_Fortran)
APPEND_SET(SERIAL_PASSTHROUGH_CONFIGURE_ARGS
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} )
ENDIF()

SET(COMMON_ENV_ARGS_PASSTHROUGH
-DTPL_ENABLE_MPI=${TPL_ENABLE_MPI}
-DHeaderOnlyTpl_INCLUDE_DIRS=${${PROJECT_NAME}_TRIBITS_DIR}/examples/tpls/HeaderOnlyTpl
)

IF (TPL_ENABLE_MPI)
APPEND_SET(COMMON_ENV_ARGS_PASSTHROUGH
-DMPI_C_COMPILER=${MPI_C_COMPILER}
-DMPI_CXX_COMPILER=${MPI_CXX_COMPILER}
-DMPI_Fortran_COMPILER=${MPI_Fortran_COMPILER}
-DMPI_EXEC=${MPI_EXEC}
-DMPI_EXEC_DEFAULT_NUMPROCS=${MPI_EXEC_DEFAULT_NUMPROCS}
-DMPI_EXEC_MAX_NUMPROCS=${MPI_EXEC_MAX_NUMPROCS}
-DMPI_EXEC_NUMPROCS_FLAG=${MPI_EXEC_NUMPROCS_FLAG}
-DMPI_EXEC_PRE_NUMPROCS_FLAGS=${MPI_EXEC_PRE_NUMPROCS_FLAGS}
-DMPI_EXEC_POST_NUMPROCS_FLAGS=${MPI_EXEC_POST_NUMPROCS_FLAGS}
)
SET(TEST_MPI_1_SUFFIX "_MPI_1")
ELSE()
APPEND_SET(COMMON_ENV_ARGS_PASSTHROUGH
${SERIAL_PASSTHROUGH_CONFIGURE_ARGS}
)
SET(TEST_MPI_1_SUFFIX "")
ENDIF()

0 comments on commit 7bcc070

Please sign in to comment.