Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jul 7, 2020
1 parent 68b7346 commit 008fc8b
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 7 deletions.
4 changes: 1 addition & 3 deletions build_atlas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ rm -f $bindir/CMakeCache.txt

CC=$cc FC=$fc cmake -Datlas=1 -B $bindir

cmake --build $bindir

(cd $bindir; ctest -V)
ctest -S setup.cmake -VV
4 changes: 1 addition & 3 deletions build_mkl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ rm -f $bindir/CMakeCache.txt

CC=$cc FC=$fc cmake -B $bindir

cmake --build $bindir

(cd $bindir; ctest -V)
ctest -S setup.cmake -VV
15 changes: 15 additions & 0 deletions factory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# tests CMake's built-in FindBLAS
cmake_minimum_required(VERSION 3.12)
project(Lapack_OEM LANGUAGES C Fortran)

if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
set(BLA_VENDOR Intel10_64lp)
if(WIN32)
file(TO_CMAKE_PATH "$ENV{MKLROOT}" MKLROOT)
else()
set(MKLROOT "$ENV{MKLROOT}")
endif()
endif()

find_package(BLAS)
find_package(LAPACK)
92 changes: 92 additions & 0 deletions setup.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# run by:
# ctest -S setup.cmake

# --- Project-specific -Doptions
# these will be used if the project isn't already configured.
set(_opts)

# --- boilerplate follows
message(STATUS "CMake ${CMAKE_VERSION}")
if(CMAKE_VERSION VERSION_LESS 3.12)
message(FATAL_ERROR "Please update CMake >= 3.12")
endif()

# site is OS name
if(NOT DEFINED CTEST_SITE)
set(CTEST_SITE ${CMAKE_SYSTEM_NAME})
endif()

# test name is Fortran compiler in FC
# Note: ctest scripts cannot read cache variables like CMAKE_Fortran_COMPILER
if(DEFINED ENV{FC})
set(FC $ENV{FC})
set(CTEST_BUILD_NAME ${FC})

if(NOT DEFINED ENV{CC})
# use same compiler for C and Fortran, which CMake might not do itself
if(FC STREQUAL ifort)
if(WIN32)
set(ENV{CC} icl)
else()
set(ENV{CC} icc)
endif()
endif()
endif()
endif()

if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
set(CTEST_BUILD_CONFIGURATION "Release")
endif()

set(CTEST_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
if(NOT DEFINED CTEST_BINARY_DIRECTORY)
set(CTEST_BINARY_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/build)
endif()

# CTEST_CMAKE_GENERATOR must be defined in any case here.
if(NOT DEFINED CTEST_CMAKE_GENERATOR)
find_program(_gen NAMES ninja ninja-build samu)
if(_gen)
set(CTEST_CMAKE_GENERATOR "Ninja")
elseif(WIN32)
set(CTEST_CMAKE_GENERATOR "MinGW Makefiles")
set(CTEST_BUILD_FLAGS -j) # not --parallel as this goes to generator directly
else()
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_BUILD_FLAGS -j) # not --parallel as this goes to generator directly
endif()
endif()

# -- build and test
ctest_start("Experimental" ${CTEST_SOURCE_DIRECTORY} ${CTEST_BINARY_DIRECTORY})

ctest_configure(
BUILD ${CTEST_BINARY_DIRECTORY}
SOURCE ${CTEST_SOURCE_DIRECTORY}
OPTIONS "${_opts}"
RETURN_VALUE return_code
CAPTURE_CMAKE_ERROR cmake_err)

if(return_code EQUAL 0 AND cmake_err EQUAL 0)
ctest_build(
BUILD ${CTEST_BINARY_DIRECTORY}
CONFIGURATION ${CTEST_BUILD_CONFIGURATION}
RETURN_VALUE return_code
NUMBER_ERRORS Nerror
CAPTURE_CMAKE_ERROR cmake_err
)
else()
message(STATUS "SKIP: ctest_build(): returncode: ${return_code}; CMake error code: ${cmake_err}")
endif()

if(return_code EQUAL 0 AND Nerror EQUAL 0 AND cmake_err EQUAL 0)
ctest_test(
BUILD ${CTEST_BINARY_DIRECTORY}
RETURN_VALUE return_code
CAPTURE_CMAKE_ERROR ctest_err
)
else()
message(STATUS "SKIP: ctest_test(): returncode: ${return_code}; CMake error code: ${cmake_err}")
endif()

# ctest_submit()
2 changes: 1 addition & 1 deletion test_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ do

rm -f $bindir/CMakeCache.txt

CC=$cc cmake -B $bindir && cmake --build $bindir && (cd $bindir; ctest)
CC=$cc ctest -S setup.cmake -VV

done

Expand Down

0 comments on commit 008fc8b

Please sign in to comment.