Skip to content

Commit 13c6896

Browse files
authored
Merge branch 'master' into fix-windows-installer
2 parents 7ea9102 + 1e08fe7 commit 13c6896

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

CMakeLists.txt

+34-2
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,40 @@ function(caf_compile_executable target main_depend)
452452
DEPENDS "${target}")
453453
endfunction(caf_compile_executable)
454454

455+
enable_testing()
456+
457+
#--------------------------------------------------------
458+
# Setup shellcheck if present for testing/linting scripts
459+
#--------------------------------------------------------
460+
find_program(SHELLCHECK_EXE shellcheck
461+
DOC "Path to shellcheck executable for linting scripts"
462+
)
463+
if (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})
464+
if(NOT SHELLCHECK_EXE)
465+
message( AUTHOR_WARNING "OpenCoarrays developers should install shellcheck to test/lint all shell scripts.
466+
See https://github.com/koalaman/shellcheck#installing for info on obtaining shellcheck.")
467+
endif()
468+
endif()
469+
470+
function(lint_script script_dir script_name)
471+
if (SHELLCHECK_EXE)
472+
add_test(NAME "shellcheck:${script_name}"
473+
COMMAND ${SHELLCHECK_EXE} -x "${script_dir}/${script_name}"
474+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
475+
elseif (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER})
476+
message( AUTHOR_WARNING "test: shellcheck:${script_name} not run because shellcheck not installed." )
477+
endif()
478+
endfunction()
479+
480+
#-----------------------------------------------
481+
# Setup script style testing & enforcement macro
482+
#-----------------------------------------------
483+
484+
function(check_script_style script_full_path)
485+
add_test(NAME "style:${script_full_path}"
486+
COMMAND "${CMAKE_SOURCE_DIR}/developer-scripts/style.pl" "${script_full_path}")
487+
endfunction()
488+
455489
#-------------------------------
456490
# Recurse into the src directory
457491
#-------------------------------
@@ -499,8 +533,6 @@ configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_
499533
add_custom_target ( uninstall
500534
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/uninstall.cmake" )
501535

502-
enable_testing()
503-
504536
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
505537
# See JSON-Fortran's CMakeLists.txt file to find out how to get the check target to depend
506538
# on the test executables

src/mpi/CMakeLists.txt

+14-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ set_target_properties(opencoarrays_mod
126126
Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}"
127127
POSITION_INDEPENDENT_CODE TRUE)
128128

129-
130129
add_library(caf_mpi SHARED mpi_caf.c ../common/caf_auxiliary.c $<TARGET_OBJECTS:opencoarrays_mod>)
131130
add_library(caf_mpi_static STATIC mpi_caf.c ../common/caf_auxiliary.c $<TARGET_OBJECTS:opencoarrays_mod>)
132131
target_link_libraries(caf_mpi PRIVATE ${MPI_C_LIBRARIES} ${MPI_Fortran_LIBRARIES})
@@ -147,6 +146,15 @@ set_target_properties ( caf_mpi
147146
# VERSION ${PROJECT_VERSION}
148147
)
149148

149+
# Create a symlink in the include dir
150+
add_custom_command(TARGET caf_mpi
151+
POST_BUILD
152+
COMMAND ${CMAKE_COMMAND} -E create_symlink "./${mod_dir_tail}/opencoarrays.mod" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/opencaorrays.mod"
153+
COMMENT "Creating symlink ${CMAKE_INSTALL_INCLUDEDIR}/opencaorrays.mod --> ${CMAKE_INSTALL_INCLUDEDIR}/${mod_dir_tail}/opencoarrays.mod")
154+
155+
install(DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
156+
FILES_MATCHING PATTERN "*.mod")
157+
150158
set_target_properties( caf_mpi_static
151159
PROPERTIES
152160
SOVERSION ${CAF_SO_VERSION}
@@ -214,3 +222,8 @@ configure_file("${CMAKE_SOURCE_DIR}/src/extensions/cafrun.in" "${CMAKE_BINARY_DI
214222
install(PROGRAMS "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun"
215223
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf"
216224
DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
225+
226+
lint_script("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" caf)
227+
check_script_style("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf")
228+
lint_script("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" cafrun)
229+
check_script_style("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun")

0 commit comments

Comments
 (0)