Skip to content

Commit d95da51

Browse files
committed
Merge remote-tracking branch 'dept/domdev'
2 parents 01884d3 + 982e314 commit d95da51

File tree

10 files changed

+616
-27
lines changed

10 files changed

+616
-27
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
22
set(CADABRA_CMAKE_VERSION 3.1)
33

44
cmake_minimum_required(VERSION ${CADABRA_CMAKE_VERSION})
5-
set(CMAKE_CXX_STANDARD 14)
5+
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
6+
set(CMAKE_CXX_STANDARD 14)
7+
message(STATUS "Using C++14 as you are using CMake < 3.8; consider upgrading as future versions of Cadabra may use C++17 features")
8+
else()
9+
set(CMAKE_CXX_STANDARD 17)
10+
endif()
611
project(Cadabra)
712

813
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -146,6 +151,8 @@ endif()
146151
# - Turn optimizations on
147152
# - Turn off warnings we don't need
148153

154+
155+
149156
# GCC
150157
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
151158
if (ENABLE_FRONTEND)

c++lib/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
cmake_minimum_required(VERSION 2.8)
2-
set(CMAKE_CXX_STANDARD 14)
2+
3+
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
4+
set(CMAKE_CXX_STANDARD 14)
5+
message(STATUS "Using C++14 as you are using CMkake < 3.8, consider upgrading as future versions of Cadabra may make use of C++17 features")
6+
else()
7+
set(CMAKE_CXX_STANDARD 17)
8+
endif()
9+
310
project(Cadabra)
411

512
#---------------------------------------------------------------------------
@@ -42,11 +49,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
4249
endif()
4350

4451
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
45-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")
52+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
4653
endif()
4754

4855
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
49-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")
56+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
5057
endif()
5158

5259
if(MSVC)

cmake/windows.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ endif()
1111
if (NOT VCPKG_TOOLCHAIN)
1212
find_file(CMAKE_TOOLCHAIN_FILE vcpkg.cmake HINTS $ENV{userprofile} $ENV{systemdrive} PATH_SUFFIXES vcpkg/scripts/buildsystems)
1313
if (CMAKE_TOOLCHAIN_FILE)
14-
include(${CMAKE_TOOLCHAIN_FILE})
14+
include(${CMAKE_TOOLCHAIN_FILE})
1515
endif()
1616
endif()
1717
if (VCPKG_TOOLCHAIN)
18-
message(STATUS "Found vcpkg at ${_VCPKG_ROOT_DIR}")
18+
if(NOT _VCPKG_ROOT_DIR)
19+
set(_VCPKG_ROOT_DIR ${Z_VCPKG_ROOT_DIR})
20+
endif()
21+
message(STATUS "Found vcpkg at ${Z_VCPKG_ROOT_DIR}")
1922
else()
2023
message(FATAL_ERROR "Could not find vcpkg (required for building on Visual Studio)")
2124
endif()

core/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ find_package(GLIBMM REQUIRED)
4141
# GMPXX
4242
find_package(GMPXX REQUIRED)
4343

44+
# Dependency of TinyProcessLib
45+
find_package(Threads)
46+
4447
#---------------------------------------------------------------------------
4548
# Enumerate input files and directories.
4649
#---------------------------------------------------------------------------
@@ -310,6 +313,19 @@ target_compile_definitions(cadabra2-cli PRIVATE CDBPYTHON_NO_NOTEBOOK)
310313
target_include_directories(cadabra2-cli PRIVATE ${PYTHON_INCLUDE_DIRS})
311314
target_link_libraries(cadabra2-cli PRIVATE ${PYTHON_LIBRARIES} ${GLIBMM3_LIBRARIES})
312315

316+
# Notebook diff tool
317+
add_executable(cdb-nbtool
318+
cdb-nbtool.cc
319+
${CADABRA_LIBS_DIR}/tiny-process-library/process.cpp
320+
)
321+
if (MSVC)
322+
target_sources(cdb-nbtool PRIVATE ${CADABRA_LIBS_DIR}/tiny-process-library/process_win.cpp)
323+
else()
324+
target_sources(cdb-nbtool PRIVATE ${CADABRA_LIBS_DIR}/tiny-process-library/process_unix.cpp)
325+
target_link_libraries(cdb-nbtool PRIVATE Threads::Threads)
326+
endif()
327+
target_include_directories(cdb-nbtool PRIVATE ${CADABRA_LIBS_DIR}/tiny-process-library)
328+
313329
# Test preprocessor executable
314330
add_executable(test_preprocessor
315331
test_preprocessor.cc
@@ -416,6 +432,7 @@ else()
416432
endif()
417433

418434
install(TARGETS cadabra2-cli DESTINATION bin)
435+
install(TARGETS cdb-nbtool DESTINATION bin)
419436

420437
install(
421438
FILES

core/cadabra2_defaults.py.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ def save_history(history_path):
180180

181181
try:
182182
import readline
183+
if not hasattr(readline, 'redisplay'):
184+
readline.redisplay = lambda: None
183185
history_path = os.path.join(user_data_dir(), "cadabra_history")
184186
if os.path.exists(history_path):
185187
readline.read_history_file(history_path)

0 commit comments

Comments
 (0)