-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from bialger/deadline_0
Fix many major bugs, update version
- Loading branch information
Showing
10 changed files
with
221 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: "CI tests" | ||
|
||
on: [ push, workflow_dispatch ] | ||
|
||
jobs: | ||
build-mingw: | ||
name: Application run on Windows Latest MinGW | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create CMake cache | ||
run: | | ||
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" | ||
- name: Build main target | ||
shell: bash | ||
run: | | ||
cmake --build cmake-build-release --target SandPile || echo Built with errors | ||
- name: Run program | ||
working-directory: .\cmake-build-release | ||
run: | | ||
.\SandPile.exe --help | ||
build-matrix: | ||
name: Application run on ${{ matrix.config.name }} | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { | ||
name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz", | ||
os: windows-latest, | ||
build_type: "Release", cc: "cl", cxx: "cl", | ||
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | ||
} | ||
- { | ||
name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz", | ||
os: ubuntu-latest, | ||
build_type: "Release", cc: "gcc", cxx: "g++" | ||
} | ||
- { | ||
name: "macOS Latest Clang", artifact: "macOS.tar.xz", | ||
os: macos-latest, | ||
build_type: "Release", cc: "clang", cxx: "clang++" | ||
} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create CMake cache | ||
shell: bash | ||
run: | | ||
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release | ||
- name: Build main target | ||
shell: bash | ||
run: | | ||
cmake --build cmake-build-release --target SandPile || echo "Built with errors" | ||
- name: Run program | ||
shell: bash | ||
working-directory: ./cmake-build-release | ||
run: | | ||
if [ "$RUNNER_OS" == "Windows" ]; then | ||
cd Debug | ||
./SandPile.exe --help | ||
else | ||
./SandPile --help | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
|
||
if (UNIX AND NOT APPLE) | ||
set(LINUX TRUE) | ||
endif () | ||
|
||
if (WIN32) | ||
message("Windows") | ||
elseif (LINUX) | ||
message("Linux") | ||
else () | ||
message("MacOS") | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/sh | ||
|
||
OS_NAME="$(cmake -P ./PrintOS.cmake 2>&1)" | ||
PROJECT_NAME="SandPile" | ||
CMAKE_BUILD_DIR="$HOME/CMakeBuilds" | ||
CMAKE_PROJECT_DIR="$CMAKE_BUILD_DIR/$PROJECT_NAME" | ||
|
||
if [ "x$SAVE_PREV" = "x" ]; then | ||
if [ -e "$CMAKE_PROJECT_DIR" ]; then | ||
rm -rf "$CMAKE_PROJECT_DIR" | ||
fi | ||
fi | ||
|
||
EXEC_EXTENSION=".exe" | ||
EXEC_PATH="$CMAKE_PROJECT_DIR/$PROJECT_NAME$EXEC_EXTENSION" | ||
|
||
if [ "$OS_NAME" = "Linux" ]; then | ||
EXEC_EXTENSION=".run" | ||
EXEC_PATH="$CMAKE_PROJECT_DIR/$PROJECT_NAME" | ||
elif [ "$OS_NAME" = "MacOS" ]; then | ||
EXEC_EXTENSION=".run" | ||
EXEC_PATH="$CMAKE_PROJECT_DIR/$PROJECT_NAME" | ||
fi | ||
|
||
EXEC_LINK_PATH="$HOME/$PROJECT_NAME$EXEC_EXTENSION" | ||
|
||
if (cmake -S . -B "$CMAKE_PROJECT_DIR" -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" && cmake --build "$CMAKE_PROJECT_DIR" --target "$PROJECT_NAME"); then | ||
rm -f "$EXEC_LINK_PATH" | ||
ln -s "$EXEC_PATH" "$EXEC_LINK_PATH" | ||
echo '' | ||
|
||
if ("$EXEC_LINK_PATH" -h >/dev/null 2>/dev/null); then | ||
echo "Congratulations! $PROJECT_NAME was compiled successfully." | ||
echo '' | ||
"$EXEC_LINK_PATH" -h | ||
echo '' | ||
|
||
if [ "$OS_NAME" = "Linux" ]; then | ||
printf 'Do you want to add this utility to /usr/bin (y/n)? ' && read -r CHOISE | ||
COMMON_LINK_PATH="/usr/bin/${PROJECT_NAME:?}" | ||
COMMON_PROJECT_DIR="/opt/${PROJECT_NAME:?}" | ||
COMMON_EXEC_PATH="$COMMON_PROJECT_DIR/$PROJECT_NAME" | ||
|
||
if [ "$CHOISE" = "y" ]; then | ||
sudo -S rm -f "$COMMON_LINK_PATH" | ||
|
||
if (sudo ln -s "$EXEC_PATH" "$COMMON_LINK_PATH"); then | ||
if [ -e "$COMMON_PROJECT_DIR" ]; then | ||
sudo rm -rf "$COMMON_PROJECT_DIR" | ||
fi | ||
|
||
sudo rm -f "$COMMON_LINK_PATH" | ||
sudo cp -r "$CMAKE_PROJECT_DIR" "$COMMON_PROJECT_DIR" | ||
sudo ln -s "$COMMON_EXEC_PATH" "$COMMON_LINK_PATH" | ||
echo "Accepted, run utility with $PROJECT_NAME" | ||
else | ||
echo 'Please try again later.' | ||
echo "Declined, run utility with $EXEC_LINK_PATH" | ||
fi | ||
else | ||
echo "Declined, run utility with $EXEC_LINK_PATH" | ||
fi | ||
else | ||
echo "Run utility with $EXEC_LINK_PATH" | ||
fi | ||
|
||
exit 0 | ||
elif (cd "$CMAKE_PROJECT_DIR" && "./$PROJECT_NAME$EXEC_EXTENSION" -h >/dev/null 2>/dev/null); then | ||
rm -f "$EXEC_LINK_PATH" | ||
rm -rf "$HOME/${PROJECT_NAME:?}" | ||
echo "Congratulations! $PROJECT_NAME was compiled successfully." | ||
echo "Because of Windows-specific limitations, it is not possible to create a link to it." | ||
echo "You can run it from $HOME/$PROJECT_NAME as .\\$PROJECT_NAME$EXEC_EXTENSION" | ||
echo "Or you can run CMD.EXE with administrative privileges and type: " | ||
echo 'mklink "%userprofile%\SandPile.exe" "%userprofile%\SandPile\SandPile.exe"' | ||
echo '' | ||
mkdir "$HOME/$PROJECT_NAME" | ||
cp "$CMAKE_PROJECT_DIR/$PROJECT_NAME$EXEC_EXTENSION" "$HOME/$PROJECT_NAME/$PROJECT_NAME$EXEC_EXTENSION" | ||
# ALso copy all *dll files like following: | ||
# cp -r "$CMAKE_PROJECT_DIR/liblib.dll" "$HOME/$PROJECT_NAME/liblib.dll" | ||
cd "$HOME/$PROJECT_NAME" && "./$PROJECT_NAME$EXEC_EXTENSION" -h | ||
exit 0 | ||
else | ||
echo 'Oops! Could not execute the program.' | ||
exit 1 | ||
fi | ||
else | ||
echo 'Error occurred during running CMake. Make sure that it is installed and configured properly.' | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters