Skip to content

Commit

Permalink
Merge 47548d6 into 2a6aad9
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Oct 16, 2019
2 parents 2a6aad9 + 47548d6 commit 4d6d3c8
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 73 deletions.
4 changes: 3 additions & 1 deletion clean
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

scripts/genericclean
appDir="$(cd "$(dirname "$0")"; pwd)"

${appDir}/scripts/genericclean
4 changes: 3 additions & 1 deletion clean.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@ECHO OFF

CALL scripts\genericclean
SET AppDir=%~dp0

CALL %AppDir%scripts\genericclean
4 changes: 3 additions & 1 deletion cleanall
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

scripts/genericclean all
appDir="$(cd "$(dirname "$0")"; pwd)"

${appDir}/scripts/genericclean all
4 changes: 3 additions & 1 deletion cleanall.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@ECHO OFF

CALL scripts\genericclean all
SET AppDir=%~dp0

CALL %AppDir%scripts\genericclean all
6 changes: 4 additions & 2 deletions format
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/sh

if [ -d "src" ]; then
appDir="$(cd "$(dirname "$0")"; pwd)"

if [ -d "${appDir}/src" ]; then
echo "\033[44;37;1mFormatting OpenCOR...\033[0m"

if [ "`hash clang-format 2>&1`" = "" ]; then
for i in `find src -name "*.cpp" -o -name "*.h" | sort | egrep -v "(3rdparty|\/ext\/|\/qzip)"`; do
for i in `find ${appDir}/src -name "*.cpp" -o -name "*.h" | sort | egrep -v "(3rdparty|\/ext\/|\/qzip)"`; do
echo "Formatting $i..."

clang-format -i -style=file $i
Expand Down
9 changes: 5 additions & 4 deletions format.bat
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
@ECHO OFF

SET CurrentPath=%CD%
SET AppDir=%~dp0
SET OrigDir=%CD%

IF EXIST %CurrentPath%\src (
IF EXIST %AppDir%src (
TITLE Formatting OpenCOR...

FOR %%X IN (clang-format.exe) DO (
SET ClangFormatFound=%%~$PATH:X
)

IF DEFINED ClangFormatFound (
CD %CurrentPath%\src
CD %AppDir%src

FOR /R %%I IN (*.cpp *.h) DO (
ECHO.%%I | FINDSTR /V "3rdparty \ext\ \qzip">NUL && (
Expand All @@ -20,7 +21,7 @@ IF EXIST %CurrentPath%\src (
)
)

CD %CurrentPath%
CD %OrigDir%
) ELSE (
ECHO Clang-Format is not installed.
)
Expand Down
4 changes: 3 additions & 1 deletion make
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

scripts/genericmake Release $*
appDir="$(cd "$(dirname "$0")"; pwd)"

${appDir}/scripts/genericmake Release $*
4 changes: 3 additions & 1 deletion make.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@ECHO OFF

CALL scripts\genericmake Release %*
SET AppDir=%~dp0

CALL %AppDir%scripts\genericmake Release %*
4 changes: 3 additions & 1 deletion maketests
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

scripts/genericmake Tests $*
appDir="$(cd "$(dirname "$0")"; pwd)"

${appDir}/scripts/genericmake Tests $*
4 changes: 3 additions & 1 deletion maketests.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@ECHO OFF

CALL scripts\genericmake Tests %*
SET AppDir=%~dp0

CALL %AppDir%scripts\genericmake Tests %*
12 changes: 8 additions & 4 deletions package
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/sh

./clean
./make $*
appDir="$(cd "$(dirname "$0")"; pwd)"

${appDir}/clean
${appDir}/make $*

exitCode=$?

Expand All @@ -11,7 +13,9 @@ fi

echo "\033[44;37;1mPackaging OpenCOR...\033[0m"

cd build
origDir=`pwd`

cd ${appDir}/build

if [ "`uname -s`" = "Linux" ]; then
cpack
Expand All @@ -25,7 +29,7 @@ fi

exitCode=$?

cd ..
cd $origDir

if [ $exitCode -eq 0 ]; then
echo "\033[42;37;1mAll done!\033[0m"
Expand Down
12 changes: 8 additions & 4 deletions package.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@

SETLOCAL ENABLEDELAYEDEXPANSION

CALL clean
CALL make %*
SET AppDir=%~dp0

CALL %AppDir%clean
CALL %AppDir%make %*

SET ExitCode=!ERRORLEVEL!

IF !ExitCode! EQU 0 (
TITLE Packaging OpenCOR...

CD build
SET OrigDir=%CD%

CD %AppDir%build

cpack

SET ExitCode=!ERRORLEVEL!

CD ..
CD %OrigDir%
)

EXIT /B !ExitCode!
20 changes: 9 additions & 11 deletions run
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

echo "\033[44;37;1mRunning OpenCOR...\033[0m"

WMsg="OpenCOR must first be built before being run."
appDir="$(cd "$(dirname "$0")"; pwd)"

if [ "`uname -s`" = "Linux" ]; then
if [ -f build/bin/OpenCOR ]; then
build/bin/OpenCOR "$@"
else
echo $WMsg
fi
appExe=${appDir}/build/bin/OpenCOR
else
if [ -d build/OpenCOR.app ]; then
build/OpenCOR.app/Contents/MacOS/OpenCOR "$@"
else
echo $WMsg
fi
appExe=${appDir}/build/OpenCOR.app/Contents/MacOS/OpenCOR
fi

if [ -f ${appExe} ]; then
${appExe} "$@"
else
echo "OpenCOR must first be built before being run."
fi

echo "\033[42;37;1mAll done!\033[0m"
7 changes: 4 additions & 3 deletions run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

TITLE Running OpenCOR...

SET AppBase=%~dp0build\bin\OpenCOR
SET NeedInformation=

IF NOT EXIST build\bin\OpenCOR.com SET NeedInformation=Yes
IF NOT EXIST build\bin\OpenCOR.exe SET NeedInformation=Yes
IF NOT EXIST %AppBase%.com SET NeedInformation=Yes
IF NOT EXIST %AppBase%.exe SET NeedInformation=Yes

IF DEFINED NeedInformation (
ECHO OpenCOR must first be built before being run.
) ELSE (
build\bin\OpenCOR %*
%AppBase% %*
)
6 changes: 4 additions & 2 deletions run.vbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
If CreateObject("Scripting.FileSystemObject").FileExists("build\bin\OpenCOR.exe") Then
appExe = Left(Wscript.ScriptFullName, Len(Wscript.ScriptFullName)-Len(Wscript.ScriptName))&"build\bin\OpenCOR.exe"

If CreateObject("Scripting.FileSystemObject").FileExists(appExe) Then
args = ""

For Each arg in WScript.Arguments
args = args&" "&arg
Next

cmd = "build\bin\OpenCOR.exe"&args
cmd = appExe&args

CreateObject("WScript.Shell").Run cmd, 1, False
Else
Expand Down
20 changes: 9 additions & 11 deletions runtests
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

echo "\033[44;37;1mRunning OpenCOR's tests...\033[0m"

WMsg="OpenCOR's tests must first be built before being run."
appDir="$(cd "$(dirname "$0")"; pwd)"

if [ "`uname -s`" = "Linux" ]; then
if [ -f build/bin/runtests ]; then
build/bin/runtests
else
echo $WMsg
fi
OPENCOR_TESTS_EXE=${appDir}/build/bin/runtests
else
if [ -f build/OpenCOR.app/Contents/MacOS/runtests ]; then
build/OpenCOR.app/Contents/MacOS/runtests
else
echo $WMsg
fi
OPENCOR_TESTS_EXE=${appDir}/build/OpenCOR.app/Contents/MacOS/runtests
fi

if [ -f ${OPENCOR_TESTS_EXE} ]; then
${OPENCOR_TESTS_EXE} "$@"
else
echo "OpenCOR's tests must first be built before being run."
fi

echo "\033[42;37;1mAll done!\033[0m"
9 changes: 4 additions & 5 deletions runtests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

TITLE Running OpenCOR's tests...

SET NeedInformation=
SET appTestsExe=%~dp0build\bin\runtests.exe
echo %appTestsExe%

IF NOT EXIST build\bin\runtests.exe SET NeedInformation=Yes

IF DEFINED NeedInformation (
IF NOT EXIST %appTestsExe% (
ECHO OpenCOR's tests must first be built before being run.
) ELSE (
build\bin\runtests
%appTestsExe%
)
6 changes: 4 additions & 2 deletions scripts/genericclean
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ else
echo "\033[44;37;1mCleaning OpenCOR...\033[0m"
fi

rm -fr build/.clang-tidy build/.ninja* build/* > /dev/null 2>&1
appDir="$(cd "$(dirname "$0")"; pwd)"/..

rm -fr ${appDir}/build/.clang-tidy ${appDir}/build/.ninja* ${appDir}/build/* > /dev/null 2>&1

if [ "$1" = "all" ]; then
rm -fr ext/* > /dev/null 2>&1
rm -fr ${appDir}/ext/* > /dev/null 2>&1
fi

echo "\033[42;37;1mAll done!\033[0m"
13 changes: 7 additions & 6 deletions scripts/genericclean.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ IF "%1" == "all" (
TITLE Cleaning OpenCOR...
)

SET CurrentPath=%CD%
SET AppDir=%~dp0..\
SET OrigDir=%CD%

IF EXIST %CurrentPath%\build (
CD %CurrentPath%\build
IF EXIST %AppDir%build (
CD %AppDir%build

FOR %%I IN (*.*) DO ATTRIB -R "%%I"
FOR /D %%I IN (*.*) DO RMDIR /S /Q "%%I"
FOR %%I IN (*.*) DO IF NOT "%%I" == ".gitignore" DEL /Q "%%I"
)

IF "%1" == "all" (
IF EXIST %CurrentPath%\ext (
CD %CurrentPath%\ext
IF EXIST %AppDir%ext (
CD %AppDir%ext

FOR /D %%I IN (*.*) DO RMDIR /S /Q "%%I"
FOR %%I IN (*.*) DO IF NOT "%%I" == ".gitignore" DEL /Q "%%I"
)
)

CD %CurrentPath%
CD %OrigDir%
16 changes: 9 additions & 7 deletions scripts/genericmake
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh

if [ -d "build" ]; then
appDir="$(cd "$(dirname "$0")"; pwd)"/..

if [ -d "${appDir}/build" ]; then
cmakeBuildType=$1

if [ "$cmakeBuildType" = "Release" ]; then
Expand All @@ -20,22 +22,22 @@ if [ -d "build" ]; then
cmakeGenerator="Unix Makefiles"
fi

if [ "$cmakeBuildType" = "Release" ]; then
titleTests=""
else
if [ "$cmakeBuildType" = "Debug" ]; then
titleTests=" and its tests"
fi

echo "\033[44;37;1mMaking OpenCOR$titleTests (using $generator)...\033[0m"

cd build
origDir=`pwd`

cd ${appDir}/build

cmake -G "$cmakeGenerator" -DCMAKE_BUILD_TYPE=$cmakeBuildType -DENABLE_TESTS=$enableTests ..

exitCode=$?

if [ $exitCode -ne 0 ]; then
cd ..
cd $origDir

exit $exitCode
fi
Expand All @@ -50,7 +52,7 @@ if [ -d "build" ]; then

exitCode=$?

cd ..
cd $origDir

if [ $exitCode -eq 0 ]; then
echo "\033[42;37;1mAll done!\033[0m"
Expand Down
10 changes: 6 additions & 4 deletions scripts/genericmake.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SETLOCAL ENABLEDELAYEDEXPANSION

SET CurrentPath=%CD%
SET AppDir=%~dp0..\

IF EXIST %CurrentPath%\build (
IF EXIST %AppDir%build (
SET CMakeBuildType=%1

IF "!CMakeBuildType!" == "Release" (
Expand Down Expand Up @@ -32,7 +32,9 @@ IF EXIST %CurrentPath%\build (

CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

CD %CurrentPath%\build
SET OrigDir=%CD%

CD %AppDir%\build

IF DEFINED NinjaFound (
SET CMakeGenerator=Ninja
Expand Down Expand Up @@ -60,7 +62,7 @@ IF EXIST %CurrentPath%\build (
)
)

CD %CurrentPath%
CD %OrigDir%

EXIT /B !ExitCode!
) ELSE (
Expand Down

0 comments on commit 4d6d3c8

Please sign in to comment.