📄 cmakelists.txt
字号:
cmake_minimum_required(VERSION 2.4)project(pbc)set(CMAKE_MODULE_PATH .)include_directories(. ./include)CONFIGURE_FILE(config.h.cmake config.h)set(examplebinexample/blsexample/bonehfranklinexample/hessexample/jouxexample/patersonexample/yuanliexample/zhangkimexample/zss)set(goodbinpbc/pbcgen/gena1paramgen/genaparamgen/gendparamgen/geneparamgen/genfparamgen/gengparamgen/hilbertpolygen/listmntgen/listfreemanbenchmark/benchmarkbenchmark/timersabenchmark/ellnet)set(buildbin ${goodbin} ${examplebin})# cross compiling for Windows using Debian's mingw package# cmake -D crossmingw:BOOL=1# I keep my cross-compiled GMP in ~/cross/gmp/if(crossmingw) set(GMP_INCLUDE_DIR $ENV{HOME}/cross/gmp/include) set(GMP_LIBRARY $ENV{HOME}/cross/gmp/lib/libgmp.a) set(CMAKE_EXECUTABLE_SUFFIX ".exe") set(CMAKE_COMPILER_IS_GNUCXX 1) set(CMAKE_CXX_COMPILER "i586-mingw32msvc-c++") set(CMAKE_C_COMPILER "i586-mingw32msvc-gcc") set(CMAKE_AR "i586-mingw32msvc-ar") set(CMAKE_RANLIB "i586-mingw32msvc-ranlib") set(CMAKE_SKIP_RPATH ON) set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) set(get_time_src "misc/get_time.win32.c")else(crossmingw) find_package(GMP REQUIRED) find_package(Readline) set(get_time_src "misc/get_time.c")endif(crossmingw)if (READLINE_FOUND) add_executable(pbc/pbc pbc/pbc.c pbc/pbc_getline.readline.c) target_link_libraries(pbc/pbc readline)else (READLINE_FOUND) add_executable(pbc/pbc pbc/pbc.c pbc/pbc_getline.c)endif (READLINE_FOUND)include_directories(${GMP_INCLUDE_DIR})add_library(pbcarith/fieldmpz.carith/montfp.carith/naivefp.carith/tinyfp.c arith/fastfp.c arith/fasterfp.carith/field.carith/fp.carith/fieldquadratic.carith/indexcalculus.carith/poly.c arith/random.cecc/curve.c ecc/singular.c ecc/pairing.c ecc/param.cecc/a_param.c ecc/d_param.c ecc/e_param.c ecc/f_param.c ecc/g_param.cecc/hilbert.c ecc/mnt.c ecc/mpc.cmisc/pbc_assert.cmisc/darray.c misc/symtab.cmisc/parse.cmisc/fops.c misc/tracker.cmisc/extend_printf.cmisc/memory.c${get_time_src})foreach(bin ${buildbin}) add_executable(${bin} ${bin}.c) target_link_libraries(${bin} pbc ${GMP_LIBRARY} m)endforeach(bin)target_link_libraries(pbc/pbc pbc ${GMP_LIBRARY} m)set(warnflags "-Wall -W -Wfloat-equal -Wendif-labels -Wshadow \\ -Wpointer-arith -Wcast-align -Wstrict-prototypes \\ -Wredundant-decls")set(excessivewarnflags "-std=c99 -pedantic")if(debug)set(optflags "-O0 -g")else(debug)set(optflags "-O3 -ffast-math -fomit-frame-pointer")endif(debug)# my laptop (IBM Thinkpad X31)# cmake -D x31:BOOL=1 .# doesn't help muchset(x31flags "-march=pentium-m -mmmx -msse -msse2 -mfpmath=sse -malign-double -maccumulate-outgoing-args")set(CMAKE_C_FLAGS "-pipe ${warnflags} ${optflags}")if(x31) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${x31flags}")endif(x31)# e.g: cmake -D CMAKE_INSTALL_PREFIX=~/.local .# make installinstall(TARGETS pbc pbc LIBRARY DESTINATION libARCHIVE DESTINATION lib)set(pbc_headerinclude/pbc_a1_param.hinclude/pbc_a_param.hinclude/pbc_assert.hinclude/pbc_curve.hinclude/pbc_darray.hinclude/pbc_d_param.hinclude/pbc_e_param.hinclude/pbc_field.hinclude/pbc_fieldmpz.hinclude/pbc_fieldquadratic.hinclude/pbc_fops.hinclude/pbc_f_param.hinclude/pbc_fp.hinclude/pbc_g_param.hinclude/pbc.hinclude/pbc_hilbert.hinclude/pbc_memory.hinclude/pbc_mnt.hinclude/pbc_mpc.hinclude/pbc_pairing.hinclude/pbc_param.hinclude/pbc_parse.hinclude/pbc_poly.hinclude/pbc_random.hinclude/pbc_singular.hinclude/pbc_symtab.hinclude/pbc_time.hinclude/pbc_tracker.hinclude/pbc_utils.h)install(FILES ${pbc_header} DESTINATION include/pbc)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -