diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a9b79b3..4e92c721 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,16 @@ cmake_minimum_required(VERSION 3.14.0) project(crypto C) +# +# CUSTOM PATH Definiton +# +set(SA_CUSTOM_PATH_DEFAULT "../../sa/custom") +set(KEY_CUSTOM_PATH_DEFAULT "../../key/custom") +set(MC_CUSTOM_PATH_DEFAULT "../../mc/custom") +set(CRYPTO_CUSTOM_PATH_DEFAULT "../../crypto/custom") + + + # # Define Build Flags # The default value is captured in line, change with flag `-DXYZ=1` @@ -27,14 +37,19 @@ option(CODECOV "Code Coverage" OFF) option(CRYPTO_LIBGCRYPT "Cryptography Module - Libgcrypt" ON) option(CRYPTO_KMC "Cryptography Module - KMC" OFF) option(CRYPTO_WOLFSSL "Cryptography Module - WolfSSL" OFF) +option(CRYPTO_CUSTOM "Cryptography Module - CUSTOM" OFF) +option(CRYPTO_CUSTOM_PATH "Cryptography Module - CUSTOM PATH" OFF) option(DEBUG "Debug" OFF) option(KEY_CUSTOM "Key Module - Custom" OFF) +option(KEY_CUSTOM_PATH "Custom Key Path" OFF) option(KEY_INTERNAL "Key Module - Internal" ON) option(KEY_KMC "Key Module - KMC" OFF) option(MC_CUSTOM "Monitoring and Control - Custom" OFF) +option(MC_CUSTOM_PATH "Custom Monitoring and Control path" OFF) option(MC_DISABLED "Monitoring and Control - Disabled" OFF) option(MC_INTERNAL "Monitoring and Control - Internal" ON) option(SA_CUSTOM "Security Association - Custom" OFF) +option(SA_CUSTOM_PATH "Custion Security Association Path" OFF) option(SA_INTERNAL "Security Association - Internal" ON) option(SA_MARIADB "Security Association - MariaDB" OFF) option(SUPPORT "Support" OFF) @@ -46,6 +61,39 @@ OPTION(KMC_MDB_RH "KMC-MDB-RedHat-Integration-Testing" OFF) #Disabled by default OPTION(KMC_MDB_DB "KMC-MDB-Debian-Integration-Testing" OFF) #Disabled by default, enable with: -DKMC_MDB_DB=ON OPTION(KMC_CFFI_EXCLUDE "KMC-Exclude-Problematic-CFFI-Code" OFF) #Disabled by default, enable with: -DKMC_CFFI_EXCLUDE=ON + +# +# Custom Module Paths +# +if(KEY_CUSTOM) + if(NOT DEFINED ${KEY_CUSTOM_PATH}) + set(KEY_CUSTOM_PATH ${KEY_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "KEY_CUSTOM being utilized. Path set to: ${KEY_CUSTOM_PATH}") +endif() + +if(MC_CUSTOM) + if(NOT DEFINED ${KEY_CUSTOM_PATH}) + set(MC_CUSTOM_PATH ${MC_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "MC_CUSTOM being utilized. Path set to: ${MC_CUSTOM_PATH}") +endif() + +if(SA_CUSTOM) + if(NOT DEFINED ${SA_CUSTOM_PATH}) + set(SA_CUSTOM_PATH ${SA_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "SA_CUSTOM being utilized. Path set to: ${SA_CUSTOM_PATH}") +endif() + +if(CRYPTO_CUSTOM) + if(NOT DEFINED ${CRYPTO_CUSTOM_PATH}) + set(CRYPTO_CUSTOM_PATH ${CRYPTO_CUSTOM_PATH_DEFAULT}) + endif() + message(STATUS "CRYPTO_CUSTOM being utilized. Path set to: ${CRYPTO_CUSTOM_PATH}") +endif() + + # # Build Flag Logic # diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 48249225..26e32e0c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,6 +19,14 @@ include_directories(../include) aux_source_directory(core LIB_SRC_FILES) +if(CRYPTO_CUSTOM) + aux_source_directory(CRYPTO_CUSTOM_PATH CRYPTO_FILES) + list(APPEND LIB_SRC_FILES ${CRYPTO_FILES}) +else() + aux_source_directory(crypto/custom_stub CRYPTO_FILES) + list(APPEND LIB_SRC_FILES ${CRYPTO_FILES}) +endif() + if(CRYPTO_LIBGCRYPT) aux_source_directory(crypto/libgcrypt LIBGCRYPT_FILES) list(APPEND LIB_SRC_FILES ${LIBGCRYPT_FILES}) @@ -45,7 +53,7 @@ endif() if(KEY_CUSTOM) # Assumes CryptoLib is a Git submodule to project and custom directories and definitions exist at top level - aux_source_directory(../../key/custom KEY_CUSTOM_FILES) + aux_source_directory(KEY_CUSTOM_PATH KEY_CUSTOM_FILES) list(APPEND LIB_SRC_FILES ${KEY_CUSTOM_FILES}) else() aux_source_directory(key/custom_stub KEY_CUSTOM_FILES) @@ -70,7 +78,7 @@ endif() if(MC_CUSTOM) # Assumes CryptoLib is a Git submodule to project and custom directories and definitions exist at top level - aux_source_directory(../../mc/custom MC_CUSTOM_FILES) + aux_source_directory(MC_CUSTOM_PATH MC_CUSTOM_FILES) list(APPEND LIB_SRC_FILES ${MC_CUSTOM_FILES}) else() aux_source_directory(mc/custom_stub MC_CUSTOM_FILES) @@ -95,7 +103,7 @@ endif() if(SA_CUSTOM) # Assumes CryptoLib is a Git submodule to project and custom directories and definitions exist at top level - aux_source_directory(../../sa/custom SA_CUSTOM_FILES) + aux_source_directory(SA_CUSTOM_PATH SA_CUSTOM_FILES) list(APPEND LIB_SRC_FILES ${SA_CUSTOM_FILES}) else() aux_source_directory(sa/custom_stub SA_CUSTOM_FILES)