Skip to content

Commit

Permalink
Version 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vsoftco committed Apr 20, 2020
1 parent 48ea932 commit 5d1ac8e
Show file tree
Hide file tree
Showing 23 changed files with 460 additions and 329 deletions.
26 changes: 26 additions & 0 deletions .appveyor/appveyor_build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off
IF %COMPILER%==msvc2019 (
@echo on
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
mkdir build
cd build
cmake .. -DEIGEN3_INSTALL_DIR="c:\%EIGEN3_INSTALL_PATH%"
msbuild -verbosity:minimal qpp.sln
cd ../unit_tests
mkdir build
cd build
cmake .. -DEIGEN3_INSTALL_DIR="c:\%EIGEN3_INSTALL_PATH%"
msbuild -verbosity:minimal qpp_testing.sln
)
IF %COMPILER%==msys2 (
@echo on
SET "PATH=C:\msys64\mingw64\bin;%PATH%"
cd %APPVEYOR_BUILD_FOLDER%
mkdir build
cd build
bash -lc "cmake .. -DEIGEN3_INSTALL_DIR=/c/%EIGEN3_INSTALL_PATH% -GNinja && ninja"
cd ../unit_tests
mkdir build
cd build
bash -lc "cmake .. -DEIGEN3_INSTALL_DIR=/c/%EIGEN3_INSTALL_PATH% -GNinja && ninja"
)
7 changes: 7 additions & 0 deletions .appveyor/appveyor_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
IF %COMPILER%==msvc2019 (
%APPVEYOR_BUILD_FOLDER%\unit_tests\build\tests\Debug\qpp_testing.exe --gtest_filter=-qpp_Timer*
)
IF %COMPILER%==msys2 (
%APPVEYOR_BUILD_FOLDER%\unit_tests\build\tests\qpp_testing.exe --gtest_filter=-qpp_Timer*
)
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ script:
- wget https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -O eigen3.zip && unzip -q eigen3.zip && mv eigen-3.3.7 $HOME/eigen

# Build the examples
- mkdir build && cd build && cmake .. -DEIGEN3_INCLUDE_DIR=$HOME/eigen -DCMAKE_BUILD_TYPE=Debug && make -j4
- mkdir build && cd build && cmake .. -DEIGEN3_INSTALL_DIR=$HOME/eigen -DCMAKE_BUILD_TYPE=Debug && make -j4

# Build the unit tests
- cd ../unit_tests && mkdir build && cd build && cmake .. -DEIGEN3_INCLUDE_DIR=$HOME/eigen -DCMAKE_BUILD_TYPE=Debug && make -j4
- cd ../unit_tests && mkdir build && cd build && cmake .. -DEIGEN3_INSTALL_DIR=$HOME/eigen -DCMAKE_BUILD_TYPE=Debug && make -j4

# Run the unit tests
- ./tests/qpp_testing --gtest_filter=-qpp_Timer*
14 changes: 12 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pre-release
Version 2.2 - 14 April 2020
- Updated Google Test to version 1.10.0
- Removed the Visual Studio solution (since it can be automatically
generated by CMake), as we prefer to use CMake uniformly across all
Expand All @@ -16,6 +16,16 @@ Pre-release
otherwise
remove_clean() - Remove single/list of clean qudits from quantum
circuit description
- More robust MATLAB integration, detects MATLAB automatically when the
CMake flag -DWITH_MATLAB=ON is specified; if CMake can not detect it
automatically, pass the additional CMake flag
-DMATLAB_INSTALL_DIR=/path/to/MATLAB to manually specify MATLAB's location
- Updated MATLAB mx-API, detects MX_HAS_INTERLEAVED_COMPLEX for MATLAB
versions >= R2018a, see
https://www.mathworks.com/help/matlab/matlab_external/matlab-support-for-interleaved-complex.html
but also continues to work with older MATLAB versions < R2018a
- Changed the CMake flag EIGEN3_INCLUDE_DIR to EIGEN3_INSTALL_DIR
so it is consistent with the MATLAB_INSTALL_DIR CMake flag

Version 2.1 - 14 March 2020 (3.14.2020 Pi day release)
- Migrated the repository to https://github.com/softwareqinc/qpp
Expand Down Expand Up @@ -221,7 +231,7 @@ Version 1.0-rc2 - Release Candidate 2, 6 September 2017
qpp::RandomDevices::get_prng()
- Eigen3 is detected automatically by CMake (if Eigen3 was installed via a
package manager). If not, it can be specified manually by passing the
-DEIGEN3_INCLUDE_DIR=path_to_eigen3 flag to the CMake command line.
-DEIGEN3_INCLUDE_DIR=/path/to/eigen3 flag to the CMake command line.

Version 1.0-rc1 - Release Candidate 1, 11 November 2016
- Slight performance improvements (lambda workers do not capture by value
Expand Down
144 changes: 101 additions & 43 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
PROJECT(qpp VERSION 2.1 LANGUAGES CXX)
PROJECT(qpp VERSION 2.2 LANGUAGES CXX)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand All @@ -16,26 +16,27 @@ AUX_SOURCE_DIRECTORY(examples/qasm EXAMPLE_FILES)

#### Eigen3
MESSAGE(STATUS "Detecting Eigen3")
SET(EIGEN3_INCLUDE_DIR "" CACHE PATH "Path to Eigen3")
SET(EIGEN3_INSTALL_DIR "" CACHE PATH "Path to Eigen3")
#### Location manually specified
IF (NOT ${EIGEN3_INCLUDE_DIR} STREQUAL "")
IF (IS_DIRECTORY ${EIGEN3_INCLUDE_DIR})
MESSAGE(STATUS "Detecting Eigen3 - done (in ${EIGEN3_INCLUDE_DIR})")
INCLUDE_DIRECTORIES(SYSTEM "${EIGEN3_INCLUDE_DIR}")
IF (NOT ${EIGEN3_INSTALL_DIR} STREQUAL "")
IF (IS_DIRECTORY ${EIGEN3_INSTALL_DIR})
MESSAGE(STATUS "Detecting Eigen3 - done (in ${EIGEN3_INSTALL_DIR})")
INCLUDE_DIRECTORIES(SYSTEM "${EIGEN3_INSTALL_DIR}")

ELSE ()
MESSAGE(FATAL_ERROR "Invalid path to Eigen3 installation")
ENDIF ()
ELSE () #### Try to find it automatically
FIND_PACKAGE(Eigen3 3.0 QUIET NO_MODULE)
IF (NOT TARGET Eigen3::Eigen) # did not find Eigen3 automatically
MESSAGE(FATAL_ERROR
"Eigen3 not detected! Please point EIGEN3_INCLUDE_DIR\
"Eigen3 not detected! Please point EIGEN3_INSTALL_DIR\
to your Eigen3 location when building with cmake,\
for example\
cmake .. -DEIGEN3_INCLUDE_DIR=$HOME/eigen")
cmake .. -DEIGEN3_INSTALL_DIR=$HOME/eigen")
ENDIF ()
MESSAGE(STATUS "Detecting Eigen3 - done")
MESSAGE(STATUS "Detecting Eigen3 - done (in ${EIGEN3_INCLUDE_DIR})")
ENDIF ()

#### Cygwin has issues with std=c++11, use std=gnu++11 instead
Expand All @@ -60,33 +61,87 @@ IF (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
${CMAKE_CXX_COMPILER_VERSION}. thread_local not supported.")
ENDIF ()

#### MATLAB support
SET(WITH_MATLAB "" CACHE PATH "Path to MATLAB (to enable MATLAB support)")
# WITH_MATLAB option was activated (set)
IF (NOT ${WITH_MATLAB} STREQUAL "")
IF (IS_DIRECTORY ${WITH_MATLAB})
MESSAGE(STATUS "MATLAB support enabled")
# MATLAB include files
SET(MATLAB_INCLUDE "${WITH_MATLAB}/extern/include" CACHE PATH
"Path to MATLAB include directory")
IF (IS_DIRECTORY ${MATLAB_INCLUDE})
INCLUDE_DIRECTORIES(SYSTEM ${MATLAB_INCLUDE})
#### MATLAB support, disabled by default
OPTION(WITH_MATLAB "MATLAB support" OFF)
IF (${WITH_MATLAB})
MESSAGE(STATUS "Detecting MATLAB")
#### Try to find it automatically
FIND_PACKAGE(Matlab OPTIONAL_COMPONENTS MX_LIBRARY MAT_LIBRARY QUIET)
IF (MATLAB_FOUND)
MESSAGE(STATUS "Detecting MATLAB - done (in ${Matlab_ROOT_DIR})")
INCLUDE_DIRECTORIES(SYSTEM ${Matlab_INCLUDE_DIRS})
IF (WIN32)
IF (MSVC)
SET(MATLAB_LIB_DIR
"${Matlab_ROOT_DIR}/extern/lib/win64/microsoft"
CACHE PATH "Custom path to MATLAB lib directory")
ELSEIF (MINGW)
SET(MATLAB_LIB_DIR "${Matlab_ROOT_DIR}/extern/lib/win64/mingw64"
CACHE PATH "Custom path to MATLAB lib directory")
ELSE ()
MESSAGE(FATAL "Platform not supported, aborting.")
ENDIF ()
ELSEIF (UNIX AND NOT APPLE)
SET(MATLAB_LIB_DIR "${Matlab_ROOT_DIR}/bin/glnxa64" CACHE
PATH "Custom path to MATLAB lib directory")
ELSEIF (APPLE)
SET(MATLAB_LIB_DIR "${Matlab_ROOT_DIR}/bin/maci64" CACHE
PATH "Custom path to MATLAB lib directory")
ELSE ()
MESSAGE(FATAL_ERROR "Possibly corrupted MATLAB include headers")
MESSAGE(FATAL "Platform not supported, aborting.")
ENDIF ()
# MATLAB linker files
SET(MATLAB_LINK "${WITH_MATLAB}/bin/maci64" CACHE PATH
"Path to MATLAB lib directory")
IF (IS_DIRECTORY ${MATLAB_LINK})
LINK_DIRECTORIES(${MATLAB_LINK})
LINK_DIRECTORIES(${MATLAB_LIB_DIR})
ADD_DEFINITIONS(-DHAS_MATLAB_ENABLED)
SET(BUILD_WITH_MATLAB TRUE)
ELSE () #### Location manually specified
SET(MATLAB_INSTALL_DIR "" CACHE PATH
"Custom path to MATLAB installation")
IF (IS_DIRECTORY ${MATLAB_INSTALL_DIR})
# MATLAB include files
SET(MATLAB_INCLUDE_DIR "${MATLAB_INSTALL_DIR}/extern/include"
CACHE PATH "Custom path to MATLAB include directory")
IF (IS_DIRECTORY ${MATLAB_INCLUDE_DIR})
INCLUDE_DIRECTORIES(SYSTEM ${MATLAB_INCLUDE_DIR})
ELSE ()
MESSAGE(FATAL_ERROR
"Possibly corrupted MATLAB include headers")
ENDIF ()
# MATLAB linker files
IF (WIN32)
IF (MSVC)
SET(MATLAB_LIB_DIR
"${MATLAB_INSTALL_DIR}/extern/lib/win64/microsoft"
CACHE PATH "Custom path to MATLAB lib directory")
ELSEIF (MINGW64)
SET(MATLAB_LIB_DIR
"${MATLAB_INSTALL_DIR}/extern/lib/win64/mingw64"
CACHE PATH "Custom path to MATLAB lib directory")
ELSE ()
MESSAGE(FATAL "Platform not supported, aborting.")
ENDIF ()
ELSEIF (UNIX AND NOT APPLE)
SET(MATLAB_LIB_DIR "${MATLAB_INSTALL_DIR}/bin/glnxa64" CACHE
PATH "Custom path to MATLAB lib directory")
ELSEIF (APPLE)
SET(MATLAB_LIB_DIR "${MATLAB_INSTALL_DIR}/bin/maci64" CACHE
PATH "Custom path to MATLAB lib directory")
ELSE ()
MESSAGE(FATAL "Platform not supported, aborting.")
ENDIF ()
IF (IS_DIRECTORY ${MATLAB_LIB_DIR})
LINK_DIRECTORIES(${MATLAB_LIB_DIR})
ELSE ()
MESSAGE(FATAL_ERROR
"Possibly corrupted MATLAB compiler libraries")
ENDIF ()
#### Everything is OK, inject definition (as #define) in the source
MESSAGE(STATUS
"Detecting MATLAB - done (in ${MATLAB_INSTALL_DIR})")
ADD_DEFINITIONS(-DHAS_MATLAB_ENABLED)
SET(BUILD_WITH_MATLAB TRUE)
ELSE ()
MESSAGE(FATAL_ERROR "Possibly corrupted MATLAB linker files")
MESSAGE(FATAL_ERROR "Could not detect MATLAB, aborting")
ENDIF ()
#### Everything is OK, inject definition (as #define) in the source
ADD_DEFINITIONS(-DWITH_MATLAB_)
SET(BUILD_WITH_MATLAB TRUE)
ELSE ()
MESSAGE(FATAL_ERROR "Invalid path to MATLAB installation")
ENDIF ()
ENDIF ()

Expand All @@ -99,12 +154,11 @@ IF (${WITH_OPENMP})
(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.8")))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
#### inject definition (as #define) in the source files
ADD_DEFINITIONS(-DWITH_OPENMP_)
ADD_DEFINITIONS(-DHAS_OPENMP)
ELSE ()
MESSAGE(WARNING "Detected compiler: ${CMAKE_CXX_COMPILER_ID} \
${CMAKE_CXX_COMPILER_VERSION}. Support for OpenMP is enabled only for \
the GNU gcc compiler or the clang compiler version version 3.8 or \
higher.")
the GNU gcc compiler or the clang compiler version 3.8 or higher.")
ENDIF ()
ENDIF ()

Expand Down Expand Up @@ -140,16 +194,20 @@ ENDIF ()
#### Build all examples in ${EXAMPLE_FILES}
FOREACH (FILE ${EXAMPLE_FILES})
GET_FILENAME_COMPONENT(TARGET_NAME ${FILE} NAME_WE)
#### MATALB support
#### Do not build "examples/matlab_io.cpp" if there's no MATLAB support
IF (${FILE} STREQUAL "examples/matlab_io.cpp" AND NOT BUILD_WITH_MATLAB)
CONTINUE()
ENDIF ()
ADD_EXECUTABLE(${TARGET_NAME} ${FILE})
IF (${BUILD_WITH_MATLAB})
ADD_EXECUTABLE(${TARGET_NAME} ${FILE})
TARGET_LINK_LIBRARIES(${TARGET_NAME} mx mat)
ELSE () #### No MATLAB support
#### Do not build examples/matlab.cpp if there's no MATLAB support
IF (${FILE} STREQUAL "examples/matlab.cpp")
CONTINUE()
IF (WIN32)
IF (MSVC)
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmx libmat)
ELSEIF (MINGW)
TARGET_LINK_LIBRARIES(${TARGET_NAME} mx mat)
ENDIF ()
ELSE ()
ADD_EXECUTABLE(${TARGET_NAME} ${FILE})
TARGET_LINK_LIBRARIES(${TARGET_NAME} mx mat)
ENDIF ()
ENDIF ()
#### Eigen3 was found automatically
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Quantum++"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v2.1
PROJECT_NUMBER = v2.2

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Loading

0 comments on commit 5d1ac8e

Please # to comment.