Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macOS build #50

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 45 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: pomdp-py macOS build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: macos-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build dependencies
run: |
# Install pomdp-solve macOS binary
wget -P thirdparty https://www.pomdp.org/code/pomdp-solve-os-x.bin
chmod +x thirdparty/pomdp-solve-os-x.bin

# Build and install SARSOP
git clone https://github.com/personalrobotics/appl.git thirdparty/appl
# Fix Arm build (remove -mfpmath=sse) and declare implict functions
git -C thirdparty/appl apply ../../tests/appl.patch
make -C thirdparty/appl/src
make -C thirdparty/appl/src install
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Test
working-directory: .
run: |
export POMDP_SOLVE_PATH=./thirdparty/pomdp-solve-os-x.bin
export POMDPSOL_PATH=./thirdparty/appl/bin/pomdpsol
export POMDPCONVERT_PATH=./thirdparty/appl/src/pomdpconvert
python tests/test_all.py
17 changes: 17 additions & 0 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pre-Commit

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Demos/*/*.html
/dist/
.gitrev
.coverage
*.patch
*.diff
*.orig
*.prof
Expand Down Expand Up @@ -135,3 +134,5 @@ Thumbs.db
#############################
*.alpha
*.pg

.DS_Store
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
exclude: '^tests/appl.patch$'

fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
5 changes: 3 additions & 2 deletions pomdp_py/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ def parse_args():
"-r",
"--run",
type=str,
help="run a pomdp under pomdp_py.problems."
"Available options: {}".format(available_problems),
help="run a pomdp under pomdp_py.problems.Available options: {}".format(
available_problems
),
)
args = parser.parse_args()
return parser, args
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

from setuptools import setup, Extension
from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize
import os.path

Expand Down Expand Up @@ -41,6 +41,7 @@ def build_extensions(pkg_name, major_submodules):
ext_modules=cythonize(
extensions, build_dir="build", compiler_directives={"language_level": "3"}
),
packages=find_packages(exclude=["thirdparty", "thirdparty.*"]),
package_data={
"pomdp_py": ["*.pxd", "*.pyx", "*.so", "*.c"],
"pomdp_problems": ["*.pxd", "*.pyx", "*.so", "*.c"],
Expand Down
77 changes: 77 additions & 0 deletions tests/appl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
diff --git a/src/Makefile b/src/Makefile
index 456cef1..a58539b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -57,7 +57,7 @@ endif

CC = gcc

-CFLAGS = -g -w -O3 $(INCDIR) -msse2 -mfpmath=sse $(CYGWIN_CFLAGS) #-DDEBUG_LOG_ON
+CFLAGS = -g -w -O3 $(INCDIR) -msse2 $(CYGWIN_CFLAGS) #-DDEBUG_LOG_ON

CXX = g++

diff --git a/src/Parser/Cassandra/decision-tree.h b/src/Parser/Cassandra/decision-tree.h
index 9005cef..90da271 100644
--- a/src/Parser/Cassandra/decision-tree.h
+++ b/src/Parser/Cassandra/decision-tree.h
@@ -23,13 +23,13 @@ permissions and limitations under the License.

#ifndef INCdecision_tree_h
#define INCdecision_tree_h
-
-#include "Const.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+
+#include "Const.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+

/**********************************************************************
See an example of how to use this library in testDecisionTree.c.
@@ -70,9 +70,11 @@ extern "C" {
stdout. Intended for debugging. */
extern void dtDebugPrint(const char* header);

-#ifdef __cplusplus
-}
-#endif
+ extern void checkAllocatedPointer(void * ptr);
+
+#ifdef __cplusplus
+}
+#endif



diff --git a/src/Parser/Cassandra/parse_err.h b/src/Parser/Cassandra/parse_err.h
index f2f60bf..01665ba 100644
--- a/src/Parser/Cassandra/parse_err.h
+++ b/src/Parser/Cassandra/parse_err.h
@@ -157,6 +157,7 @@ void ERR_enter( char *source,
char *modificationString );
void ERR_initialize(void);
void ERR_cleanUp(void);
+void checkAllocatedPointer(void * ptr);

#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/Parser/Cassandra/sparse-matrix.h b/src/Parser/Cassandra/sparse-matrix.h
index 68ae1d1..7324db6 100644
--- a/src/Parser/Cassandra/sparse-matrix.h
+++ b/src/Parser/Cassandra/sparse-matrix.h
@@ -100,6 +100,7 @@ extern Matrix transformIMatrix( I_Matrix i_matrix );
extern void displayMatrix( Matrix matrix );
extern REAL_VALUE sumRowValues( Matrix matrix, int row );
extern REAL_VALUE getEntryMatrix( Matrix matrix, int row, int col );
+extern void checkAllocatedPointer(void * ptr);

#ifdef __cplusplus
} /* extern "C" */
Loading