The application directory consists of the following
CMakelists.txt is copied and renamed from CMakelists.User.txt from the root directory of this git repo.
It consists of the following lines:
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(demo CXX)
set(CMAKE_CXX_STANDARD 17)
option( BUILD_STATIC "Set to ON to include static versions of the library" OFF)
find_package(OpenFHE CONFIG REQUIRED)
if (OpenFHE_FOUND)
message(STATUS "FOUND PACKAGE OpenFHE")
message(STATUS "OpenFHE Version: ${BASE_OPENFHE_VERSION}")
message(STATUS "OpenFHE installed as shared libraries: ${OpenFHE_SHARED}")
message(STATUS "OpenFHE include files location: ${OpenFHE_INCLUDE}")
message(STATUS "OpenFHE lib files location: ${OpenFHE_LIBDIR}")
message(STATUS "OpenFHE Native Backend size: ${OpenFHE_NATIVE_SIZE}")
else()
message(FATAL_ERROR "PACKAGE OpenFHE NOT FOUND")
endif ()
set( CMAKE_CXX_FLAGS ${OpenFHE_CXX_FLAGS} )
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_INCLUDE}/binfhe )
### 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 )
add_executable( fhe-demo simple-integers.cpp)
CMake suite maintained and supported by Kitware (kitware.com/cmake).
P.S : I referred https://forum.freecad.org/viewtopic.php?t=65301 for a solution but it didn't seem to work for me.
I am a begineer in C++ . I would be grateful for any pointers in solving this!
I am trying to use OpenFHE to build my own user application by following the documentation: Building User Applications.
About OpenFHE installation
I have installed Openfhe for Ubuntu by referring to Installation . It is installed in my system at
/usr/local/lib
The headers files are at : /usr/local/include
I am getting the following error while
make
The application directory consists of the following CMakelists.txt is copied and renamed from CMakelists.User.txt from the root directory of this git repo. It consists of the following lines:
simple-integers.cpp is taken from here
The output of cmake .. with above CMakelists.txt is:
g++ -v
CMake suite maintained and supported by Kitware (kitware.com/cmake).