Skip to content

Commit

Permalink
Merge pull request LLNL#53 from LLNL/feature/weiss27/bugfix-win-flags
Browse files Browse the repository at this point in the history
Feature/weiss27/bugfix win flags
  • Loading branch information
kennyweiss authored Aug 30, 2017
2 parents 3d9988d + ea4f5db commit ce5ceca
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 17 deletions.
43 changes: 41 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ environment:
BUILD_SHARED_LIBS: ON
ENABLE_GMOCK: OFF
ENABLE_BENCHMARKS: OFF
ENABLE_MPI: OFF
- CMAKE_GENERATOR: "Visual Studio 14 2015"
CONFIG: Release
BUILD_SHARED_LIBS: OFF
ENABLE_GMOCK: ON
ENABLE_BENCHMARKS: ON
ENABLE_MPI: OFF
- CMAKE_GENERATOR: "Visual Studio 14 2015"
CONFIG: Release
BUILD_SHARED_LIBS: OFF
ENABLE_GMOCK: OFF
ENABLE_BENCHMARKS: OFF
ENABLE_MPI: ON

init:
# line endings magic
Expand All @@ -18,11 +26,22 @@ init:
- git config --global user.email "[email protected]"
- git config --global user.name "BLT Robot"

install:
# Install MS-MPI
- ps: Start-FileDownload 'https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/MSMpiSetup.exe'
- MSMpiSetup.exe -unattend
- set PATH=C:\Program Files\Microsoft MPI\Bin;%PATH%

# Install MS-MPI SDK
- ps: Start-FileDownload 'https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/msmpisdk.msi'
- msmpisdk.msi /passive

before_build:
# remove some noisy warnings from Xamarin
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
# copy blt into blt-test and setup to build there
- ps: cd ..
- mkdir build
- cp -r blt\cmake\blt-test .
- cp -r blt blt-test
# create a git repo for blt-test to test the git macros
Expand All @@ -32,10 +51,22 @@ before_build:
- git commit -a -m "Initial Commit"
- git checkout -b test-branch
- git tag test-tag
- cd ..
- cd ..\build
# configure
- echo Running cmake ...
- cmake -Hblt-test -Bbuild -G "%CMAKE_GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -DENABLE_GMOCK=%ENABLE_GMOCK% -DENABLE_BENCHMARKS=%ENABLE_BENCHMARKS% -DENABLE_OPENMP=ON
- cmake -G "%CMAKE_GENERATOR%" ^
-D BUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% ^
-D ENABLE_GMOCK=%ENABLE_GMOCK% ^
-D ENABLE_BENCHMARKS=%ENABLE_BENCHMARKS% ^
-D ENABLE_OPENMP=ON ^
-D ENABLE_MPI=%ENABLE_MPI% ^
-D MPI_HOME:PATH="C:/Program Files (x86)/Microsoft SDKs/MPI" ^
-D MPI_C_INCLUDE_PATH:PATH="${MPI_HOME}/Include" ^
-D MPI_C_LIBRARIES:PATH="${MPI_HOME}/Lib/x86/msmpi.lib" ^
-D MPI_CXX_INCLUDE_PATH:PATH="${MPI_HOME}/Include" ^
-D MPI_CXX_LIBRARIES:PATH="${MPI_HOME}/Lib/x86/msmpi.lib" ^
..\blt-test
- cd ..

build_script:
#build
Expand All @@ -45,3 +76,11 @@ build_script:
after_build:
# run our tests
- cmake -E env CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --config %CONFIG% --target RUN_TESTS

on_failure:
- ps: |
Write-Output "CMakeOutput.log"
cat c:\projects\build\CMakeFiles\CMakeOutput.log
Write-Output "CMakeError.log"
cat c:\projects\build\CMakeFiles\CMakeError.log
21 changes: 15 additions & 6 deletions cmake/BLTMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -524,16 +524,25 @@ macro(blt_add_test)
message(FATAL_ERROR "COMMAND is a required parameter to blt_add_test")
endif()

# Generate command
# Extract test directory and executable from arg_NAME and arg_COMMAND
if ( NOT TARGET ${arg_NAME} )
# Handle case of running multiple tests against one executable,
# Handle cases where multiple tests are run against one executable
# the NAME will not be the target
list(GET arg_COMMAND 0 executable)
get_target_property(runtime_output_directory ${executable} RUNTIME_OUTPUT_DIRECTORY )
list(GET arg_COMMAND 0 test_executable)
get_target_property(test_directory ${test_executable} RUNTIME_OUTPUT_DIRECTORY )
else()
get_target_property(runtime_output_directory ${arg_NAME} RUNTIME_OUTPUT_DIRECTORY )
set(test_executable ${arg_NAME})
get_target_property(test_directory ${arg_NAME} RUNTIME_OUTPUT_DIRECTORY )
endif()

# Append the test_directory to the test argument, accounting for multi-config generators
if(NOT CMAKE_CONFIGURATION_TYPES)
set(test_command ${test_directory}/${arg_COMMAND} )
else()
list(INSERT arg_COMMAND 0 "$<TARGET_FILE:${test_executable}>")
list(REMOVE_AT arg_COMMAND 1)
set(test_command ${arg_COMMAND})
endif()
set(test_command ${runtime_output_directory}/${arg_COMMAND} )

# If configuration option ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC is set,
# ensure NUM_PROCS is at least one. This invokes the test through MPIEXEC.
Expand Down
23 changes: 16 additions & 7 deletions cmake/SetupCompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ if(BLT_DEFINES)
message(STATUS "Added \"${BLT_DEFINES}\" to definitions")
endif()

if(COMPILER_FAMILY_IS_MSVC)
# Visual studio can give a warning that /bigobj is required due to the size of some object files
set( BLT_CXX_FLAGS "${BLT_CXX_FLAGS} /bigobj" )
set( BLT_C_FLAGS "${BLT_C_FLAGS} /bigobj" )
endif()

##########################################
# If set, BLT_<LANG>_FLAGS are added to
# all targets that use <LANG>-Compiler
Expand All @@ -129,7 +135,7 @@ endif()
#############################################
if(BLT_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BLT_CXX_FLAGS}")
message(STATUS "Updated CMAKE_CXX_FLAGS to \"${CMAKE_CXX_FLAGS}\"")
message(STATUS "Updated CMAKE_CXX_FLAGS to \"${CMAKE_CXX_FLAGS}\"")
endif()

################################################
Expand Down Expand Up @@ -308,12 +314,6 @@ if (ENABLE_WARNINGS_AS_ERRORS)
endforeach()
endif()


foreach(flagVar ${langFlags})
message(STATUS "${flagVar} flags are: ${${flagVar}}")
endforeach()


################################
# Enable Fortran
################################
Expand All @@ -327,6 +327,15 @@ if(ENABLE_FORTRAN)

# default property to free form
set(CMAKE_Fortran_FORMAT FREE)

list(APPEND langFlags "CMAKE_Fortran_FLAGS")
else()
message(STATUS "Fortran support disabled.")
endif()

###################################
# Output compiler and linker flags
###################################
foreach(flagVar ${langFlags} "CMAKE_EXE_LINKER_FLAGS" )
message(STATUS "${flagVar} flags are: ${${flagVar}}")
endforeach()
4 changes: 2 additions & 2 deletions tests/blt_gtest_smoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TEST(blt_gtest_smoke,basic_assert_example)
//------------------------------------------------------------------------------
// Tests the gtest death test feature, which are disabled by default.
//
// The call 'assert(false)' should exit the program, passing the test.
// Exits program with non-zero exit code, passing the test.
// Note: To enable death tests, configure BLT with ENABLE_GTEST_DEATH_TESTS.
//------------------------------------------------------------------------------
TEST(blt_gtest_smoke,death_test)
Expand All @@ -67,6 +67,6 @@ TEST(blt_gtest_smoke,death_test)

// Invoke death test function whether death tests enabled or disabled.
::testing::FLAGS_gtest_death_test_style = "threadsafe";
EXPECT_DEATH_IF_SUPPORTED( assert(false), "");
EXPECT_DEATH_IF_SUPPORTED( exit(1), "");
}

0 comments on commit ce5ceca

Please sign in to comment.