Commit 963da481 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

syncing up build system for c++14


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 7f547d0e
......@@ -96,13 +96,13 @@ if(PYTHON_INCLUDE_DIR)
add_subdirectory(python)
endif()
find_package(Clang 9.0.0)
if (CLANG_FOUND)
add_subdirectory(tools)
configure_file(${CMAKE_SOURCE_DIR}/scripts/xacc.in
${CMAKE_BINARY_DIR}/scripts/xacc)
install(PROGRAMS ${CMAKE_BINARY_DIR}/scripts/xacc DESTINATION bin)
endif()
#find_package(Clang 9.0.0)
#if (CLANG_FOUND)
# add_subdirectory(tools)
# configure_file(${CMAKE_SOURCE_DIR}/scripts/xacc.in
# ${CMAKE_BINARY_DIR}/scripts/xacc)
# install(PROGRAMS ${CMAKE_BINARY_DIR}/scripts/xacc DESTINATION bin)
#endif()
# Install the config file for external projects to use
# This is cool, users just add find_package(XACC REQUIRED) to
......
......@@ -40,7 +40,7 @@ add_dependencies(${LIBRARY_NAME} antlr4_shared)
target_include_directories(${LIBRARY_NAME}
PRIVATE
gate/ir aqc/ir)
gate/ir aqc/ir ${CMAKE_SOURCE_DIR}/tpls/exprtk)
set(_bundle_name xacc_quantum_irprovider)
set_target_properties(${LIBRARY_NAME}
......@@ -59,7 +59,11 @@ usFunctionEmbedResources(TARGET
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc PRIVATE CppMicroServices xacc-quantum-gate xacc-quantum-aqc)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc PRIVATE xacc-quantum-gate xacc-quantum-aqc)
target_compile_features(${LIBRARY_NAME}
PUBLIC
cxx_std_14
cxx_alias_templates)
if(APPLE)
set_target_properties(${LIBRARY_NAME}
......
......@@ -55,8 +55,11 @@ usfunctionembedresources(TARGET
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc PRIVATE CppMicroServices)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc)
target_compile_features(${LIBRARY_NAME}
PUBLIC
cxx_std_14
cxx_alias_templates)
if(APPLE)
set_target_properties(xacc-quantum-aqc
PROPERTIES INSTALL_RPATH "@loader_path")
......
......@@ -67,7 +67,11 @@ usFunctionEmbedResources(TARGET
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc PRIVATE Boost::graph)
target_link_libraries(${LIBRARY_NAME} PUBLIC xacc)
target_compile_features(${LIBRARY_NAME}
PUBLIC
cxx_std_14
cxx_alias_templates)
if(APPLE)
set_target_properties(xacc-quantum-gate
......
......@@ -16,19 +16,19 @@ install(FILES "${CMAKE_BINARY_DIR}/xacc_config.hpp" DESTINATION include/xacc)
find_package(Libunwind)
file(GLOB HEADERS
XACC.hpp
ir/*.hpp
compiler/*.hpp
accelerator/*.hpp
accelerator/remote/*.hpp
utils/*.hpp
service/*.hpp
algorithm/*.hpp
optimizer/*.hpp)
file(GLOB
HEADERS
XACC.hpp
ir/*.hpp
compiler/*.hpp
accelerator/*.hpp
accelerator/remote/*.hpp
utils/*.hpp
service/*.hpp
algorithm/*.hpp
optimizer/*.hpp)
add_library(xacc
SHARED
add_library(xacc SHARED
XACC.cpp
accelerator/AcceleratorBuffer.cpp
utils/Utils.cpp
......@@ -39,52 +39,60 @@ add_library(xacc
add_dependencies(xacc cpr)
if (LIBUNWIND_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_LIBUNWIND")
target_include_directories(xacc
PRIVATE ${CMAKE_BINARY_DIR}
${CPR_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/tpls/rapidjson/include
${CMAKE_SOURCE_DIR}/tpls/spdlog
${CMAKE_SOURCE_DIR}/tpls/cxxopts
${LIBUNWIND_INCLUDE_DIRS}
PUBLIC .
ir
compiler
program
accelerator
accelerator/remote
utils
service
algorithm
optimizer
${CMAKE_SOURCE_DIR}/tpls/mpark-variant)
if(LIBUNWIND_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_LIBUNWIND")
target_include_directories(xacc
PRIVATE ${CMAKE_BINARY_DIR}
${CPR_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/tpls/rapidjson/include
${CMAKE_SOURCE_DIR}/tpls/spdlog
${CMAKE_SOURCE_DIR}/tpls/cxxopts
${LIBUNWIND_INCLUDE_DIRS}
PUBLIC .
ir
compiler
program
accelerator
accelerator/remote
utils
service
algorithm
optimizer
${CMAKE_SOURCE_DIR}/tpls/mpark-variant)
message(STATUS "LIBS: ${LIBUNWIND_LIBRARIES} ${LIBUNWINDX86_LIBRARIES}")
target_link_libraries(xacc PUBLIC CppMicroServices PRIVATE cpr ${LIBUNWIND_LIBRARIES} ${LIBUNWINDX86_LIBRARIES})
message(STATUS "LIBS: ${LIBUNWIND_LIBRARIES} ${LIBUNWINDX86_LIBRARIES}")
target_link_libraries(xacc
PUBLIC CppMicroServices
PRIVATE cpr ${LIBUNWIND_LIBRARIES}
${LIBUNWINDX86_LIBRARIES})
else()
target_include_directories(xacc
PRIVATE ${CMAKE_BINARY_DIR}
${CPR_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/tpls/rapidjson/include
${CMAKE_SOURCE_DIR}/tpls/spdlog
${CMAKE_SOURCE_DIR}/tpls/cxxopts
PUBLIC .
ir
compiler
program
accelerator
accelerator/remote
utils
service
algorithm
optimizer
${CMAKE_SOURCE_DIR}/tpls/mpark-variant)
target_link_libraries(xacc PUBLIC CppMicroServices PRIVATE cpr)
target_include_directories(xacc
PRIVATE ${CMAKE_BINARY_DIR}
${CPR_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/tpls/rapidjson/include
${CMAKE_SOURCE_DIR}/tpls/spdlog
${CMAKE_SOURCE_DIR}/tpls/cxxopts
PUBLIC .
ir
compiler
program
accelerator
accelerator/remote
utils
service
algorithm
optimizer
${CMAKE_SOURCE_DIR}/tpls/mpark-variant)
target_link_libraries(xacc PUBLIC CppMicroServices PRIVATE cpr)
endif()
target_compile_features(xacc
PUBLIC
cxx_std_14
cxx_alias_templates)
if(APPLE)
set_target_properties(xacc PROPERTIES INSTALL_RPATH "@loader_path")
set_target_properties(xacc PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
......@@ -104,4 +112,4 @@ endif()
install(FILES ${HEADERS} DESTINATION include/xacc)
install(TARGETS xacc DESTINATION lib)
add_subdirectory(optimizer/nlopt-optimizers)
\ No newline at end of file
add_subdirectory(optimizer/nlopt-optimizers)
add_xacc_test(XACCAPI xacc)
target_include_directories(XACCAPITester PRIVATE ${CMAKE_BINARY_DIR})
add_xacc_test(CLIParser xacc)
add_xacc_test(Algorithm xacc)
\ No newline at end of file
add_xacc_test(Algorithm xacc)
add_xacc_test(Heterogeneous xacc)
target_compile_features(HeterogeneousTester PRIVATE cxx_std_14)
/*******************************************************************************
* Copyright (c) 2019 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompanies this
* distribution. The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
*License is available at https://eclipse.org/org/documents/edl-v10.php
*
* Contributors:
* Alexander J. McCaskey - initial API and implementation
*******************************************************************************/
#ifndef XACC_HETEROGENEOUS_HPP_
#define XACC_HETEROGENEOUS_HPP_
#include <map>
......@@ -11,6 +23,7 @@
#include "variant.hpp"
#include "Utils.hpp"
namespace xacc {
template <class...> struct type_list {};
......@@ -158,7 +171,7 @@ std::unordered_map<const HeterogeneousMap *, std::map<std::string, T>>
HeterogeneousMap::items;
template <typename... Types> class Variant : public mpark::variant<Types...> {
template <typename... Types> class Variant2 : public mpark::variant<Types...> {
private:
class ToStringVisitor {
......@@ -186,12 +199,12 @@ private:
};
public:
Variant() : mpark::variant<Types...>() {}
Variant2() : mpark::variant<Types...>() {}
template <typename T>
Variant(T &element) : mpark::variant<Types...>(element) {}
Variant2(T &element) : mpark::variant<Types...>(element) {}
template <typename T>
Variant(T &&element) : mpark::variant<Types...>(element) {}
Variant(const Variant &element) : mpark::variant<Types...>(element) {}
Variant2(T &&element) : mpark::variant<Types...>(element) {}
Variant2(const Variant2 &element) : mpark::variant<Types...>(element) {}
template <typename T> T as() const {
try {
......@@ -216,7 +229,7 @@ public:
int which() const {
return this->index();
}
bool isNumeric() const {
IsArithmeticVisitor v;
return mpark::visit(v, *this);
......@@ -236,11 +249,11 @@ public:
return mpark::visit(vis, *this);
}
bool operator==(const Variant<Types...> &v) const {
bool operator==(const Variant2<Types...> &v) const {
return v.toString() == toString();
}
bool operator!=(const Variant<Types...> &v) const { return !operator==(v); }
bool operator!=(const Variant2<Types...> &v) const { return !operator==(v); }
};
} // namespace xacc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment