소스 검색

Bump required CMake version & DRY

* The oldest supported Ubuntu Version is 22.04 which comes with CMake 3.22.
* Refactor demos/CMakeLists.txt to set the list of binaries only once.

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 2 달 전
부모
커밋
91757cf54d
4개의 변경된 파일25개의 추가작업 그리고 36개의 파일을 삭제
  1. 9 0
      .ci/cmake.bat
  2. 1 1
      CMakeLists.txt
  3. 3 10
      appveyor.yml
  4. 12 25
      demos/CMakeLists.txt

+ 9 - 0
.ci/cmake.bat

@@ -0,0 +1,9 @@
+
+if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" goto :eof
+if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" goto :eof
+
+mkdir build
+cd build
+cmake -G "Ninja" ..
+ninja
+cd..

+ 1 - 1
CMakeLists.txt

@@ -3,7 +3,7 @@
 # LibTomCrypt, modular cryptographic library -- Tom St Denis
 #
 
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.22)
 
 project(
     libtomcrypt

+ 3 - 10
appveyor.yml

@@ -20,20 +20,13 @@ build_script:
       if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
       cd..
       git clone https://github.com/libtom/libtommath.git --branch=master
+      cp libtomcrypt\.ci\cmake.bat libtommath\cmake.bat
       cd libtommath
-      mkdir build
-      cd build
-      cmake -G "Ninja" ..
-      ninja
-      cd..
+      cmake.bat
       nmake -f makefile.msvc
       cd..
       cd libtomcrypt
-      mkdir build
-      cd build
-      cmake -G "Ninja" ..
-      ninja
-      cd..
+      .ci\cmake.bat
       nmake -f makefile.msvc all
       cp test.exe test-stock.exe
       cp timing.exe timing-stock.exe

+ 12 - 25
demos/CMakeLists.txt

@@ -1,13 +1,6 @@
 # -----------------------------------------------------------------------------
 # Options
 # -----------------------------------------------------------------------------
-option(BUILD_USEFUL_DEMOS "Build useful demos (hashsum)" FALSE)
-option(
-    BUILD_USABLE_DEMOS
-    "Build usable demos (aesgcm constants crypt openssh-privkey openssl-enc latex-tables sizes timing)"
-    FALSE
-)
-option(BUILD_TEST_DEMOS "Build test demos (small tv_gen)" FALSE)
 
 option(INSTALL_DEMOS "Install enabled demos (USEFUL and/or USABLE) and ltc wrapper script" FALSE)
 
@@ -16,11 +9,13 @@ option(INSTALL_DEMOS "Install enabled demos (USEFUL and/or USABLE) and ltc wrapp
 #
 # Demos that are even somehow useful and could be installed as a system-tool
 #
-# * USEFUL_DEMOS   = hashsum
 # -----------------------------------------------------------------------------
+set(USEFUL_DEMOS hashsum)
+list(JOIN USEFUL_DEMOS " " USEFUL_DEMOS_STR)
+option(BUILD_USEFUL_DEMOS "Build useful demos (${USEFUL_DEMOS_STR})" FALSE)
 
 if(BUILD_USEFUL_DEMOS)
-    list(APPEND USABLE_DEMOS_TARGETS hashsum)
+    list(APPEND USABLE_DEMOS_TARGETS ${USEFUL_DEMOS})
 endif()
 
 # -----------------------------------------------------------------------------
@@ -28,23 +23,13 @@ endif()
 #
 # Demos that are usable but only rarely make sense to be installed
 #
-# USEABLE_DEMOS  = aesgcm constants crypt der_print_flexi latex-tables openssh-privkey openssl-enc sizes timing
 # -----------------------------------------------------------------------------
+set(USABLE_DEMOS aesgcm constants crypt der_print_flexi latex-tables openssh-privkey openssl-enc sizes timing)
+list(JOIN USABLE_DEMOS " " USABLE_DEMOS_STR)
+option(BUILD_USABLE_DEMOS "Build usable demos (${USABLE_DEMOS_STR})" FALSE)
 
 if(BUILD_USABLE_DEMOS)
-    list(
-        APPEND
-        USABLE_DEMOS_TARGETS
-        aesgcm
-        constants
-        crypt
-        der_print_flexi
-        latex-tables
-        openssh-privkey
-        openssl-enc
-        sizes
-        timing
-    )
+    list(APPEND USABLE_DEMOS_TARGETS ${USABLE_DEMOS})
 endif()
 
 # -----------------------------------------------------------------------------
@@ -52,11 +37,13 @@ endif()
 #
 # Demos that are used for testing or measuring
 #
-# * TEST_DEMOS     = small tv_gen
 # -----------------------------------------------------------------------------
+set(TEST_DEMOS small tv_gen)
+list(JOIN TEST_DEMOS " " TEST_DEMOS_STR)
+option(BUILD_TEST_DEMOS "Build test demos (${TEST_DEMOS_STR})" FALSE)
 
 if(BUILD_TEST_DEMOS)
-    list(APPEND ALL_DEMOS_TARGETS small tv_gen)
+    list(APPEND ALL_DEMOS_TARGETS ${TEST_DEMOS})
 endif()
 
 # -----------------------------------------------------------------------------