Skip to content

Commit 6b2c49a

Browse files
committed
Add caf & cafrun batchfile wrapper scripts on windows
These scripts get configured to call the bash version found during CMake configuration time. Using this version/installation of bash, the batch files call the corresponding bash caf & cafrun scripts and pass all arguments through. This *should* allow things like fpm to work with the caf wrapper scripts, *I beleive* (untested) CAVEAT: WSL's bash will dump you into your WSL home directory and there's no obvious work around. If you put Git-Bash's bash.exe (in the bin subdirectory) first on your path you *should* be in business (I think). There may be weird edge cases.
1 parent 2ed3c4a commit 6b2c49a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/extensions/caf.bat.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@REM Batch file wrapper script to call the caf bash script on windows
2+
@REM %~dp0 is the directory of the batch script. This assumes caf.bat in same dir as caf
3+
4+
"@BASH_EXECUTABLE@" "%~dp0caf" %*

src/extensions/cafrun.bat.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@REM Batch file wrapper script to call the cafrun bash script on windows
2+
@REM %~dp0 is the directory of the batch script. This assumes cafrun.bat in same dir as cafrun
3+
4+
"@BASH_EXECUTABLE@" "%~dp0cafrun" %*

src/mpi/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,25 @@ endif()
356356
configure_file("${CMAKE_SOURCE_DIR}/src/extensions/cafrun.in" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun"
357357
@ONLY)
358358

359-
install(PROGRAMS "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun"
359+
install(PROGRAMS
360+
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun"
360361
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf"
361362
DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
362363

364+
if(WIN32)
365+
# Add the batch script wrappers
366+
configure_file(
367+
"${CMAKE_SOURCE_DIR}/src/extensions/caf.bat.in" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf.bat"
368+
@ONLY)
369+
configure_file(
370+
"${CMAKE_SOURCE_DIR}/src/extensions/cafrun.bat.in" "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun.bat"
371+
@ONLY)
372+
install(PROGRAMS
373+
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/cafrun.bat"
374+
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf.bat"
375+
DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
376+
endif()
377+
363378
lint_script("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" caf)
364379
check_script_style("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/caf")
365380
lint_script("${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" cafrun)

0 commit comments

Comments
 (0)