@@ -371,10 +371,6 @@ crosscompile_prebuild_steps()
371371include_directories ("extern/re2" )
372372include_directories ("extern/boost" )
373373
374- if (BUILD_LIBTOM)
375- include_directories ("extern/libtommath" )
376- include_directories ("extern/libtomcrypt/src/headers" )
377- endif ()
378374
379375include_directories ("extern/decNumber" )
380376include_directories ("extern/icu/include" )
@@ -439,11 +435,31 @@ if(BUILD_LIBTOM)
439435########################################
440436# LIBRARY libtommath
441437########################################
438+ set (libtommath_ID tommath)
442439
443- file (GLOB libtommath_src "extern/libtommath/*.c" "extern/libtommath/*.h" )
440+ if (LIBTOMMATH_VER)
441+ set (LIBTOMMATH_DIR "extern/libtommath-${LIBTOMMATH_VER} " )
442+ else ()
443+ set (LIBTOMMATH_DIR "extern/libtommath" )
444+ endif ()
445+ include_directories ("${LIBTOMMATH_DIR} " )
446+
447+ # # test build vith MSVS
448+ # d: && cd d:/source/COMPONENTS/SQLfb/code/extern/libtommath-1.2
449+ # "c:/Program Files/Microsoft Visual Studio/18/Community/MSBuild/Current/Bin/MSBuild.exe" libtommath_MSVC15.sln /p:Configuration=Release /t:Rebuild /p:Platform=x64
450+ # execute_process(COMMAND
451+ # ${CMAKE_VS_MSBUILD_COMMAND} ${LIBTOMMATH_DIR}/libtommath_MSVC15.sln
452+ # /p:Configuration=Release /t:Rebuild
453+ # /p:Platform=x64
454+ # WORKING_DIRECTORY ${LIBTOMMATH_DIR})
455+ # file(COPY "${LIBTOMMATH_DIR}/lib/x64/Release/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
456+ # set(libtommath_ID tommath)
457+ # #
458+
459+ file (GLOB libtommath_src "${LIBTOMMATH_DIR} /*.c" "${LIBTOMMATH_DIR} /*.h" )
460+ add_library (${libtommath_ID} ${libtommath_src} )
461+ project_group (${libtommath_ID} Extern )
444462
445- add_library (${libtommath_ID} ${libtommath_src} )
446- project_group (${libtommath_ID} Extern )
447463
448464if (WIN32 AND USE_TTMATH_MASM)
449465 add_custom_command (TARGET ${libtommath_ID} PRE_BUILD
@@ -453,18 +469,19 @@ if (WIN32 AND USE_TTMATH_MASM)
453469 "${CMAKE_CURRENT_SOURCE_DIR} /extern/ttmath/ttmathuint_x86_64_msvc.asm"
454470 )
455471 set (libtommath_x86_64_masm_obj "${CMAKE_CURRENT_BINARY_DIR} /ttmathuint_x86_64_msvc.obj" )
472+ target_link_libraries (${libtommath_ID} ${LIB_builtins_Clang} ${libtommath_x86_64_masm_obj} )
456473 message ("use TTMATH MASM" )
457474else ()
458475 message ("not use TTMATH MASM" )
459476 add_definitions ("-DTTMATH_NOASM" )
460477endif ()
461478
462- target_link_libraries (${libtommath_ID} ${LIB_builtins_Clang} ${libtommath_x86_64_masm_obj} )
463-
464479########################################
465480# LIBRARY libtomcrypt
466481########################################
467482
483+ set (libtomcrypt_ID tomcrypt)
484+
468485file (GLOB_RECURSE libtomcrypt_src "extern/libtomcrypt/src/*" )
469486list (FILTER libtomcrypt_src EXCLUDE REGEX ".*aes_tab.c" )
470487list (FILTER libtomcrypt_src EXCLUDE REGEX ".*whirltab.c" )
@@ -474,6 +491,7 @@ add_library (${libtomcrypt_ID} ${libtomcrypt_src})
474491target_compile_definitions (${libtomcrypt_ID} PRIVATE LTC_NO_ROLC LTC_SOURCE )
475492target_link_libraries (${libtomcrypt_ID} ${libtommath_ID} )
476493project_group (${libtomcrypt_ID} Extern )
494+ include_directories ("extern/libtomcrypt/src/headers" )
477495
478496endif ()
479497
0 commit comments