1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- cmake_minimum_required (VERSION 3.5.1)
- ### To use gcc/g++ on a Macintosh, you must set the Compilers
- ### here, not inside the project
- ##if(APPLE)
- ## set(CMAKE_C_COMPILER "/usr/local/bin/gcc-7")
- ## set(CMAKE_CXX_COMPILER "/usr/local/bin/g++-7")
- ##endif()
- ### TODO: for now, we use CLang for Mac
- ###
- ### In order to create OpenFHE's static libraries you should enable
- ### the BUILD_STATIC option. For that, you run "cmake .. -DBUILD_STATIC=ON".
- ### After having your link completed you will find static libs
- ### with the suffix "_static" in ./build/libs/.
- ### Examples: OPENFHEpke_static.a, OPENFHEcore_static.a, etc.
- ### After you run "make install" in your build directory, you can build your custom application.
- ### If you need your application to be linked statically, then run "cmake .. -DBUILD_STATIC=ON"
- project(openfhe)
- set(CMAKE_CXX_STANDARD 17)
- option( BUILD_STATIC "Set to ON to include static versions of the library" OFF)
- find_package(OpenFHE)
- find_package(pybind11 REQUIRED)
- set( CMAKE_CXX_FLAGS ${OpenFHE_CXX_FLAGS} )
- set( OpenFHE_Py_SOURCES src)
- set( OpenFHE_Py_INCLUDES include)
- include_directories( ${OPENMP_INCLUDES} )
- include_directories( ${OpenFHE_INCLUDE} )
- include_directories( ${OpenFHE_INCLUDE}/third-party/include )
- include_directories( ${OpenFHE_INCLUDE}/core )
- include_directories( ${OpenFHE_INCLUDE}/pke )
- # include_directories( ${OpenFHE_Py_SOURCES} )
- include_directories( ${OpenFHE_Py_INCLUDES}/pke )
- include_directories( ${OpenFHE_Py_INCLUDES} )
- ### add directories for other OpenFHE modules as needed for your project
- link_directories( ${OpenFHE_LIBDIR} )
- link_directories( ${OPENMP_LIBRARIES} )
- if(BUILD_STATIC)
- set( CMAKE_EXE_LINKER_FLAGS "${OpenFHE_EXE_LINKER_FLAGS} -static")
- link_libraries( ${OpenFHE_STATIC_LIBRARIES} )
- else()
- set( CMAKE_EXE_LINKER_FLAGS ${OpenFHE_EXE_LINKER_FLAGS} )
- link_libraries( ${OpenFHE_SHARED_LIBRARIES} )
- endif()
- ### ADD YOUR EXECUTABLE(s) HERE
- ### add_executable( EXECUTABLE-NAME SOURCES )
- ###
- ### EXAMPLE:
- ### add_executable( test demo-simple-example.cpp )
- ### Pybind Modules
- pybind11_add_module(openfhe src/bindings.cpp src/pke/decryption.cpp src/pke/serialization.cpp src/pke/cryptocontext_wrapper.cpp)
- ### Python installation
- find_package(Python REQUIRED COMPONENTS Interpreter Development)
- execute_process(
- COMMAND "${Python_EXECUTABLE}" -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
- OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- message(STATUS "Python site packages directory: ${PYTHON_SITE_PACKAGES}")
- install(TARGETS openfhe LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES})
|