refactor CMakeLists.txt

pull/2/head
MITSUNARI Shigeo 6 years ago
parent 146a65c7b9
commit 1039b23887
  1. 42
      CMakeLists.txt
  2. 6
      include/mcl/bn.h

@ -71,12 +71,11 @@ else()
set(CPU x86-64)
endif()
endif()
set(LIBS mcl)
if(USE_GMP)
set(LIBS ${LIBS} gmp gmpxx)
set(EXT_LIBS ${EXT_LIBS} gmp gmpxx)
endif()
if(USE_OPENSSL)
set(LIBS ${LIBS} crypto)
set(EXT_LIBS ${EXT_LIBS} crypto)
endif()
endif()
@ -126,19 +125,44 @@ include_directories(
${mcl_SOURCE_DIR}/include
)
add_library(mcl STATIC ${SRCS})
add_library(mcl_dy SHARED ${SRCS})
target_link_libraries(mcl_dy ${LIBS})
set_target_properties(mcl_dy PROPERTIES OUTPUT_NAME mcl)
#set_target_properties(mcl_dy PROPERTIES OUTPUT_NAME mcl VERSION 1.0.0 SOVERSION 1)
add_library(mcl SHARED ${SRCS})
add_library(mcl_st STATIC ${SRCS})
target_link_libraries(mcl ${EXT_LIBS})
target_link_libraries(mcl_st ${EXT_LIBS})
set_target_properties(mcl_st PROPERTIES OUTPUT_NAME mcl)
#set_target_properties(mcl_st PROPERTIES PREFIX "lib")
#set_target_properties(mcl PROPERTIES OUTPUT_NAME mcl VERSION 1.0.0 SOVERSION 1)
# For semantics of ABI compatibility including when you must bump SOVERSION, see:
# https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B#The_Do.27s_and_Don.27ts
set(LIBS mcl ${EXT_LIBS})
add_library(mclbn256 SHARED src/bn_c256.cpp)
target_link_libraries(mclbn256 ${LIBS})
add_library(mclbn384 SHARED src/bn_c384.cpp)
target_link_libraries(mclbn384 ${LIBS})
add_library(mclbn512 SHARED src/bn_c512.cpp)
target_link_libraries(mclbn512 ${LIBS})
add_library(mclbn384_256 SHARED src/bn_c384_256.cpp)
target_link_libraries(mclbn384_256 ${LIBS})
add_executable(bn_c256_test test/bn_c256_test.cpp)
target_link_libraries(bn_c256_test mclbn256)
add_executable(bn_c384_test test/bn_c384_test.cpp)
target_link_libraries(bn_c384_test mclbn384)
add_executable(bn_c512_test test/bn_c512_test.cpp)
target_link_libraries(bn_c512_test mclbn512)
add_executable(bn_c384_256_test test/bn_c384_256_test.cpp)
target_link_libraries(bn_c384_256_test mclbn384_256)
file(GLOB MCL_HEADERS include/mcl/*.hpp include/mcl/bn.h include/mcl/curve_type.h)
file(GLOB CYBOZULIB_HEADERS include/cybozu/*.hpp)
install(TARGETS mcl DESTINATION lib)
install(TARGETS mcl_dy DESTINATION lib)
install(TARGETS mcl_st DESTINATION lib)
install(TARGETS mclbn256 DESTINATION lib)
install(TARGETS mclbn384 DESTINATION lib)
install(TARGETS mclbn384_256 DESTINATION lib)
install(TARGETS mclbn512 DESTINATION lib)
install(FILES ${MCL_HEADERS} DESTINATION include/mcl)
install(FILES include/mcl/impl/bn_c_impl.hpp DESTINATION include/mcl/impl)
install(FILES ${CYBOZULIB_HEADERS} DESTINATION include/cybozu)

@ -34,9 +34,11 @@
#ifndef MCLBN_NO_AUTOLINK
#if MCLBN_FP_UNIT_SIZE == 4
#pragma comment(lib, "mclbn256.lib")
#elif MCLBN_FP_UNIT_SIZE == 6
#elif (MCLBN_FP_UNIT_SIZE == 6) && (MCLBN_FR_UNIT_SIZE == 4)
#pragma comment(lib, "mclbn384_256.lib")
#elif (MCLBN_FP_UNIT_SIZE == 6) && (MCLBN_FR_UNIT_SIZE == 6)
#pragma comment(lib, "mclbn384.lib")
#else
#elif MCLBN_FP_UNIT_SIZE == 8
#pragma comment(lib, "mclbn512.lib")
#endif
#endif

Loading…
Cancel
Save