Skip to content

Commit 8e2cdc6

Browse files
committed
Formatting and Cleanup of Cmake files
1 parent 91b0cfb commit 8e2cdc6

File tree

58 files changed

+178
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+178
-228
lines changed

external/flux_sdk_import.cmake

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1+
# ##############################################################################
2+
# include/import file for the flux-sdk cmake system
3+
# ##############################################################################
14

2-
3-
########################################################################
4-
## include/import file for the flux-sdk cmake system
5-
########################################################################
6-
7-
8-
# we are just using this as a manifest system, so doing the best to
9-
# bypass the compiler detection
5+
# we are just using this as a manifest system, so doing the best to bypass the
6+
# compiler detection
107
set(CMAKE_C_COMPILER_FORCED TRUE)
118
set(CMAKE_CXX_COMPILER_FORCED TRUE)
129

13-
# Where is the flux-sdk directory? This should be in some "include file from the sdk"
10+
# Where is the flux-sdk directory? This should be in some "include file from the
11+
# sdk"
1412

15-
if (NOT FLUX_SDK_PATH)
16-
if (DEFINED ENV{FLUX_SDK_PATH})
17-
set(FLUX_SDK_PATH $ENV{FLUX_SDK_PATH})
18-
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../flux-sdk)
19-
set(FLUX_SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../flux-sdk)
20-
endif()
13+
if(NOT FLUX_SDK_PATH)
14+
if(DEFINED ENV{FLUX_SDK_PATH})
15+
set(FLUX_SDK_PATH $ENV{FLUX_SDK_PATH})
16+
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../flux-sdk)
17+
set(FLUX_SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../flux-sdk)
18+
endif()
2119
endif()
2220

2321
# crawl the flux-sdk directory and add all the subdirectories
24-
include(${FLUX_SDK_PATH}/flux_sdk_init.cmake)
22+
include(${FLUX_SDK_PATH}/flux_sdk_init.cmake)

flux_sdk_init.cmake

Lines changed: 106 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,154 @@
1-
21
# @file: flux_sdk_init.cmake
32

4-
############################################################################
3+
# ##############################################################################
54
# flux_sdk_version()
65
include(${CMAKE_CURRENT_LIST_DIR}/flux_sdk_version.cmake)
76

8-
# set language to NONE- disables compiler checks - too
9-
# project(${CMAKE_PROJECT_NAME} NONE)
10-
11-
############################################################################
7+
# ##############################################################################
128
# flux_sdk_set_project_directory()
139
#
1410
macro(flux_sdk_set_project_directory project_directory)
1511

16-
set(PROJECT_FLUX_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${project_directory}/Flux)
12+
set(PROJECT_FLUX_DIRECTORY
13+
${CMAKE_CURRENT_SOURCE_DIR}/${project_directory}/Flux)
1714

18-
if ( NOT EXISTS ${PROJECT_FLUX_DIRECTORY} )
19-
message(STATUS "Creating directory: ${PROJECT_FLUX_DIRECTORY}")
20-
file(MAKE_DIRECTORY ${PROJECT_FLUX_DIRECTORY})
21-
endif()
15+
if(NOT EXISTS ${PROJECT_FLUX_DIRECTORY})
16+
message(STATUS "Creating directory: ${PROJECT_FLUX_DIRECTORY}")
17+
file(MAKE_DIRECTORY ${PROJECT_FLUX_DIRECTORY})
18+
endif()
2219

2320
endmacro()
24-
############################################################################
21+
# ##############################################################################
2522
# flux_sdk_add_module()
2623
#
27-
## macro to add "modules" to our list of modules to add to the build
24+
# macro to add "modules" to our list of modules to add to the build
2825
macro(flux_sdk_add_module)
29-
set(list_var "${ARGN}")
30-
foreach(arg IN LISTS list_var)
31-
list(APPEND FLUX_MODULES_TO_ADD ${arg})
32-
endforeach()
26+
set(list_var "${ARGN}")
27+
foreach(arg IN LISTS list_var)
28+
list(APPEND FLUX_MODULES_TO_ADD ${arg})
29+
endforeach()
3330
endmacro()
3431

3532
function(flux_sdk_get_directory_name result_name)
36-
get_filename_component(THIS_MODULE ${CMAKE_CURRENT_SOURCE_DIR} NAME)
37-
set(${result_name} ${THIS_MODULE} PARENT_SCOPE)
33+
get_filename_component(THIS_MODULE ${CMAKE_CURRENT_SOURCE_DIR} NAME)
34+
set(${result_name}
35+
${THIS_MODULE}
36+
PARENT_SCOPE)
3837
endfunction()
3938

40-
############################################################################
39+
# ##############################################################################
4140
# flux_sdk_add_source_files()
4241
#
43-
## Macro to add a file to our build system file list
42+
# Macro to add a file to our build system file list
4443
macro(flux_sdk_add_source_files)
45-
set(list_var "${ARGN}")
46-
foreach(arg IN LISTS list_var)
47-
configure_file(${arg} ${PROJECT_FLUX_DIRECTORY} COPYONLY)
48-
endforeach()
44+
set(list_var "${ARGN}")
45+
foreach(arg IN LISTS list_var)
46+
configure_file(${arg} ${PROJECT_FLUX_DIRECTORY} COPYONLY)
47+
endforeach()
4948
endmacro()
5049

51-
############################################################################
50+
# ##############################################################################
5251
# flux_sdk_is_module_enabled()
5352
#
54-
# Define a function that will check if a module is enabled in the list
55-
# of enabled modules
53+
# Define a function that will check if a module is enabled in the list of
54+
# enabled modules
5655

5756
function(flux_sdk_is_module_enabled module_name result)
58-
if(${module_name} IN_LIST FLUX_MODULES_TO_ADD)
59-
set(${result} TRUE PARENT_SCOPE)
60-
else()
61-
set(${result} FALSE PARENT_SCOPE)
62-
endif()
57+
if(${module_name} IN_LIST FLUX_MODULES_TO_ADD)
58+
set(${result}
59+
TRUE
60+
PARENT_SCOPE)
61+
else()
62+
set(${result}
63+
FALSE
64+
PARENT_SCOPE)
65+
endif()
6366
endfunction()
6467

65-
66-
############################################################################
68+
# ##############################################################################
6769
# flux_sdk_process_subdirectories()
6870
#
69-
# Define a function that will cacade down subdirectories if that directory
70-
# is a module desired, and has a CMakeLists.txt file.
71+
# Define a function that will cacade down subdirectories if that directory is a
72+
# module desired, and has a CMakeLists.txt file.
7173
#
72-
# Note: If the <directory>_all_modules flag is set, then all submodules of that
73-
# directory will be processed
74+
# Note: If the <directory>_all_modules flag is set, then all submodules of that
75+
# directory will be processed
7476

7577
function(flux_sdk_process_subdirectories)
76-
77-
# get our place in the SDK - print a value
78-
file(RELATIVE_PATH local_path ${FLUX_SDK_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
79-
message("Processing:\t\$FLUX_SDK/${local_path}")
8078

81-
# Get the name of the current directory - basename. We use this
82-
# to build our "all submodules" flag for this directory
83-
get_filename_component(CurrentDir ${CMAKE_CURRENT_SOURCE_DIR} NAME)
84-
set(all_modules_flag "${CurrentDir}_all_modules")
79+
# get our place in the SDK - print a value
80+
file(RELATIVE_PATH local_path ${FLUX_SDK_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
81+
message("Processing:\t\$FLUX_SDK/${local_path}")
8582

86-
# is the flag set?
87-
flux_sdk_is_module_enabled(${all_modules_flag} process_all_submodules)
83+
# Get the name of the current directory - basename. We use this to build our
84+
# "all submodules" flag for this directory
85+
get_filename_component(CurrentDir ${CMAKE_CURRENT_SOURCE_DIR} NAME)
86+
set(all_modules_flag "${CurrentDir}_all_modules")
8887

89-
# is everything enabled?
90-
flux_sdk_is_module_enabled(flux_all_modules process_all_modules)
88+
# is the flag set?
89+
flux_sdk_is_module_enabled(${all_modules_flag} process_all_submodules)
9190

92-
message("Module flag:\t${all_modules_flag} = ${process_all_submodules}")
91+
# is everything enabled?
92+
flux_sdk_is_module_enabled(flux_all_modules process_all_modules)
9393

94-
# are we loading all submodules?
95-
if ( process_all_submodules OR process_all_modules)
96-
set(load_all_modules TRUE)
97-
endif()
94+
message("Module flag:\t${all_modules_flag} = ${process_all_submodules}")
95+
96+
# are we loading all submodules?
97+
if(process_all_submodules OR process_all_modules)
98+
set(load_all_modules TRUE)
99+
endif()
98100

99-
# Get all the children of this directory
100-
file(GLOB children RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*)
101-
102-
# Iterate over all the children
103-
foreach(child ${children})
104-
105-
# Sanity check
106-
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${child} AND
107-
EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${child}/CMakeLists.txt)
108-
109-
# add this module - in list, or all devices flag set
110-
if (load_all_modules OR ${child} IN_LIST FLUX_MODULES_TO_ADD)
111-
message(STATUS "Adding: ${child}")
112-
add_subdirectory(${child})
113-
endif()
114-
endif()
115-
endforeach()
116-
message("")
101+
# Get all the children of this directory
102+
file(
103+
GLOB children
104+
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
105+
${CMAKE_CURRENT_SOURCE_DIR}/*)
106+
107+
# Iterate over all the children
108+
foreach(child ${children})
109+
110+
# Sanity check
111+
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${child}
112+
AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${child}/CMakeLists.txt)
113+
114+
# add this module - in list, or all devices flag set
115+
if(load_all_modules OR ${child} IN_LIST FLUX_MODULES_TO_ADD)
116+
message(STATUS "Adding: ${child}")
117+
add_subdirectory(${child})
118+
endif()
119+
endif()
120+
endforeach()
121+
message("")
117122
endfunction()
118123

119-
############################################################################
124+
# ##############################################################################
120125
# flux_sdk_init()
121126
#
122-
# Called to start the SDK build process. This should be called after the flux_sdk
123-
# import cmake file is loaded (of course)
127+
# Called to start the SDK build process. This should be called after the
128+
# flux_sdk import cmake file is loaded (of course)
124129
macro(flux_sdk_init)
125-
if (NOT CMAKE_PROJECT_NAME)
126-
message(WARNING "flux_sdk_init() should be called after the project is created")
127-
endif()
130+
if(NOT CMAKE_PROJECT_NAME)
131+
message(
132+
WARNING "flux_sdk_init() should be called after the project is created")
133+
endif()
134+
135+
# write some info!
136+
message("\n-----------------------------------------------------")
137+
message("SparkFun Flux SDK - Version: ${FLUX_SDK_VERSION}")
138+
message("-----------------------------------------------------\n")
139+
message("SDK Path:\t${FLUX_SDK_PATH}")
140+
message("Project Name:\t${CMAKE_PROJECT_NAME}")
141+
message("Destination:\t${PROJECT_FLUX_DIRECTORY}")
142+
message("")
143+
144+
# is everything enabled?
145+
flux_sdk_is_module_enabled(flux_all_modules process_all_modules)
146+
message("Module flag:\tflux_all_modules = ${process_all_modules}")
147+
string(TIMESTAMP COMPILE_TIME "%Y-%m-%d %H:%M:%S")
148+
message("Build Time:\t${COMPILE_TIME}")
149+
message("")
150+
151+
# load the root directory of the SDK
152+
add_subdirectory(${FLUX_SDK_PATH} flux-sdk)
128153

129-
# write some info!
130-
message("\n-----------------------------------------------------")
131-
message("SparkFun Flux SDK - Version: ${FLUX_SDK_VERSION}")
132-
message("-----------------------------------------------------\n")
133-
message("SDK Path:\t${FLUX_SDK_PATH}")
134-
message("Project Name:\t${CMAKE_PROJECT_NAME}")
135-
message("Destination:\t${PROJECT_FLUX_DIRECTORY}")
136-
message("")
137-
138-
# is everything enabled?
139-
flux_sdk_is_module_enabled(flux_all_modules process_all_modules)
140-
message("Module flag:\tflux_all_modules = ${process_all_modules}")
141-
string(TIMESTAMP COMPILE_TIME "%Y-%m-%d %H:%M:%S")
142-
message("Build Time:\t${COMPILE_TIME}")
143-
message("")
144-
145-
# load the root directory of the SDK
146-
add_subdirectory(${FLUX_SDK_PATH} flux-sdk)
147-
148-
endmacro()
154+
endmacro()

flux_sdk_version.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
2-
# define a version for the SDK
1+
# define a version for the SDK
32

43
set(FLUX_SDK_VERSION_MAJOR 1)
54
set(FLUX_SDK_VERSION_MINOR 3)
65
set(FLUX_SDK_VERSION_PATCH 0)
76
set(FLUX_SDK_VERSION_TITLE "In Development")
8-
set(FLUX_SDK_VERSION "${FLUX_SDK_VERSION_MAJOR}.${FLUX_SDK_VERSION_MINOR}.${FLUX_SDK_VERSION_PATCH} - ${FLUX_SDK_VERSION_TITLE}")
7+
set(FLUX_SDK_VERSION
8+
"${FLUX_SDK_VERSION_MAJOR}.${FLUX_SDK_VERSION_MINOR}.${FLUX_SDK_VERSION_PATCH} - ${FLUX_SDK_VERSION_TITLE}"
9+
)

src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# just add our subdirectories -- recurse down the tree
32
add_subdirectory(core)
43
add_subdirectory(device)

src/core/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
2-
## Process all sub-modules
1+
# Process all sub-modules
32
flux_sdk_process_subdirectories()

src/device/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
2-
## Process all sub-modules
1+
# Process all sub-modules
32
flux_sdk_process_subdirectories()
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
# Add the source files for this directory
3-
flux_sdk_add_source_files(flxDevACS37800.h flxDevACS37800.cpp)
2+
flux_sdk_add_source_files(flxDevACS37800.h flxDevACS37800.cpp)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
# Add the source files for this directory
3-
flux_sdk_add_source_files(flxDevADS1015.h flxDevADS1015.cpp)
2+
flux_sdk_add_source_files(flxDevADS1015.h flxDevADS1015.cpp)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
# Add the source files for this directory
3-
flux_sdk_add_source_files(flxDevADS122C04.h flxDevADS122C04.cpp)
2+
flux_sdk_add_source_files(flxDevADS122C04.h flxDevADS122C04.cpp)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
# Add the source files for this directory
3-
flux_sdk_add_source_files(flxDevAHT20.h flxDevAHT20.cpp)
2+
flux_sdk_add_source_files(flxDevAHT20.h flxDevAHT20.cpp)

0 commit comments

Comments
 (0)