Browse Source

secp256k1 building under msvc

cl-refactor
debris 10 years ago
parent
commit
74115e23c5
  1. 42
      secp256k1/CMakeLists.txt

42
secp256k1/CMakeLists.txt

@ -3,47 +3,19 @@ set(CMAKE_AUTOMOC OFF)
set(CMAKE_ASM_COMPILER "yasm")
include_directories(${Boost_INCLUDE_DIRS})
set(EXECUTABLE secp256k1)
file(GLOB HEADERS "*.h")
if ("${TARGET_PLATFORM}" STREQUAL "w64")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/field_5x52_asm.o
COMMAND yasm -f win64 -o ${CMAKE_CURRENT_BINARY_DIR}/field_5x52_asm.o ${CMAKE_CURRENT_SOURCE_DIR}/field_5x52_asm.asm
)
add_custom_target(
asmOut ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/field_5x52_asm.o
)
if(ETH_STATIC)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c ${CMAKE_CURRENT_BINARY_DIR}/field_5x52_asm.o)
else()
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c ${CMAKE_CURRENT_BINARY_DIR}/field_5x52_asm.o)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -DUSE_FIELD_5X52 -DUSE_FIELD_5X52_ASM -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM")
elseif(APPLE)
if(ETH_STATIC)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c field_5x52_asm.asm)
else()
find_library(GMP_LS gmp /usr/local/lib)
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c field_5x52_asm.asm)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DUSE_FIELD_GMP -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM")
if(ETH_STATIC)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c)
else()
if(ETH_STATIC)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c field_5x52_asm.asm)
else()
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c field_5x52_asm.asm)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DUSE_FIELD_GMP -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM")
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c)
endif()
if (NOT GMP_LS)
set(GMP_LS gmp)
endif ()
target_link_libraries(${EXECUTABLE} ${GMP_LS})
set_target_properties(${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/TP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_NUM_BOOST -DUSE_FIELD_10X26 -DUSE_FIELD_INV_BUILTIN")
install( TARGETS ${EXECUTABLE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )

Loading…
Cancel
Save