Skip to content

Commit

Permalink
[ca][CMake]:add CMake build for ca
Browse files Browse the repository at this point in the history
[Desc]:as title

Signed-off-by: pengyinjie <[email protected]>
  • Loading branch information
XMPengYinjie committed Dec 26, 2024
1 parent 92a5c11 commit c3cb025
Show file tree
Hide file tree
Showing 7 changed files with 453 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ca/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ##############################################################################
# frameworks/security/ca/CMakeList.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

nuttx_add_subdirectory()

nuttx_generate_kconfig(MENUDESC "Client applications")
71 changes: 71 additions & 0 deletions ca/alipay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ##############################################################################
# frameworks/security/ca/alipay/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_CA_ALIPAY_API)

# vela CMake build process
nuttx_add_prebuilt(
BIN_TARGETS alipay_ca APP_TARGETS ${CONFIG_CA_ALIPAY_TEST_PROGNAME}
EXPORT_FILES ../../include/alipay_ca_api.h)

nuttx_library_ifndef(SKIP_PREBUILT alipay_ca)

# ############################################################################
# Source files
# ############################################################################

nuttx_sources(alipay_ca_api.c)

# ############################################################################
# Flags always set
# ############################################################################

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()
list(APPEND CFLAGS -DBINARY_PREFIX="ca_alipay")

nuttx_compile_options(${CFLAGS})

# ############################################################################
# Application add
# ############################################################################

if(CONFIG_CA_ALIPAY_TEST)
nuttx_add_application(
NAME
${CONFIG_CA_ALIPAY_TEST_PROGNAME}
SRCS
alipay_test.c
STACKSIZE
${CONFIG_CA_ALIPAY_TEST_STACKSIZE}
PRIORITY
${CONFIG_CA_ALIPAY_TEST_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_ALIPAY_TEST)

endif()
75 changes: 75 additions & 0 deletions ca/comsst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ##############################################################################
# frameworks/security/ca/comsst/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

# ##############################################################################
# Source files
# ##############################################################################

if(CONFIG_CA_COMSST_API)

# vela CMake build process
nuttx_add_prebuilt(
BIN_TARGETS comsst_ca APP_TARGETS ${CONFIG_CA_COMSST_TEST_PROGNAME}
EXPORT_FILES ../../include/comsst_ca_api.h)

nuttx_library_ifndef(SKIP_PREBUILT comsst_ca)

# ############################################################################
# Source files
# ############################################################################

nuttx_sources(comsst_ca_api.c)

# ############################################################################
# Flags always set
# ############################################################################

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()
list(APPEND CFLAGS -DBINARY_PREFIX="ca_comsst")

nuttx_compile_options(${CFLAGS})

# ############################################################################
# Application add
# ############################################################################

if(CONFIG_CA_COMSST_TEST)
nuttx_add_application(
NAME
${CONFIG_CA_COMSST_TEST_PROGNAME}
SRCS
comsst_test.c
STACKSIZE
${CONFIG_CA_COMSST_TEST_STACKSIZE}
PRIORITY
${CONFIG_CA_COMSST_TEST_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_COMSST_TEST)

endif()
52 changes: 52 additions & 0 deletions ca/hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ##############################################################################
# frameworks/security/ca/hello_world/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_CA_HELLO_WORLD)

# ############################################################################
# Flags always set
# ############################################################################

set(CFLAGS)
list(APPEND CFLAGS -DBINARY_PREFIX="ca_hello_world")

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()

nuttx_add_application(
NAME
${CONFIG_CA_HELLO_WORLD_PROGNAME}
SRCS
hello_world_ns.c
STACKSIZE
${CONFIG_CA_HELLO_WORLD_STACKSIZE}
PRIORITY
${CONFIG_CA_HELLO_WORLD_PRIORITY}
COMPILE_FLAGS
${CFLAGS})

endif(CONFIG_CA_HELLO_WORLD)
71 changes: 71 additions & 0 deletions ca/pin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ##############################################################################
# frameworks/security/ca/pin/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_CA_PIN_API)

# vela CMake build process
nuttx_add_prebuilt(
BIN_TARGETS pin_ca APP_TARGETS ${CONFIG_CA_PIN_TEST_PROGNAME} EXPORT_FILES
../../include/pin_ca_api.h)

nuttx_library_ifndef(SKIP_PREBUILT pin_ca)

# ############################################################################
# Source files
# ############################################################################

nuttx_sources(pin_ca_api.c)

# ############################################################################
# Flags always set
# ############################################################################

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()
list(APPEND CFLAGS -DBINARY_PREFIX="ca_pin")

nuttx_compile_options(${CFLAGS})

# ############################################################################
# Application add
# ############################################################################

if(CONFIG_CA_PIN_TEST)
nuttx_add_application(
NAME
${CONFIG_CA_PIN_TEST_PROGNAME}
SRCS
pin_test.c
STACKSIZE
${CONFIG_CA_PIN_TEST_STACKSIZE}
PRIORITY
${CONFIG_CA_PIN_TEST_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_PIN_TEST)

endif()
90 changes: 90 additions & 0 deletions ca/triad/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ##############################################################################
# frameworks/security/ca/triad/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_CA_TRIAD_API)

# vela CMake build process
nuttx_add_prebuilt(
BIN_TARGETS
triad_ca
APP_TARGETS
${CONFIG_CA_TRIAD_TEST_PROGNAME}
${CONFIG_CA_TRIAD_TOOL_PROGNAME}
EXPORT_FILES
../../include/triad_ca_api.h)

nuttx_library_ifndef(SKIP_PREBUILT triad_ca)

# ############################################################################
# Source files
# ############################################################################

nuttx_sources(triad_ca_api.c)

# ############################################################################
# Flags always set
# ############################################################################

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()
list(APPEND CFLAGS -DBINARY_PREFIX="ca_triad")

nuttx_compile_options(${CFLAGS})

# ############################################################################
# Application add
# ############################################################################

if(CONFIG_CA_TRIAD_TEST)
nuttx_add_application(
NAME
${CONFIG_CA_TRIAD_TEST_PROGNAME}
SRCS
triad_test.c
STACKSIZE
${CONFIG_CA_TRIAD_TEST_STACKSIZE}
PRIORITY
${CONFIG_CA_TRIAD_TEST_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_TRIAD_TEST)

if(CONFIG_CA_TRIAD_TOOL)
nuttx_add_application(
NAME
${CONFIG_CA_TRIAD_TOOL_PROGNAME}
SRCS
triad_tool.c
STACKSIZE
${CONFIG_CA_TRIAD_TOOL_STACKSIZE}
PRIORITY
${CONFIG_CA_TRIAD_TOOL_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_TRIAD_TOOL)

endif()
Loading

0 comments on commit c3cb025

Please sign in to comment.