Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

240 cmake custom module paths #242

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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)
Expand All @@ -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
#
Expand Down
14 changes: 11 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Loading