From 06b168db0d93738caa6e64322292c297521da0d0 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 06:38:21 -0500 Subject: [PATCH 01/12] test new roadrunner libs --- beta/setup_libroadrunner_v2.py | 192 +++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 beta/setup_libroadrunner_v2.py diff --git a/beta/setup_libroadrunner_v2.py b/beta/setup_libroadrunner_v2.py new file mode 100644 index 000000000..afe195129 --- /dev/null +++ b/beta/setup_libroadrunner_v2.py @@ -0,0 +1,192 @@ +# This script attempts to download the libRoadrunner (binary) libraries and +# headers for your particular operating system. It installs them in +# the appropriate /addons directory which the Makefile can find. +# +# Author: Randy Heiland + +import platform +import urllib.request +import os +import sys +import tarfile +import zipfile + +def reminder_dynamic_link_path_macos(): + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") + print('export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') + + print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + +def reminder_dynamic_link_path_linux(): + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") + print('export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') + + print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + +os_type = platform.system() + +# Old: +# if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner")): + +# New: July 2023 - trying to be smarter about deciding whether to (re)download libRR +# NOTE: needs to be tested cross-platform! +if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner","include","rr","C","rrc_api.h")): + print('\nlibroadrunner already installed.\n') + + # regardless, let's remind the user about the env var requirement! + if os_type.lower() == 'darwin': + reminder_dynamic_link_path_macos() + elif os_type.lower().startswith("linux"): + reminder_dynamic_link_path_linux() + +else: + print('\nThis model requires the libRoadrunner libraries which will now be downloaded.') + print('(for your ',os_type, ' operating system)') + + # Assume Windows + rr_file = "" + url = "" + + mac_silicon = False + if os_type.lower() == 'darwin': + reminder_dynamic_link_path_macos() + if "ARM64" in platform.uname().version: + # pass + # print('... for the arm64 processor.') + # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/libs/macos12_arm64/libroadrunner_c_api.dylib" + rr_file = "roadrunner_macos_arm64.tar.gz" + # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.tar.gz" + url = "https://github.com/rheiland/intracellular_libs/blob/main/ode/roadrunner_macos_arm64.zip" + mac_silicon = True + else: + rr_file = "roadrunner-osx-10.9-cp36m.tar.gz" + url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" + elif os_type.lower().startswith("win"): + rr_file = "roadrunner-win64-vs14-cp35m.zip" + url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" + elif os_type.lower().startswith("linux"): + reminder_dynamic_link_path_linux() + rr_file = "cpplibroadrunner-1.3.0-linux_x86_64.tar.gz" + url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.3/" + rr_file + "/download" + else: + print("Your operating system seems to be unsupported. Please submit a ticket at https://sourceforge.net/p/physicell/tickets/ ") + sys.exit(1) + + print("url=",url) + if mac_silicon: + fname = url.split('/')[-1] + else: + fname = url.split('/')[-2] + print("fname=",fname) + + # home = os.path.expanduser("~") + print('libRoadRunner will now be installed into this location:') + # dir_name = os.path.join(home, 'libroadrunner') + dir_name = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'addons', 'libRoadrunner') + print(dir_name + '\n') + # print(' - Press ENTER to confirm the location') + # print(' - Press CTL-C to abort the installation') + # print(' - Or specify a different location below\n') + prompt_str = '[' + dir_name + '] >>> ' + try: + # response = input(prompt_str) + # if (response == ""): + if (True): + # print('got Enter') + if not os.path.exists(dir_name): + try: + os.makedirs(dir_name) + except: + print('Error trying to create directory: ',dir_name) + exit(1) + # else: + # print(type(response)) + # dir_name = os.path.expanduser(response) + # if not os.path.exists(dir_name): + # try: + # os.makedirs(dir_name) + # except: + # print('Error trying to create directory: ',dir_name) + # exit(1) + except: + print(' installation canceled\n') + exit(1) + + print('Beginning download of libroadrunner into ' + dir_name + ' ...') + print(url) + + my_file = os.path.join(dir_name, fname) + print('my_file = ',my_file) + + if os_type.lower().startswith("win"): + rrlib_dir = my_file[:-4] + else: # darwin or linux + if mac_silicon: + # idx_end = my_file.rindex('/') + # rrlib_dir = my_file[:idx_end] + rrlib_dir = my_file[:-7] + # rrlib_dir = my_file + else: + rrlib_dir = my_file[:-7] + print('rrlib_dir = ',rrlib_dir) + + def download_cb(blocknum, blocksize, totalsize): + readsofar = blocknum * blocksize + if totalsize > 0: + percent = readsofar * 1e2 / totalsize + s = "\r%5.1f%% %*d / %d" % ( + percent, len(str(totalsize)), readsofar, totalsize) + sys.stderr.write(s) + if readsofar >= totalsize: # near the end + sys.stderr.write("\n") + else: # total size is unknown + sys.stderr.write("read %d\n" % (readsofar,)) + + urllib.request.urlretrieve(url, my_file, download_cb) + + new_dir_name = "roadrunner" + os.chdir(dir_name) + print('installing (uncompressing) the file...') + if os_type.lower().startswith("win"): + try: + with zipfile.ZipFile(rr_file) as zf: + zf.extractall('.') + os.rename("roadrunner-win64-vs14-cp35m", new_dir_name) + except: + print('error unzipping the file') + exit(1) + else: # Darwin or Linux + try: + print("untarring ",rr_file) + tar = tarfile.open(rr_file) + tar.extractall() + tar.close() + if 'darwin' in os_type.lower(): + if mac_silicon: + os.rename("roadrunner_macos_arm64", new_dir_name) + else: + os.rename("roadrunner-osx-10.9-cp36m", new_dir_name) + else: + os.rename("libroadrunner", new_dir_name) + except: + if mac_silicon: + print() + # pass + else: + print('error untarring the file') + exit(1) + + print('Done.\n') + + # # LIBRR_DIR := /Users/heiland/libroadrunner/roadrunner-osx-10.9-cp36m + # print("Replace the following variables in your PhysiCell Makefile with these:\n") + # #print("LIBRR_DIR := /Users/heiland/libroadrunner/roadrunner-osx-10.9-cp36m") + # print("LIBRR_DIR := " + rrlib_dir) + # if os_type == 'Windows': + # print("LIBRR_LIBS := " + rrlib_dir + "/bin\n") + # else: + # print("LIBRR_LIBS := " + rrlib_dir + "/lib\n") From 1d7a039bf37fe87a9b9c6098098edadd4babac25 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 06:53:44 -0500 Subject: [PATCH 02/12] fix path --- addons/libRoadrunner/src/librr_intracellular.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/libRoadrunner/src/librr_intracellular.h b/addons/libRoadrunner/src/librr_intracellular.h index 4ca8b041a..f003d082b 100644 --- a/addons/libRoadrunner/src/librr_intracellular.h +++ b/addons/libRoadrunner/src/librr_intracellular.h @@ -16,8 +16,8 @@ // #define STATIC_RRC // #include "rrc_api.h" // #include "rrc_types.h" -#include "../roadrunner/include/rr/C/rrc_api.h" -#include "../roadrunner/include/rr/C/rrc_types.h" +#include "../roadrunner/include/rr/rrc_api.h" +#include "../roadrunner/include/rr/rrc_types.h" // #include "rrc_utilities.h" extern "C" rrc::RRHandle createRRInstance(); // #endif From e7a355345b946311bd73807df90dfa3517471344 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 11:06:37 -0500 Subject: [PATCH 03/12] update for Mac arm64 --- beta/setup_libroadrunner_v2.py | 46 +++++++++------------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/beta/setup_libroadrunner_v2.py b/beta/setup_libroadrunner_v2.py index afe195129..a8013634c 100644 --- a/beta/setup_libroadrunner_v2.py +++ b/beta/setup_libroadrunner_v2.py @@ -6,6 +6,7 @@ import platform import urllib.request +import urllib.error import os import sys import tarfile @@ -55,12 +56,8 @@ def reminder_dynamic_link_path_linux(): if os_type.lower() == 'darwin': reminder_dynamic_link_path_macos() if "ARM64" in platform.uname().version: - # pass - # print('... for the arm64 processor.') - # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/libs/macos12_arm64/libroadrunner_c_api.dylib" - rr_file = "roadrunner_macos_arm64.tar.gz" - # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.tar.gz" - url = "https://github.com/rheiland/intracellular_libs/blob/main/ode/roadrunner_macos_arm64.zip" + rr_file = "roadrunner_macos_arm64.zip" + url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.zip" mac_silicon = True else: rr_file = "roadrunner-osx-10.9-cp36m.tar.gz" @@ -83,14 +80,9 @@ def reminder_dynamic_link_path_linux(): fname = url.split('/')[-2] print("fname=",fname) - # home = os.path.expanduser("~") print('libRoadRunner will now be installed into this location:') - # dir_name = os.path.join(home, 'libroadrunner') dir_name = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'addons', 'libRoadrunner') print(dir_name + '\n') - # print(' - Press ENTER to confirm the location') - # print(' - Press CTL-C to abort the installation') - # print(' - Or specify a different location below\n') prompt_str = '[' + dir_name + '] >>> ' try: # response = input(prompt_str) @@ -117,7 +109,7 @@ def reminder_dynamic_link_path_linux(): exit(1) print('Beginning download of libroadrunner into ' + dir_name + ' ...') - print(url) + print("url=" ,url) my_file = os.path.join(dir_name, fname) print('my_file = ',my_file) @@ -126,10 +118,7 @@ def reminder_dynamic_link_path_linux(): rrlib_dir = my_file[:-4] else: # darwin or linux if mac_silicon: - # idx_end = my_file.rindex('/') - # rrlib_dir = my_file[:idx_end] - rrlib_dir = my_file[:-7] - # rrlib_dir = my_file + rrlib_dir = my_file[:-4] else: rrlib_dir = my_file[:-7] print('rrlib_dir = ',rrlib_dir) @@ -155,30 +144,19 @@ def download_cb(blocknum, blocksize, totalsize): try: with zipfile.ZipFile(rr_file) as zf: zf.extractall('.') - os.rename("roadrunner-win64-vs14-cp35m", new_dir_name) + os.rename("roadrunner-win64-vs14-cp35m", new_dir_name) except: print('error unzipping the file') exit(1) else: # Darwin or Linux try: - print("untarring ",rr_file) - tar = tarfile.open(rr_file) - tar.extractall() - tar.close() - if 'darwin' in os_type.lower(): - if mac_silicon: - os.rename("roadrunner_macos_arm64", new_dir_name) - else: - os.rename("roadrunner-osx-10.9-cp36m", new_dir_name) - else: - os.rename("libroadrunner", new_dir_name) + print(f'unzipping (uncompressing) {rr_file}') + with zipfile.ZipFile(rr_file) as zf: + zf.extractall('.') + # os.rename("roadrunner_macos_arm64", new_dir_name) # new workflow has this name except: - if mac_silicon: - print() - # pass - else: - print('error untarring the file') - exit(1) + print('error unzipping the file') + exit(1) print('Done.\n') From 47c90b5e6b2f51681252f380675222c87c7f6afd Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 11:29:07 -0500 Subject: [PATCH 04/12] rename --- beta/setup_libroadrunner.py | 45 +++------ beta/setup_libroadrunner_v2.py | 170 --------------------------------- 2 files changed, 12 insertions(+), 203 deletions(-) delete mode 100644 beta/setup_libroadrunner_v2.py diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index bf6148f06..a8013634c 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -6,6 +6,7 @@ import platform import urllib.request +import urllib.error import os import sys import tarfile @@ -55,11 +56,8 @@ def reminder_dynamic_link_path_linux(): if os_type.lower() == 'darwin': reminder_dynamic_link_path_macos() if "ARM64" in platform.uname().version: - # pass - # print('... for the arm64 processor.') - # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/libs/macos12_arm64/libroadrunner_c_api.dylib" - rr_file = "roadrunner_macos_arm64.tar.gz" - url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.tar.gz" + rr_file = "roadrunner_macos_arm64.zip" + url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.zip" mac_silicon = True else: rr_file = "roadrunner-osx-10.9-cp36m.tar.gz" @@ -82,14 +80,9 @@ def reminder_dynamic_link_path_linux(): fname = url.split('/')[-2] print("fname=",fname) - # home = os.path.expanduser("~") print('libRoadRunner will now be installed into this location:') - # dir_name = os.path.join(home, 'libroadrunner') dir_name = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'addons', 'libRoadrunner') print(dir_name + '\n') - # print(' - Press ENTER to confirm the location') - # print(' - Press CTL-C to abort the installation') - # print(' - Or specify a different location below\n') prompt_str = '[' + dir_name + '] >>> ' try: # response = input(prompt_str) @@ -116,7 +109,7 @@ def reminder_dynamic_link_path_linux(): exit(1) print('Beginning download of libroadrunner into ' + dir_name + ' ...') - print(url) + print("url=" ,url) my_file = os.path.join(dir_name, fname) print('my_file = ',my_file) @@ -125,10 +118,7 @@ def reminder_dynamic_link_path_linux(): rrlib_dir = my_file[:-4] else: # darwin or linux if mac_silicon: - # idx_end = my_file.rindex('/') - # rrlib_dir = my_file[:idx_end] - rrlib_dir = my_file[:-7] - # rrlib_dir = my_file + rrlib_dir = my_file[:-4] else: rrlib_dir = my_file[:-7] print('rrlib_dir = ',rrlib_dir) @@ -154,30 +144,19 @@ def download_cb(blocknum, blocksize, totalsize): try: with zipfile.ZipFile(rr_file) as zf: zf.extractall('.') - os.rename("roadrunner-win64-vs14-cp35m", new_dir_name) + os.rename("roadrunner-win64-vs14-cp35m", new_dir_name) except: print('error unzipping the file') exit(1) else: # Darwin or Linux try: - print("untarring ",rr_file) - tar = tarfile.open(rr_file) - tar.extractall() - tar.close() - if 'darwin' in os_type.lower(): - if mac_silicon: - os.rename("roadrunner_macos_arm64", new_dir_name) - else: - os.rename("roadrunner-osx-10.9-cp36m", new_dir_name) - else: - os.rename("libroadrunner", new_dir_name) + print(f'unzipping (uncompressing) {rr_file}') + with zipfile.ZipFile(rr_file) as zf: + zf.extractall('.') + # os.rename("roadrunner_macos_arm64", new_dir_name) # new workflow has this name except: - if mac_silicon: - print() - # pass - else: - print('error untarring the file') - exit(1) + print('error unzipping the file') + exit(1) print('Done.\n') diff --git a/beta/setup_libroadrunner_v2.py b/beta/setup_libroadrunner_v2.py deleted file mode 100644 index a8013634c..000000000 --- a/beta/setup_libroadrunner_v2.py +++ /dev/null @@ -1,170 +0,0 @@ -# This script attempts to download the libRoadrunner (binary) libraries and -# headers for your particular operating system. It installs them in -# the appropriate /addons directory which the Makefile can find. -# -# Author: Randy Heiland - -import platform -import urllib.request -import urllib.error -import os -import sys -import tarfile -import zipfile - -def reminder_dynamic_link_path_macos(): - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") - print('export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') - - print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - -def reminder_dynamic_link_path_linux(): - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") - print('export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') - - print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - -os_type = platform.system() - -# Old: -# if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner")): - -# New: July 2023 - trying to be smarter about deciding whether to (re)download libRR -# NOTE: needs to be tested cross-platform! -if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner","include","rr","C","rrc_api.h")): - print('\nlibroadrunner already installed.\n') - - # regardless, let's remind the user about the env var requirement! - if os_type.lower() == 'darwin': - reminder_dynamic_link_path_macos() - elif os_type.lower().startswith("linux"): - reminder_dynamic_link_path_linux() - -else: - print('\nThis model requires the libRoadrunner libraries which will now be downloaded.') - print('(for your ',os_type, ' operating system)') - - # Assume Windows - rr_file = "" - url = "" - - mac_silicon = False - if os_type.lower() == 'darwin': - reminder_dynamic_link_path_macos() - if "ARM64" in platform.uname().version: - rr_file = "roadrunner_macos_arm64.zip" - url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.zip" - mac_silicon = True - else: - rr_file = "roadrunner-osx-10.9-cp36m.tar.gz" - url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" - elif os_type.lower().startswith("win"): - rr_file = "roadrunner-win64-vs14-cp35m.zip" - url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" - elif os_type.lower().startswith("linux"): - reminder_dynamic_link_path_linux() - rr_file = "cpplibroadrunner-1.3.0-linux_x86_64.tar.gz" - url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.3/" + rr_file + "/download" - else: - print("Your operating system seems to be unsupported. Please submit a ticket at https://sourceforge.net/p/physicell/tickets/ ") - sys.exit(1) - - print("url=",url) - if mac_silicon: - fname = url.split('/')[-1] - else: - fname = url.split('/')[-2] - print("fname=",fname) - - print('libRoadRunner will now be installed into this location:') - dir_name = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'addons', 'libRoadrunner') - print(dir_name + '\n') - prompt_str = '[' + dir_name + '] >>> ' - try: - # response = input(prompt_str) - # if (response == ""): - if (True): - # print('got Enter') - if not os.path.exists(dir_name): - try: - os.makedirs(dir_name) - except: - print('Error trying to create directory: ',dir_name) - exit(1) - # else: - # print(type(response)) - # dir_name = os.path.expanduser(response) - # if not os.path.exists(dir_name): - # try: - # os.makedirs(dir_name) - # except: - # print('Error trying to create directory: ',dir_name) - # exit(1) - except: - print(' installation canceled\n') - exit(1) - - print('Beginning download of libroadrunner into ' + dir_name + ' ...') - print("url=" ,url) - - my_file = os.path.join(dir_name, fname) - print('my_file = ',my_file) - - if os_type.lower().startswith("win"): - rrlib_dir = my_file[:-4] - else: # darwin or linux - if mac_silicon: - rrlib_dir = my_file[:-4] - else: - rrlib_dir = my_file[:-7] - print('rrlib_dir = ',rrlib_dir) - - def download_cb(blocknum, blocksize, totalsize): - readsofar = blocknum * blocksize - if totalsize > 0: - percent = readsofar * 1e2 / totalsize - s = "\r%5.1f%% %*d / %d" % ( - percent, len(str(totalsize)), readsofar, totalsize) - sys.stderr.write(s) - if readsofar >= totalsize: # near the end - sys.stderr.write("\n") - else: # total size is unknown - sys.stderr.write("read %d\n" % (readsofar,)) - - urllib.request.urlretrieve(url, my_file, download_cb) - - new_dir_name = "roadrunner" - os.chdir(dir_name) - print('installing (uncompressing) the file...') - if os_type.lower().startswith("win"): - try: - with zipfile.ZipFile(rr_file) as zf: - zf.extractall('.') - os.rename("roadrunner-win64-vs14-cp35m", new_dir_name) - except: - print('error unzipping the file') - exit(1) - else: # Darwin or Linux - try: - print(f'unzipping (uncompressing) {rr_file}') - with zipfile.ZipFile(rr_file) as zf: - zf.extractall('.') - # os.rename("roadrunner_macos_arm64", new_dir_name) # new workflow has this name - except: - print('error unzipping the file') - exit(1) - - print('Done.\n') - - # # LIBRR_DIR := /Users/heiland/libroadrunner/roadrunner-osx-10.9-cp36m - # print("Replace the following variables in your PhysiCell Makefile with these:\n") - # #print("LIBRR_DIR := /Users/heiland/libroadrunner/roadrunner-osx-10.9-cp36m") - # print("LIBRR_DIR := " + rrlib_dir) - # if os_type == 'Windows': - # print("LIBRR_LIBS := " + rrlib_dir + "/bin\n") - # else: - # print("LIBRR_LIBS := " + rrlib_dir + "/lib\n") From 4762184970019039ecde7135342c40fabdea545c Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 15:06:25 -0500 Subject: [PATCH 05/12] drop /C for headers --- .../ode/ode_energy/Makefile | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/sample_projects_intracellular/ode/ode_energy/Makefile b/sample_projects_intracellular/ode/ode_energy/Makefile index 42168464c..82504c4a9 100644 --- a/sample_projects_intracellular/ode/ode_energy/Makefile +++ b/sample_projects_intracellular/ode/ode_energy/Makefile @@ -17,12 +17,8 @@ OSFLAG := ifeq ($(OS),Windows_NT) OSFLAG += -D WIN32 OMP_LIB := -# LIBRR_DIR := C:\Users\heiland\libroadrunner\roadrunner-win64-vs14-cp35m -# LIBRR_LIBS := C:\Users\heiland\libroadrunner\roadrunner-win64-vs14-cp35m/bin -# LIBRR_CFLAGS := -I${LIBRR_DIR}/include/rr/C -# CFLAGS := -march=$(ARCH) -fomit-frame-pointer -fopenmp -m64 -std=c++11 -D ADDON_ROADRUNNER LIBRR_DIR := .\addons\libRoadrunner\roadrunner - LIBRR_CFLAGS := -I${LIBRR_DIR}\include\rr\C + LIBRR_CFLAGS := -I${LIBRR_DIR}\include\rr LIBRR_LIBS := ${LIBRR_DIR}\lib ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) OSFLAG += -D AMD64 @@ -37,31 +33,15 @@ else OMP_LIB := # LIBRR_DIR := $(shell pwd)/intracellular_libs/roadrunner LIBRR_DIR := ./addons/libRoadrunner/roadrunner - LIBRR_CFLAGS := -I${LIBRR_DIR}/include/rr/C + LIBRR_CFLAGS := -I${LIBRR_DIR}/include/rr LIBRR_LIBS := ${LIBRR_DIR}/lib endif ifeq ($(UNAME_S),Darwin) OSFLAG += -D OSX LIBRR_DIR := ./addons/libRoadrunner/roadrunner - LIBRR_CFLAGS := -I${LIBRR_DIR}/include/rr/C + LIBRR_CFLAGS := -I${LIBRR_DIR}/include/rr LIBRR_LIBS := ${LIBRR_DIR}/lib endif - -# Not sure if useful later or not. -# UNAME_P := $(shell uname -p) -# ifeq ($(UNAME_P),x86_64) -# OSFLAG += -D AMD64 -# LIBRR_DIR := $(shell pwd)/intracellular_libs/roadrunner -# LIBRR_CFLAGS := -I${LIBRR_DIR}/include/rr/C -# # CFLAGS := -march=$(ARCH) -fomit-frame-pointer -fopenmp -m64 -std=c++11 -D LIBROADRUNNER -# CFLAGS := -march=$(ARCH) -fomit-frame-pointer -fopenmp -m64 -std=c++11 -D ADDON_ROADRUNNER -# endif -# ifneq ($(filter %86,$(UNAME_P)),) -# OSFLAG += -D IA32 -# endif -# ifneq ($(filter arm%,$(UNAME_P)),) -# OSFLAG += -D ARM -# endif endif COMPILE_COMMAND := $(CC) $(CFLAGS) $(LIBRR_CFLAGS) From ff8e5592ce779a2aa7fb08f2cbd0685a0b359155 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 15:09:11 -0500 Subject: [PATCH 06/12] fixes --- beta/setup_libroadrunner.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index a8013634c..8d7dabc59 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -30,12 +30,8 @@ def reminder_dynamic_link_path_linux(): os_type = platform.system() -# Old: -# if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner")): - -# New: July 2023 - trying to be smarter about deciding whether to (re)download libRR # NOTE: needs to be tested cross-platform! -if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner","include","rr","C","rrc_api.h")): +if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner","include","rr","rrc_api.h")): print('\nlibroadrunner already installed.\n') # regardless, let's remind the user about the env var requirement! From 0df4438ffc1acc3a7df8441435a6cc7e6afb2c96 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 15:27:33 -0500 Subject: [PATCH 07/12] remind shared lib path --- sample_projects_intracellular/ode/ode_energy/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sample_projects_intracellular/ode/ode_energy/Makefile b/sample_projects_intracellular/ode/ode_energy/Makefile index 82504c4a9..d646736bd 100644 --- a/sample_projects_intracellular/ode/ode_energy/Makefile +++ b/sample_projects_intracellular/ode/ode_energy/Makefile @@ -27,6 +27,7 @@ ifeq ($(OS),Windows_NT) OSFLAG += -D IA32 endif else +# @echo remember UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) OSFLAG += -D LINUX @@ -37,6 +38,7 @@ else LIBRR_LIBS := ${LIBRR_DIR}/lib endif ifeq ($(UNAME_S),Darwin) +# @echo remember OSFLAG += -D OSX LIBRR_DIR := ./addons/libRoadrunner/roadrunner LIBRR_CFLAGS := -I${LIBRR_DIR}/include/rr @@ -79,6 +81,8 @@ all: libRoadrunner main.cpp $(ALL_OBJECTS) $(COMPILE_COMMAND) $(OMP_LIB) -o $(PROGRAM_NAME) $(ALL_OBJECTS) main.cpp -L$(LIBRR_LIBS) -lroadrunner_c_api @echo @echo created $(PROGRAM_NAME) + @echo 'remember on Mac: export DYLD_LIBRARY_PATH=$$DYLD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib' + @echo 'remember on Linux: export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib' @echo name: From ee660dfe2a0077f58a0601e3fa1e8d7e011c4265 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 16:20:46 -0500 Subject: [PATCH 08/12] update mac .zip name --- beta/setup_libroadrunner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index 8d7dabc59..1095fb065 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -53,11 +53,11 @@ def reminder_dynamic_link_path_linux(): reminder_dynamic_link_path_macos() if "ARM64" in platform.uname().version: rr_file = "roadrunner_macos_arm64.zip" - url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.zip" + url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file mac_silicon = True else: - rr_file = "roadrunner-osx-10.9-cp36m.tar.gz" - url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" + rr_file = "roadrunner_mac_x86_64.zip" + url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file elif os_type.lower().startswith("win"): rr_file = "roadrunner-win64-vs14-cp35m.zip" url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" From ffa5648d35455391c73055ab68da7bcc7f2f000d Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 16:41:05 -0500 Subject: [PATCH 09/12] update for ubuntu --- beta/setup_libroadrunner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index 1095fb065..b9c17744f 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -63,8 +63,8 @@ def reminder_dynamic_link_path_linux(): url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" elif os_type.lower().startswith("linux"): reminder_dynamic_link_path_linux() - rr_file = "cpplibroadrunner-1.3.0-linux_x86_64.tar.gz" - url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.3/" + rr_file + "/download" + rr_file = "roadrunner_ubuntu_24.zip" + url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file else: print("Your operating system seems to be unsupported. Please submit a ticket at https://sourceforge.net/p/physicell/tickets/ ") sys.exit(1) @@ -116,7 +116,8 @@ def reminder_dynamic_link_path_linux(): if mac_silicon: rrlib_dir = my_file[:-4] else: - rrlib_dir = my_file[:-7] + # rrlib_dir = my_file[:-7] + rrlib_dir = my_file[:-4] print('rrlib_dir = ',rrlib_dir) def download_cb(blocknum, blocksize, totalsize): From 2d0e02ccdde82b0cb788d9a316fda92150d6922d Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 17:20:35 -0500 Subject: [PATCH 10/12] fix macos --- beta/setup_libroadrunner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index b9c17744f..cc1bf0106 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -56,7 +56,7 @@ def reminder_dynamic_link_path_linux(): url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file mac_silicon = True else: - rr_file = "roadrunner_mac_x86_64.zip" + rr_file = "roadrunner_macos_x86_64.zip" url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file elif os_type.lower().startswith("win"): rr_file = "roadrunner-win64-vs14-cp35m.zip" From f9972d96187d4ad16534909491e047796b3dc489 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sat, 8 Mar 2025 17:39:39 -0500 Subject: [PATCH 11/12] fixes --- beta/setup_libroadrunner.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index cc1bf0106..81a277b72 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -48,17 +48,17 @@ def reminder_dynamic_link_path_linux(): rr_file = "" url = "" - mac_silicon = False + workflow_v2 = True if os_type.lower() == 'darwin': reminder_dynamic_link_path_macos() if "ARM64" in platform.uname().version: rr_file = "roadrunner_macos_arm64.zip" url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file - mac_silicon = True else: rr_file = "roadrunner_macos_x86_64.zip" url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file elif os_type.lower().startswith("win"): + workflow_v2 = False rr_file = "roadrunner-win64-vs14-cp35m.zip" url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" elif os_type.lower().startswith("linux"): @@ -70,7 +70,7 @@ def reminder_dynamic_link_path_linux(): sys.exit(1) print("url=",url) - if mac_silicon: + if workflow_v2: fname = url.split('/')[-1] else: fname = url.split('/')[-2] @@ -110,14 +110,11 @@ def reminder_dynamic_link_path_linux(): my_file = os.path.join(dir_name, fname) print('my_file = ',my_file) - if os_type.lower().startswith("win"): - rrlib_dir = my_file[:-4] - else: # darwin or linux - if mac_silicon: - rrlib_dir = my_file[:-4] - else: - # rrlib_dir = my_file[:-7] - rrlib_dir = my_file[:-4] + rrlib_dir = my_file[:-4] + # if os_type.lower().startswith("win"): + # rrlib_dir = my_file[:-4] + # else: # darwin or linux + # rrlib_dir = my_file[:-4] print('rrlib_dir = ',rrlib_dir) def download_cb(blocknum, blocksize, totalsize): From 119905db98e48507e49cae06e469036abe94891a Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Sun, 9 Mar 2025 13:38:51 -0400 Subject: [PATCH 12/12] handle new Windows zip --- beta/setup_libroadrunner.py | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index 81a277b72..5d1d463cf 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -48,7 +48,6 @@ def reminder_dynamic_link_path_linux(): rr_file = "" url = "" - workflow_v2 = True if os_type.lower() == 'darwin': reminder_dynamic_link_path_macos() if "ARM64" in platform.uname().version: @@ -58,9 +57,8 @@ def reminder_dynamic_link_path_linux(): rr_file = "roadrunner_macos_x86_64.zip" url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file elif os_type.lower().startswith("win"): - workflow_v2 = False - rr_file = "roadrunner-win64-vs14-cp35m.zip" - url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" + rr_file = "roadrunner_win_x86_64.zip" + url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/" + rr_file elif os_type.lower().startswith("linux"): reminder_dynamic_link_path_linux() rr_file = "roadrunner_ubuntu_24.zip" @@ -69,11 +67,7 @@ def reminder_dynamic_link_path_linux(): print("Your operating system seems to be unsupported. Please submit a ticket at https://sourceforge.net/p/physicell/tickets/ ") sys.exit(1) - print("url=",url) - if workflow_v2: - fname = url.split('/')[-1] - else: - fname = url.split('/')[-2] + fname = url.split('/')[-1] print("fname=",fname) print('libRoadRunner will now be installed into this location:') @@ -138,7 +132,6 @@ def download_cb(blocknum, blocksize, totalsize): try: with zipfile.ZipFile(rr_file) as zf: zf.extractall('.') - os.rename("roadrunner-win64-vs14-cp35m", new_dir_name) except: print('error unzipping the file') exit(1) @@ -147,18 +140,8 @@ def download_cb(blocknum, blocksize, totalsize): print(f'unzipping (uncompressing) {rr_file}') with zipfile.ZipFile(rr_file) as zf: zf.extractall('.') - # os.rename("roadrunner_macos_arm64", new_dir_name) # new workflow has this name except: print('error unzipping the file') exit(1) - print('Done.\n') - - # # LIBRR_DIR := /Users/heiland/libroadrunner/roadrunner-osx-10.9-cp36m - # print("Replace the following variables in your PhysiCell Makefile with these:\n") - # #print("LIBRR_DIR := /Users/heiland/libroadrunner/roadrunner-osx-10.9-cp36m") - # print("LIBRR_DIR := " + rrlib_dir) - # if os_type == 'Windows': - # print("LIBRR_LIBS := " + rrlib_dir + "/bin\n") - # else: - # print("LIBRR_LIBS := " + rrlib_dir + "/lib\n") + print('Done.\n') \ No newline at end of file