Skip to content

Commit

Permalink
Merge pull request #247 from Morpho-lang/dev
Browse files Browse the repository at this point in the history
Morpho v0.6.0
  • Loading branch information
softmattertheory authored Apr 1, 2024
2 parents 60f7537 + 9eb6a24 commit 618b6c9
Show file tree
Hide file tree
Showing 491 changed files with 19,738 additions and 72,180 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
27 changes: 0 additions & 27 deletions .github/workflows/CI.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/Examples.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/GarbageCollectorTest.yml

This file was deleted.

38 changes: 26 additions & 12 deletions .github/workflows/NoNanBoxing.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
name: NoNaNBoxing Tests
name: No NANBoxing

on:
push:
branches: [ main ]
branches: [ "main" ]
pull_request:
branches: [ main, dev ]
branches: [ "main" ]

jobs:
build_and_test:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: configure
run: |
run: |
sudo apt update
sudo apt install libglfw3
sudo apt install libsuitesparse-dev
sudo apt install liblapacke-dev
sudo apt install libunistring-dev
python -m pip install --upgrade pip
python -m pip install regex colored
- name: makeNoNanBoxing
run: (cd morpho5; sudo make -f Makefile.linux nonanboxing)
- name: testNoNanBoxing
run: (cd test; python3 test.py -c)
- name: make
run: |
mkdir build
cd build
cmake -DMORPHO_DISABLENANBOXING=ON ..
sudo make install
sudo mkdir /usr/local/lib/morpho
- name: getcli
run: |
git clone https://github.com/Morpho-lang/morpho-cli.git
cd morpho-cli
mkdir build
cd build
cmake -DMORPHO_DISABLENANBOXING=ON ..
sudo make install
- name: test
run: |
cd test
python3 test.py -c
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: configure
run: |
sudo apt update
sudo apt install libsuitesparse-dev
sudo apt install liblapacke-dev
python -m pip install --upgrade pip
python -m pip install regex colored
- name: make
run: (mkdir build; cd build; cmake ..; sudo make install)
42 changes: 42 additions & 0 deletions .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: configure
run: |
sudo apt update
sudo apt install libsuitesparse-dev
sudo apt install liblapacke-dev
sudo apt install libunistring-dev
python -m pip install --upgrade pip
python -m pip install regex colored
- name: make
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
sudo make install
sudo mkdir /usr/local/lib/morpho
- name: getcli
run: |
git clone https://github.com/Morpho-lang/morpho-cli.git
cd morpho-cli
mkdir build
cd build
cmake ..
sudo make install
- name: test
run: |
cd test
python3 test.py -c
42 changes: 42 additions & 0 deletions .github/workflows/nonanboxing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: No NANBoxing

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: configure
run: |
sudo apt update
sudo apt install libsuitesparse-dev
sudo apt install liblapacke-dev
sudo apt install libunistring-dev
python -m pip install --upgrade pip
python -m pip install regex colored
- name: make
run: |
mkdir build
cd build
cmake -DMORPHO_DISABLENANBOXING=ON ..
sudo make install
sudo mkdir /usr/local/lib/morpho
- name: getcli
run: |
git clone https://github.com/Morpho-lang/morpho-cli.git
cd morpho-cli
mkdir build
cd build
cmake -DMORPHO_DISABLENANBOXING=ON ..
sudo make install
- name: test
run: |
cd test
python3 test.py -c
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ dkms.conf

.DS_Store
.entitlements
.vscode/settings.json

test/FailedTests.txt
*.png
*.out
manual/src/manual.lyx~
test/vtk/data.case2.vtk
test/vtk/data.case3.0.vtk
Expand All @@ -68,3 +70,5 @@ test/vtk/data.vtk
test/vtk/square.vtk
test/vtk/tetrahedron.vtk
devguide/devguide.lyx~
build/*
build-xcode/*
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cmake.configureOnOpen": true,
"files.associations": {
"builtin.h": "c",
"value.h": "c",
"error.h": "c"
}
}
104 changes: 104 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
cmake_minimum_required(VERSION 3.13)
project(morpho-libmorpho)

option(MORPHO_DISABLENANBOXING "Disables NAN Boxing" OFF)

option(MORPHO_GCSTRESSTEST "Stress tests the garbage collector" OFF)

add_library(morpho SHARED "")
add_subdirectory(src)

# Include morpho header files across the project
target_include_directories(morpho PUBLIC src
src/builtin
src/classes
src/core
src/datastructures
src/debug
src/geometry
src/linalg
src/support )

# Option to disable NAN Boxing
if(MORPHO_DISABLENANBOXING)
target_compile_definitions(morpho PUBLIC _NO_NAN_BOXING)
endif()

# Option to stress test Garbage Collector
if(MORPHO_GCSTRESSTEST)
target_compile_definitions(morpho PUBLIC _DEBUG_STRESSGARBAGECOLLECTOR)
endif()

# Set resources directory
if(MORPHO_RESOURCESDIR)
target_compile_definitions(morpho PUBLIC MORPHO_RESOURCESDIR=\"${MORPHO_RESOURCESDIR}\")
endif()

# Create source groups for IDE
source_group("builtin" REGULAR_EXPRESSION src/builtin/.*\\.[ch])
source_group("classes" REGULAR_EXPRESSION src/classes/.*\\.[ch])
source_group("core" REGULAR_EXPRESSION src/core/.*\\.[ch])
source_group("datastructures" REGULAR_EXPRESSION src/datastructures/.*\\.[ch])
source_group("debug" REGULAR_EXPRESSION src/debug/.*\\.[ch])
source_group("geometry" REGULAR_EXPRESSION src/geometry/.*\\.[ch])
source_group("linalg" REGULAR_EXPRESSION src/linalg/.*\\.[ch])
source_group("support" REGULAR_EXPRESSION src/support/.*\\.[ch])

# Find suitesparse cs.h header file
find_file(SUITESPARSE_HEADER cs.h
HINTS
/home/linuxbrew/.linuxbrew/include/suitesparse
/usr/local/include
/usr/local/include/suitesparse
/opt/homebrew/include/suitesparse
/usr/include/suitesparse)

# Identify folder that cs.h is located in from SUITESPARSE_HEADER and store in SUITESPARSE_INCLUDE
get_filename_component(SUITESPARSE_INCLUDE ${SUITESPARSE_HEADER} DIRECTORY)

# Add morpho headers to MORPHO_INCLUDE
target_include_directories(morpho PUBLIC ${SUITESPARSE_INCLUDE})

# Locate a lapack version
# Currently we prefer LAPACKE
# TODO: Fix morpho source to select between lapack and lapacke
find_library(LAPACK_LIBRARY
NAMES lapacke liblapacke lapack liblapack
)

# Locate cblas
find_library(CBLAS_LIBRARY
NAMES cblas libcblas blas libblas
)

# Locate suitesparse
find_library(SUITESPARSE_LIBRARY
NAMES cxsparse libcxsparse
)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

target_link_libraries(morpho ${SUITESPARSE_LIBRARY} ${CBLAS_LIBRARY} ${LAPACK_LIBRARY} ${CMAKE_DL_LIBS} Threads::Threads)

# Install the resulting library
install(TARGETS morpho)

# Install morpho header files
# The below works in 3.23, which is too recent for Ubuntu
# install(TARGETS morpho
# FILE_SET public_headers
# DESTINATION include/morpho
#)

# So we'll use a hacky way for now
file(GLOB_RECURSE MORPHO_HEADER_FILES "src/*.h")
install(FILES ${MORPHO_HEADER_FILES} DESTINATION include/morpho)

# Similarly install morpho modules
file(GLOB_RECURSE MORPHO_MODULES_FILES "modules/*.morpho")
install(FILES ${MORPHO_MODULES_FILES} DESTINATION share/morpho/modules)

# Similarly install morpho help files
file(GLOB_RECURSE MORPHO_HELP_FILES "help/*.md")
install(FILES ${MORPHO_HELP_FILES} DESTINATION share/morpho/help)
Loading

0 comments on commit 618b6c9

Please sign in to comment.