Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
0c75c28
Add docker target to GNUmakefile.
johnoel Jan 10, 2024
5c789ff
Default to docker for now.
johnoel Jan 10, 2024
a9979ae
Use current directory.
johnoel Jan 10, 2024
b3ffa00
Check if tpl file exists.
johnoel Jan 10, 2024
833f8a6
Check if directory exists.
johnoel Jan 10, 2024
125a427
Check if right directory.
johnoel Jan 11, 2024
58892e2
Check build_type.
johnoel Jan 11, 2024
1c41e13
Recheck.
johnoel Jan 11, 2024
7e28de0
Recheck.
johnoel Jan 11, 2024
aadf9b8
Recheck.
johnoel Jan 11, 2024
9dedb41
Chmod777
johnoel Jan 11, 2024
26e75f8
Got it.
johnoel Jan 11, 2024
86f7d85
Update windows build files for docker.
johnoel Jan 11, 2024
80e8c9a
Remove blank.
johnoel Jan 11, 2024
2b49d1f
Use macro.
johnoel Jan 11, 2024
09347d5
Use lowercase.
johnoel Jan 11, 2024
00f5d2e
Use lowercase...
johnoel Jan 11, 2024
ed78614
Redo.
johnoel Jan 11, 2024
9e99ac3
slashes...
johnoel Jan 11, 2024
40114e5
Opps...
johnoel Jan 11, 2024
94304f1
Replace slashes...
johnoel Jan 11, 2024
3d3a921
Update.
johnoel Jan 11, 2024
62a710f
Install docker for macos build.
johnoel Jan 11, 2024
fa4e632
Don't change permission for linux.
johnoel Jan 11, 2024
91dd3d7
Use lower case.
johnoel Jan 11, 2024
0477f6e
Use --mount
johnoel Jan 11, 2024
5681df1
Use volume...
johnoel Jan 11, 2024
2bed7e0
Fix?
johnoel Jan 11, 2024
10b3f3c
Try forward.
johnoel Jan 11, 2024
69f1034
Use single .
johnoel Jan 11, 2024
63da438
Use quotes.
johnoel Jan 11, 2024
0c80883
Use other workdir.
johnoel Jan 11, 2024
d1cd00f
Use volume.
johnoel Jan 11, 2024
bd6dbd1
Redo command.
johnoel Jan 11, 2024
1594a43
Use cmd.
johnoel Jan 11, 2024
ae872fa
Use /k.
johnoel Jan 11, 2024
0957a1a
Use powershell.
johnoel Jan 11, 2024
3e6a766
Try...
johnoel Jan 11, 2024
331aa67
Call batch from powershell.
johnoel Jan 11, 2024
12d18f2
Call batch from powershell.
johnoel Jan 11, 2024
0b7568b
Use bind.
johnoel Jan 11, 2024
24d7257
Use another path.
johnoel Jan 12, 2024
9037ad5
Try...
johnoel Jan 12, 2024
f29b901
Try2...
johnoel Jan 12, 2024
598bf4a
without quoutes
johnoel Jan 12, 2024
f909206
Single slash.
johnoel Jan 12, 2024
72f53a3
Clean ups.
johnoel Jan 12, 2024
e4c1f5e
Reorg popd.
johnoel Jan 12, 2024
dded0f3
Remove unneeded set.
johnoel Jan 12, 2024
a822435
Add warnings option and local admb build.
johnoel Jan 12, 2024
82889f2
Use docker if ADMB_HOME is not defined.
johnoel Jan 12, 2024
f7d6d35
Test docker only builds.
johnoel Jan 12, 2024
3107791
Use bind for build script.
johnoel Jan 12, 2024
6ab600c
Opps forgot build directory.
johnoel Jan 12, 2024
a648df0
Check for ADMB_HOME.
johnoel Jan 12, 2024
b9fea17
Have script use docker if admb is not installed locally.
johnoel Jan 12, 2024
ae7e4b1
Use docker if admb.cmd is not found.
johnoel Jan 12, 2024
013d19b
Add build type output.
johnoel Jan 12, 2024
f688e65
Use msys2 targets.
johnoel Jan 19, 2024
40daff5
Opps not a batch file.
johnoel Jan 19, 2024
0a6b64f
Check for win10.
johnoel Jan 20, 2024
89b13e4
Merge branch 'nmfs-ost:main' into main
johnoel Jan 20, 2024
dd1ddaf
Reorg conditionals.
johnoel Feb 2, 2024
813c4cb
Build ss3 with docker for windows.
johnoel Feb 6, 2024
46b4b8b
exit 0
johnoel Feb 6, 2024
7db49b2
No exit.
johnoel Feb 6, 2024
e5baae7
Build with docker for linux and windows.
johnoel Feb 6, 2024
4c5d09a
Use --admb docker.
johnoel Feb 6, 2024
b9554c1
Update.
johnoel Feb 6, 2024
8571845
Reorg windows build.
johnoel Feb 6, 2024
e0a6888
Try...
johnoel Feb 6, 2024
2afac51
Update.
johnoel Feb 6, 2024
da5833c
cmd.
johnoel Feb 6, 2024
7016396
exit 0
johnoel Feb 6, 2024
6ce1eb2
Try debug admb script.
johnoel Feb 6, 2024
06e49df
Again.
johnoel Feb 6, 2024
d380397
Ignore it.
johnoel Feb 6, 2024
2323767
Reorg.
johnoel Feb 6, 2024
fb552ea
Test it.
johnoel Feb 6, 2024
b493015
Is it here...
johnoel Feb 6, 2024
86edcad
Update.
johnoel Feb 6, 2024
91eec16
Update.
johnoel Feb 6, 2024
61cf500
Try more...
johnoel Feb 6, 2024
e7323e4
Update.
johnoel Feb 6, 2024
85004ca
Update.
johnoel Feb 7, 2024
5f45455
another try.
johnoel Feb 7, 2024
c268b4e
Redo...
johnoel Feb 7, 2024
f0659e9
typo.
johnoel Feb 7, 2024
5b522f2
enable
johnoel Feb 7, 2024
ade2e3f
Try agiain.
johnoel Feb 7, 2024
863d128
Update.
johnoel Feb 7, 2024
226d8eb
Update.
johnoel Feb 7, 2024
4437f0f
Force true.
johnoel Feb 7, 2024
9f455e1
remove del...
johnoel Feb 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 52 additions & 14 deletions .github/workflows/build-ss3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,31 @@ jobs:
if: matrix.config.os == 'ubuntu-latest'
run: sudo apt-get update

- name: Get admb and put in path, windows
if: matrix.config.os == 'windows-latest'
- name: Build stock synthesis for linux with p flag and docker
if: matrix.config.os == 'ubuntu-latest'
run: |
Invoke-WebRequest -Uri https://github.com/admb-project/admb/releases/download/admb-13.1/admb-13.1-windows.zip -OutFile "D:\a\ss3-source-code\ss3-source-code\admb-13.1.zip"
Expand-Archive -LiteralPath "D:\a\ss3-source-code\ss3-source-code\admb-13.1.zip" -DestinationPath "D:\a\ss3-source-code\ss3-source-code\"
echo "D:\a\ss3-source-code\ss3-source-code\admb-13.1\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
rm -rf SS330
rm -rf ss_osx.tar
mkdir SS330
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -p
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -o -p

- name: Build stock synthesis for mac with docker
if: matrix.config.os == 'macos-latest'
run: |
brew install docker
colima start
docker pull johnoel/admb:linux

rm -rf SS330
rm -rf ss_osx.tar
mkdir SS330
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330
/bin/bash ./Make_SS_330_new.sh --admb docker -b SS330 -o

colima stop

- name: checkout admb, mac
if: matrix.config.os == 'macos-latest'
Expand Down Expand Up @@ -82,12 +101,6 @@ jobs:
- name: Set up R
uses: r-lib/actions/setup-r@v2

- name: get info on gcc version and path
if: matrix.config.os == 'windows-latest'
run: |
g++ -v
echo $env:GITHUB_PATH

- name: Fetch tags
run: |
git fetch --tags
Expand Down Expand Up @@ -201,17 +214,40 @@ jobs:
writeLines(ver_info, "SS_versioninfo_330opt.tpl")
shell: Rscript {0}

- name: Build stock synthesis for windows
- name: Build stock synthesis for windows with docker
if: matrix.config.os == 'windows-latest'
run: |
cd Compile
pushd Compile
./Make_SS_safe.bat
./Make_SS_fast.bat
popd

- name: Get admb and put in path, windows
if: matrix.config.os == 'windows-latest'
run: |
Invoke-WebRequest -Uri https://github.com/admb-project/admb/releases/download/admb-13.1/admb-13.1b-windows.zip -OutFile "D:\a\ss3-source-code\ss3-source-code\admb-13.1.zip"
Expand-Archive -LiteralPath "D:\a\ss3-source-code\ss3-source-code\admb-13.1.zip" -DestinationPath "D:\a\ss3-source-code\ss3-source-code\"
echo "D:\a\ss3-source-code\ss3-source-code\admb-13.1\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: get info on gcc version and path
if: matrix.config.os == 'windows-latest'
run: |
g++ -v
echo $env:GITHUB_PATH

- name: Build stock synthesis for windows
if: matrix.config.os == 'windows-latest'
run: |
cd Compile
./Make_SS_fast.bat || true
./Make_SS_safe.bat || true
cd ..

- name: Move exes to a new folder on windows
if: matrix.config.os == 'windows-latest'
run: |
mkdir SS330
chmod 777 SS330
mv Compile/ss.exe SS330/
mv Compile/ss_opt.exe SS330/
mv SS330/ss.exe SS330/ss3_win.exe
Expand All @@ -223,6 +259,7 @@ jobs:
rm -rf SS330
rm -rf ss_osx.tar
mkdir SS330
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh -b SS330
/bin/bash ./Make_SS_330_new.sh -b SS330 -o

Expand All @@ -232,6 +269,7 @@ jobs:
rm -rf SS330
rm -rf ss_osx.tar
mkdir SS330
chmod 777 SS330
/bin/bash ./Make_SS_330_new.sh -b SS330 -p
/bin/bash ./Make_SS_330_new.sh -b SS330 -o -p

Expand Down Expand Up @@ -268,4 +306,4 @@ jobs:
uses: actions/upload-artifact@main
with:
name: ss3-${{ matrix.config.os }}
path: SS330/
path: SS330/
55 changes: 45 additions & 10 deletions Compile/Make_SS_fast.bat
Original file line number Diff line number Diff line change
@@ -1,20 +1,55 @@
REM compiling ss.exe (safe executable) with generic path
REM requires "Compile" directory in the same directory where
REM the .tpl files and this .bat file sit.
@echo off

@REM compiling ss.exe (safe executable) with generic path
@REM requires "Compile" directory in the same directory where
@REM the .tpl files and this .bat file sit.

cd ..
REM deleted temporary file

@REM deleted temporary file
del SS_functions.temp

REM create SS_functions.temp file combining various functions
@REM create SS_functions.temp file combining various functions
copy/b SS_biofxn.tpl+SS_miscfxn.tpl+SS_selex.tpl+SS_popdyn.tpl+SS_recruit.tpl+SS_benchfore.tpl+SS_expval.tpl+SS_objfunc.tpl+SS_write.tpl+SS_write_ssnew.tpl+SS_write_report.tpl+SS_ALK.tpl+SS_timevaryparm.tpl+SS_tagrecap.tpl SS_functions.temp

REM combine remaining files to create ss.tpl
@REM combine remaining files to create ss.tpl
copy/b SS_versioninfo_330opt.tpl+SS_readstarter.tpl+SS_readdata_330.tpl+SS_readcontrol_330.tpl+SS_param.tpl+SS_prelim.tpl+SS_global.tpl+SS_proced.tpl+SS_functions.temp "Compile\ss_opt.tpl"

REM compile executable
cd "Compile"
set CXX=g++
admb -f ss_opt
cd Compile

if defined ADMB_HOME (
if exist "%ADMB_HOME%\\admb.cmd" (
@echo "-- Building ss_opt.exe with %ADMB_HOME%\admb.cmd in '%CD%' --"
set CXX=g++
%ADMB_HOME%\\admb.cmd -f ss_opt
goto CHECK
)
)

@REM check if admb.cmd is in path
for /f "tokens=*" %%i in ('where admb.cmd 2^>^&1 ^| findstr "admb.cmd"') do (
@echo "-- Building ss_opt.exe with admb.cmd in '%CD%' --"
set CXX=g++
admb -f ss_opt.tpl
goto CHECK
)

@REM compile executable
for /f "tokens=*" %%i in ('where docker.exe 2^>^&1 ^| findstr "docker.exe"') do (
@echo "-- Building ss_opt.exe with docker in '%CD%' --"
for /f "tokens=*" %%j in ('ver ^| findstr "10.0.1"') do (
set "ISWINDOWS10=found"
)
if defined ISWINDOWS10 (
docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2019-winlibs -f ss_opt.tpl
) else (
docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2022-winlibs -f ss_opt.tpl
)
goto CHECK
)

:CHECK
if not exist ss_opt.exe (
@echo "Error: Unable to build ss_opt.exe"
exit /b 1
)
45 changes: 41 additions & 4 deletions Compile/Make_SS_safe.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
@echo off

::compiling ss.exe (safe executable) with generic path
::requires "Compile" directory in the same directory as the .tpl files and this .bat file

cd ..

::deleted temporary file
del SS_functions.temp

Expand All @@ -12,8 +16,41 @@ copy/b SS_versioninfo_330safe.tpl+SS_readstarter.tpl+SS_readdata_330.tpl+SS_read

::path=c:\admb;C:\rtools40\mingw64\bin;%path%

cd "Compile"
::set CXX=cl
set CXX=g++
cd Compile

if defined ADMB_HOME (
if exist "%ADMB_HOME%\\admb.cmd" (
@echo "-- Building ss.exe with %ADMB_HOME%\admb.cmd in '%CD%' --"
set CXX=g++
%ADMB_HOME%\\admb.cmd ss
goto CHECK
)
)

@REM check if admb.cmd is in path
for /f "tokens=*" %%i in ('where admb.cmd 2^>^&1 ^| findstr "admb.cmd"') do (
@echo "-- Building ss.exe with admb.cmd in '%CD%' --"
set CXX=g++
admb ss.tpl
goto CHECK
)

@REM compile executable
for /f "tokens=*" %%i in ('where docker.exe 2^>^&1 ^| findstr "docker.exe"') do (
@echo "-- Building ss.exe with docker in '%CD%' --"
for /f "tokens=*" %%j in ('ver ^| findstr "10.0.1"') do (
set "ISWINDOWS10=found"
)
if defined ISWINDOWS10 (
docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2019-winlibs ss.tpl
) else (
docker run --rm --mount source=%CD%,destination=C:\compile,type=bind --workdir C:\\compile johnoel/admb:windows-ltsc2022-winlibs ss.tpl
)
goto CHECK
)

admb ss
:CHECK
if not exist ss.exe (
@echo "Error: Unable to build ss.exe"
exit /b 1
)
20 changes: 20 additions & 0 deletions GNUmakefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,31 @@ all: clean
$(MAKE) ss
$(MAKE) ss_opt

docker:
chmod -R 777 $(CURDIR)
$(MAKE) USE_DOCKER=yes all

ss: ss.tpl
ifdef USE_DOCKER
ifeq ($(OS),Windows_NT)
docker run --rm --volume $(CURDIR):C:\\workdir\\ss --workdir C:\\workdir\\ss johnoel/admb:windows-ltsc2022-winlibs ss.tpl
else
docker run --rm --volume $(CURDIR):/workdir/ss:rw --workdir /workdir/ss johnoel/admb:linux ss.tpl
endif
else
$(MY_ADMB_HOME)admb $(DEBUG)$(STATIC_BUILD) ss.tpl
endif

ss_opt: ss_opt.tpl
ifdef USE_DOCKER
ifeq ($(OS),Windows_NT)
docker run --rm --volume $(CURDIR):C:\\workdir\\ss_opt --workdir C:\\workdir\\ss_opt johnoel/admb:windows-ltsc2022-winlibs ss_opt.tpl
else
docker run --rm --volume $(CURDIR):/workdir/ss_opt:rw --workdir /workdir/ss_opt johnoel/admb:linux ss_opt.tpl
endif
else
$(MY_ADMB_HOME)admb -f $(DEBUG)$(STATIC_BUILD) ss_opt.tpl
endif

ss.tpl: SS_functions.temp
cat SS_versioninfo_330safe.tpl SS_readstarter.tpl SS_readdata_330.tpl SS_readcontrol_330.tpl SS_param.tpl SS_prelim.tpl SS_global.tpl SS_proced.tpl SS_functions.temp > ss.tpl
Expand Down
95 changes: 82 additions & 13 deletions Make_SS_330_new.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ while [ "$1" != "" ]; do
;;
# check for ADMB directory and set
-a | --admb ) shift
ADMB_HOME=$1
export ADMB_HOME
PATH=$ADMB_HOME:$PATH
if [[ "$1" == "docker" ]] ; then
ADMB_HOME=docker
else
ADMB_HOME=$1
export ADMB_HOME
PATH=$ADMB_HOME:$PATH
fi
;;
# output help - usage
-h | --help ) Type=Default
Expand Down Expand Up @@ -116,32 +120,97 @@ if [ -f SS_functions.temp ]; then
fi

# create source files in build dir
mkdir -p $BUILD_DIR
if [[ ! -d "$BUILD_DIR" ]]; then
mkdir -p $BUILD_DIR
fi
case $BUILD_TYPE in
ss_opt ) grep "opt" SS_versioninfo_330opt.tpl
cat_opt_files
;;
ss ) grep "safe" SS_versioninfo_330safe.tpl
cat_safe_files
;;
esac
if [ ! -f $BUILD_DIR/$BUILD_TYPE.tpl ]; then
echo "Error: Unable to find $BUILD_DIR/$BUILD_TYPE.tpl"
exit
fi

# if admb is not in path, use docker to build.
if [[ "$ADMB_HOME" != "docker" ]] ; then
if [[ "$OS" == "Windows_NT" ]] ; then
if [[ -x "$(command -v admb.sh)" ]] ; then
ADMB_HOME="$(dirname $(command -v admb.sh))"
else
unset ADMB_HOME
fi
else
if [[ -x "$(command -v admb)" ]] ; then
ADMB_HOME="$(dirname $(command -v admb))"
else
unset ADMB_HOME
fi
fi
if [[ -z "$ADMB_HOME" ]] ; then
ADMB_HOME=docker
fi
fi

# debug info
if [[ "$DEBUG" == "on" ]] ; then
display_settings
else
echo "-- Building $BUILD_TYPE in '$BUILD_DIR' --"
if [[ "$ADMB_HOME" == "docker" ]] ; then
echo "-- Building $BUILD_TYPE with docker in '$BUILD_DIR' --"
else
echo "-- Building $BUILD_TYPE in '$BUILD_DIR' --"
fi
fi

# change to build dir and build
cd $BUILD_DIR
admb $OPTFLAG $STATICFLAG $BUILD_TYPE
chmod a+x $BUILD_TYPE

# output warnings
if [[ "$WARNINGS" == "on" ]] ; then
echo "... compiling a second time to get warnings ..."
g++ -c -std=c++0x -O3 -I. -I"$ADMB_HOME/include" -I"/$ADMB_HOME/include/contrib" -o$BUILD_TYPE.obj $BUILD_TYPE.cpp -Wall -Wextra
if [[ "$ADMB_HOME" == "docker" ]] ; then
if [[ "$OS" == "Windows_NT" ]] ; then
if [[ "`ver`" =~ "Version 10.0.1" ]]; then
WINDOWS10=true
fi
if [[ "$WARNINGS" == "on" ]] ; then
if [[ "$WINDOWS10" == "true" ]] ; then
docker run --env CXXFLAGS="-Wall -Wextra" --rm --mount source=`cygpath -w $PWD`\\$BUILD_DIR,destination=C:\\$BUILD_TYPE,mount=bind --workdir C:\\$BUILD_TYPE johnoel/admb:windows-ltsc2019-winlibs $BUILD_TYPE.tpl
else
docker run --env CXXFLAGS="-Wall -Wextra" --rm --mount source=`cygpath -w $PWD`\\$BUILD_DIR,destination=C:\\$BUILD_TYPE,mount=bind --workdir C:\\$BUILD_TYPE johnoel/admb:windows-ltsc2022-winlibs $BUILD_TYPE.tpl
fi
else
if [[ "$WINDOWS10" == "true" ]] ; then
docker run --rm --mount source=`cygpath -w $PWD`\\$BUILD_DIR,destination=C:\\$BUILD_TYPE,mount=bind --workdir C:\\$BUILD_TYPE johnoel/admb:windows-ltsc2019-winlibs $BUILD_TYPE.tpl
else
docker run --rm --mount source=`cygpath -w $PWD`\\$BUILD_DIR,destination=C:\\$BUILD_TYPE,mount=bind --workdir C:\\$BUILD_TYPE johnoel/admb:windows-ltsc2022-winlibs $BUILD_TYPE.tpl
fi
fi
else
if [[ "$WARNINGS" == "on" ]] ; then
docker run --env CXXFLAGS="-Wall -Wextra" --rm --mount source=$PWD/$BUILD_DIR,destination=/$BUILD_TYPE,type=bind --workdir /$BUILD_TYPE johnoel/admb:linux $BUILD_TYPE.tpl
else
docker run --rm --mount source=$PWD/$BUILD_DIR,destination=/$BUILD_TYPE,type=bind --workdir /$BUILD_TYPE johnoel/admb:linux $BUILD_TYPE.tpl
fi
fi
else
command pushd $BUILD_DIR > /dev/null
if [[ "$WARNINGS" == "on" ]] ; then
export CXXFLAGS="-Wall -Wextra"
fi
if [[ "$OS" == "Windows_NT" ]] ; then
admb.sh $OPTFLAG $STATICFLAG $BUILD_TYPE
chmod a+x $BUILD_TYPE
else
admb $OPTFLAG $STATICFLAG $BUILD_TYPE
fi
command popd > /dev/null
fi

# output warnings
#if [[ "$WARNINGS" == "on" ]] ; then
# echo "... compiling a second time to get warnings ..."
# g++ -c -std=c++0x -O3 -I. -I"$ADMB_HOME/include" -I"/$ADMB_HOME/include/contrib" -o$BUILD_TYPE.obj $BUILD_TYPE.cpp -Wall -Wextra
#fi

exit