Commit 15cc260e authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

setting up build to find python include dir instead of library


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 814b1673
......@@ -124,7 +124,6 @@ if (OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
ExternalProject_Add(xacc-core
DEPENDS cppmicroservices restclient-cpp
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xacc
......@@ -180,8 +179,8 @@ ExternalProject_Add(xacc-quantum
TEST_AFTER_INSTALL 1
)
find_package(PythonLibs)
if(PYTHONLIBS_FOUND)
#find_package(PythonLibs)
#if(PYTHONLIBS_FOUND)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXACC_HAS_PYTHON")
ExternalProject_Add(xacc-python
DEPENDS xacc-core xacc-quantum
......@@ -199,16 +198,12 @@ ExternalProject_Add(xacc-python
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
-DFROM_SETUP_PY=${FROM_SETUP_PY}
-DXACC_PYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR}
# -DCppRSDK_INCLUDE_DIR=${CppRSDK_INCLUDE_DIR}
# -DOPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR}
# -DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES}
# -DOPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}
CMAKE_CACHE_ARGS -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH}
BUILD_ALWAYS 1
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install #DESTDIR=${CMAKE_BINARY_DIR}/stage
TEST_AFTER_INSTALL 1
)
endif()
#endif()
# Install the config file for external projects to use
# This is cool, users just add find_package(XACC REQUIRED) to
......
......@@ -9,8 +9,8 @@ message(STATUS "C++ version ${CXX_STANDARD} configured.")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
find_package(PythonLibs)
if(PythonLibs_FOUND)
#find_package(PythonLibs)
#if(PythonLibs_FOUND)
set(CppMicroServices_DIR "${CPPUS_LIBRARY_DIR}/../share/cppmicroservices3/cmake")
......@@ -22,7 +22,7 @@ include(CppMicroServicesConfig)
include(tests)
include(CppMicroServicesConfig)
find_package(Boost COMPONENTS system program_options filesystem chrono thread REQUIRED)
find_package(Boost COMPONENTS system program_options filesystem chrono REQUIRED)
include_directories(${XACC_INCLUDE_DIR}/xacc)
include_directories(${XACC_INCLUDE_DIR}/quantum/gate)
......@@ -35,7 +35,7 @@ include_directories(${XACC_ROOT}/tpls/eigen)
include_directories(${XACC_ROOT}/tpls/exprtk)
include_directories(${XACC_ROOT}/tpls/pybind11/include)
include_directories(${XACC_ROOT}/tpls/spdlog)
include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${XACC_PYTHON_INCLUDE_DIR})
link_directories(${XACC_LIBRARY_DIR})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -O2 -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wformat -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv")
......@@ -51,14 +51,15 @@ link_directories(${Boost_LIBRARY_DIR})
#if (NOT cppus_has_d_suffix)
# set(CppUsLib CppMicroServices)
#endif()
target_link_libraries(pyxacc ${PYTHON_LIBRARY} xacc xacc-quantum-gate xacc-quantum-aqc CppMicroServices ${Boost_LIBRARIES} restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
target_link_libraries(pyxacc xacc xacc-quantum-gate xacc-quantum-aqc CppMicroServices ${Boost_LIBRARIES} restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
if(APPLE)
set_target_properties(pyxacc PROPERTIES INSTALL_RPATH "@loader_path/lib")
set_target_properties(pyxacc PROPERTIES LDFLAGS "-undefined dynamic_lookup")
else()
set_target_properties(pyxacc PROPERTIES INSTALL_RPATH "$ORIGIN/lib;$ORIGIN/plugins")
set_target_properties(pyxacc PROPERTIES LDFLAGS "-shared")
endif()
install(TARGETS pyxacc DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
#endif()
......@@ -16,6 +16,7 @@ from setuptools.command.install import install as InstallCommandBase
from setuptools.command.test import test as TestCommand
from shutil import copyfile, copymode
import shutil
import sysconfig
env = os.environ.copy()
......@@ -53,7 +54,7 @@ class CMakeBuild(build_ext):
print(dir(self))
print(self.build_lib)
cmake_args = ['-DPYTHON_EXECUTABLE=' + sys.executable,
cmake_args = ['-DPYTHON_INCLUDE_DIR=' + sysconfig.get_paths()['platinclude'], #sys.executable,
'-DCMAKE_INSTALL_PREFIX='+install_prefix,
'-DFROM_SETUP_PY=TRUE']
......
......@@ -38,7 +38,7 @@ include_directories("${CMAKE_SOURCE_DIR}/accelerator")
include_directories("${CMAKE_SOURCE_DIR}/utils")
include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${CMAKE_BINARY_DIR})
include_directories(${PYBIND11_DIR}/include)
#include_directories(${PYBIND11_DIR}/include)
#find_package(PythonLibs REQUIRED)
#include_directories(${XACC_PYTHON_INCLUDE_DIR})
......@@ -54,12 +54,12 @@ set (LIBRARY_NAME xacc)
file (GLOB HEADERS XACC.hpp ir/*.hpp program/*.hpp compiler/*.hpp accelerator/*.hpp accelerator/remote/*.hpp utils/*.hpp)
file (GLOB SRC *.cpp program/*.cpp utils/*.cpp accelerator/remote/*.cpp)
find_package(PythonLibs)
if(PythonLibs_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXACC_HAS_PYTHON")
include_directories(${XACC_ROOT}/tpls/pybind11/include)
include_directories(${PYTHON_INCLUDE_DIR})
endif()
#find_package(PythonLibs)
#if(PythonLibs_FOUND)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXACC_HAS_PYTHON")
# include_directories(${XACC_ROOT}/tpls/pybind11/include)
# include_directories(${XACC_PYTHON_INCLUDE_DIR})
#endif()
set(CppUsLib CppMicroServicesd)
link_directories(${CPPUS_LIBRARY_DIR})
......@@ -72,15 +72,21 @@ if (NOT cppus_has_d_suffix)
set(CppUsLib CppMicroServices)
endif()
if (APPLE)
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${OPENSSL_CRYPTO_LIBRARY}")
endif()
#if (APPLE)
# set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${OPENSSL_CRYPTO_LIBRARY}")
#endif()
if(PythonLibs_FOUND)
target_link_libraries(${LIBRARY_NAME} ${PYTHON_LIBRARY} ${Boost_LIBRARIES} ${CppUsLib} restclient-cpp)
else()
#if(PythonLibs_FOUND)
# target_link_libraries(${LIBRARY_NAME} ${PYTHON_LIBRARY} ${Boost_LIBRARIES} ${CppUsLib} restclient-cpp)
#else()
target_link_libraries(${LIBRARY_NAME} ${Boost_LIBRARIES} ${CppUsLib} restclient-cpp)
endif()
#endif()
#if(APPLE)
# set_target_properties(xacc PROPERTIES LDFLAGS "-undefined dynamic_lookup")
#else()
# set_target_properties(xacc PROPERTIES LDFLAGS "-shared")
#endif()
# Get the test files
file(GLOB test_files utils/tests/*Tester.cpp accelerator/tests/*Tester.cpp)
......
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