Skip to content

Commit

Permalink
Merge branch 'master' of git:cadabra2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasper Peeters committed Jun 18, 2024
2 parents b802042 + 7690475 commit ba90d0b
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "submodules/microtex"]
path = submodules/microtex
url = https://github.com/kpeeters/MicroTeX.git
branch = kpeeters/cadabra
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,12 @@ add_subdirectory(core)

# Frontend
if(ENABLE_FRONTEND)
option(ENABLE_MICROTEX "Enable MicroTeX support" ON)
if(APPIMAGE_MODE)
set(ENABLE_MICROTEX TRUE)
endif()
set(ENABLE_MICROTEX TRUE)
if(ENABLE_MICROTEX)
set(USE_MICROTEX TRUE)
set(tinyxml2_BUILD_TESTING FALSE)
endif()
add_subdirectory(frontend)
# if(ENABLE_MICROTEX)
# add_dependencies(cadabra2-gtk LaTeX)
# endif()
endif()

# Tests
Expand Down Expand Up @@ -449,6 +443,8 @@ if(APPIMAGE_MODE)
execute_process(COMMAND chmod u+x ${CMAKE_BINARY_DIR}/${DEPLOY})
endif()
add_custom_target(appimage
COMMAND mkdir -p AppDir/usr/lib/python3/dist-packages
COMMAND cp -a /usr/lib/python3/dist-packages/setuptools AppDir/usr/lib/python3/dist-packages/
COMMAND ${CMAKE_BINARY_DIR}/${DEPLOY} --appdir AppDir --desktop-file AppDir/usr/share/applications/science.cadabra.cadabra2-gtk.desktop --output appimage
COMMAND mv Cadabra_2-${CMAKE_SYSTEM_PROCESSOR}.AppImage Cadabra_${CADABRA_VERSION_MAJOR}.${CADABRA_VERSION_MINOR}.${CADABRA_VERSION_PATCH}_${CMAKE_SYSTEM_PROCESSOR}.AppImage
)
Expand Down
2 changes: 1 addition & 1 deletion client_server/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ void Server::stop_block()
{
// interrupt_block=true;
std::cerr << "Server: sending SIGINT to python thread." << std::endl;
PyErr_SetInterruptEx(SIGINT);
PyErr_SetInterrupt();

// PyGILState_STATE state = PyGILState_Ensure();
// // PyThreadState_SetAsyncExc ?
Expand Down
2 changes: 1 addition & 1 deletion cmake/version.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(CADABRA_VERSION_MAJOR 2)
set(CADABRA_VERSION_MINOR 5)
set(CADABRA_VERSION_PATCH 2)
set(CADABRA_VERSION_TWEAK 0)
set(CADABRA_VERSION_TWEAK 3)
set(COPYRIGHT_YEARS "2001-2024")
math(EXPR SYSTEM_BITS "${CMAKE_SIZEOF_VOID_P} * 8")
find_program(GIT git PATHS ${GIT_DIR})
Expand Down
1 change: 0 additions & 1 deletion core/Cleanup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ namespace cadabra {

if(*arg->name=="1") {
if(*arg->multiplier==1) { // 1**anything = 1
one(it->multiplier);
tr.erase_children(it);
it->name=name_set.insert("1").first;
return true;
Expand Down
34 changes: 24 additions & 10 deletions frontend/gtkmm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,32 @@ if(USE_MICROTEX)
set(GRAPHICS_DEBUG FALSE)
set(_GLYPH_RENDER_TYPE 2) # force rendering using otf font, not paths1
set(BUILD_STATIC ON)
FetchContent_Declare(
microtex
GIT_REPOSITORY https://github.com/kpeeters/MicroTeX.git
# GIT_REPOSITORY file:///home/kasper/git/microtex/
GIT_TAG kpeeters/cadabra
)
# FetchContent_MakeAvailable(microtex)
FetchContent_GetProperties(microtex)
if(NOT microtex_POPULATED)
FetchContent_Populate(microtex)

set(MICROTEX_SUBMODULE ${CMAKE_SOURCE_DIR}/submodules/microtex/)
if(EXISTS ${MICROTEX_SUBMODULE}/CMakeLists.txt)
message(STATUS "Found MicroTeX as submodule in ${MICROTEX_SUBMODULE}")
# Someone has already checked out the microtex submodule, use that.
set(microtex_POPULATED TRUE)
set(microtex_SOURCE_DIR ${MICROTEX_SUBMODULE})
set(microtex_BINARY_DIR ${microtex_SOURCE_DIR}/build)
add_subdirectory(${microtex_SOURCE_DIR} ${microtex_BINARY_DIR} EXCLUDE_FROM_ALL)
else()
# Fetch microtex as we do not have it yet.
message(STATUS "Fetching MicroTeX using FetchContent")
FetchContent_Declare(
microtex
GIT_REPOSITORY https://github.com/kpeeters/MicroTeX.git
# GIT_REPOSITORY file:///home/kasper/git/microtex/
GIT_TAG kpeeters/cadabra
)
# FetchContent_MakeAvailable(microtex)
FetchContent_GetProperties(microtex)
if(NOT microtex_POPULATED)
FetchContent_Populate(microtex)
add_subdirectory(${microtex_SOURCE_DIR} ${microtex_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()

target_compile_options(microtex PUBLIC "-DHAVE_AUTO_FONT_FIND=1" "-Wno-reorder" "-Wno-sign-compare" "-Wno-switch" "-Wno-unused-variable" "-Wno-unused-parameter" "-Wno-ignored-qualifiers" "-Wno-mismatched-tags" "-Wno-missing-braces" "-Wno-missing-field-initializers")
else()
message(STATUS "Only using LaTeX for typesetting (disabling MicroTeX)")
Expand Down
1 change: 1 addition & 0 deletions submodules/microtex
Submodule microtex added at d68cf3
8 changes: 8 additions & 0 deletions tests/numerical.cdb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ def test03():
tst:= 1/64 r**(-12) - @(ex);
assert(tst==0)
print("Test 03f passed")
tst:= s - s**2;
substitute(tst, $s=1$)
assert(tst==0)
print("Test 03g passed")
tst:= s - 3 s**2;
substitute(tst, $s=1$)
assert(tst==-2)
print("Test 03h passed")

test03()

Expand Down

0 comments on commit ba90d0b

Please sign in to comment.