mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
Improve config lib.
This commit is contained in:
parent
fac9558524
commit
3dc608da22
|
@ -63,4 +63,18 @@ add_custom_target(
|
||||||
# WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell
|
# WORKING_DIRECTORY ${PROJECT_ROOT_PATH}/cmake-shell
|
||||||
# )
|
# )
|
||||||
|
|
||||||
define_file_name(${TARGET_NAME})
|
function(config_owner target)
|
||||||
|
get_target_property(source_files "${target}" SOURCES)
|
||||||
|
foreach(source_file ${source_files})
|
||||||
|
get_property(defs SOURCE "${source_file}"
|
||||||
|
PROPERTY COMPILE_DEFINITIONS)
|
||||||
|
get_filename_component(file_name "${source_file}" NAME)
|
||||||
|
list(APPEND defs "CONFIG_OWNER")
|
||||||
|
set_property(
|
||||||
|
SOURCE "${source_file}"
|
||||||
|
PROPERTY COMPILE_DEFINITIONS ${defs})
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
define_file_name(${TARGET_NAME})
|
||||||
|
config_owner(${TARGET_NAME})
|
13
utils/Config/config.cmake
Normal file
13
utils/Config/config.cmake
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
function(config_owner target)
|
||||||
|
get_target_property(source_files "${target}" SOURCES)
|
||||||
|
foreach(source_file ${source_files})
|
||||||
|
get_property(defs SOURCE "${source_file}"
|
||||||
|
PROPERTY COMPILE_DEFINITIONS)
|
||||||
|
get_filename_component(file_name "${source_file}" NAME)
|
||||||
|
list(APPEND defs "CONFIG_OWNER")
|
||||||
|
set_property(
|
||||||
|
SOURCE "${source_file}"
|
||||||
|
PROPERTY COMPILE_DEFINITIONS ${defs})
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
|
@ -3,9 +3,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -18,6 +18,9 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_OWNER
|
||||||
|
#error This is internal file, never include it.
|
||||||
#endif
|
#endif
|
||||||
const StatusCode CreateConfigCode(const long int code);
|
const StatusCode CreateConfigCode(const long int code);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -19,6 +19,9 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_OWNER
|
||||||
|
#error This is internal file, never include it.
|
||||||
#endif
|
#endif
|
||||||
typedef struct config Config;
|
typedef struct config Config;
|
||||||
typedef struct config
|
typedef struct config
|
||||||
|
|
Loading…
Reference in New Issue
Block a user