Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
51b56d2b
Commit
51b56d2b
authored
5 years ago
by
Raphael Grimm
Browse files
Options
Downloads
Patches
Plain Diff
Add cmake macros
parent
c6990275
Loading
Loading
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMakeModules/SimoxMacros.cmake
+56
-0
56 additions, 0 deletions
CMakeModules/SimoxMacros.cmake
with
56 additions
and
0 deletions
CMakeModules/SimoxMacros.cmake
+
56
−
0
View file @
51b56d2b
...
...
@@ -52,3 +52,59 @@ function(SimoxQtLibrary name srcs incs mocFiles uiFiles)
# add Saba and GraspStudio
TARGET_LINK_LIBRARIES
(
${
name
}
PUBLIC GraspStudio Saba
)
endfunction
()
macro
(
simox_subdirs result curdir
)
file
(
GLOB children
${
curdir
}
/*
)
set
(
${
result
}
)
foreach
(
child
${
children
}
)
if
(
IS_DIRECTORY
${
child
}
)
list
(
APPEND
${
result
}
${
child
}
)
endif
()
endforeach
()
endmacro
()
macro
(
simox_update_file file content
)
#macro since we want to provide simox_file_up_to_date
set
(
simox_file_up_to_date 0
)
if
(
EXISTS
"
${
file
}
"
)
file
(
SHA512
"
${
file
}
"
_simox_file_sha
)
string
(
SHA512 _simox_cont_sha
"
${
content
}
"
)
if
(
"
${
_simox_cont_sha
}
"
STREQUAL
"
${
_simox_file_sha
}
"
)
set
(
simox_file_up_to_date 1
)
endif
()
endif
()
#write file
if
(
${
simox_file_up_to_date
}
EQUAL 0
)
file
(
WRITE
"
${
file
}
"
"
${
content
}
"
)
endif
()
endmacro
()
macro
(
simox_generate_subdir_headers dir prefix_to_remove out_headers
)
string
(
REPLACE
"//"
"/"
prefix_to_remove_fixed
"
${
prefix_to_remove
}
/"
)
string
(
REPLACE
"
${
prefix_to_remove_fixed
}
"
""
dir_rel
"
${
dir
}
"
)
_simox_generate_subdir_headers_impl
(
"
${
dir
}
"
"
${
prefix_to_remove_fixed
}
"
${
out_headers
}
)
endmacro
()
macro
(
_simox_generate_subdir_headers_impl dir prefix_to_remove out_headers
)
simox_subdirs
(
subdirs
${
dir
}
)
foreach
(
subdir
${
subdirs
}
)
#recurse
_simox_generate_subdir_headers_impl
(
"
${
subdir
}
"
"
${
prefix_to_remove
}
"
${
out_headers
}
)
file
(
GLOB headers
${
subdir
}
/*.h
)
list
(
LENGTH headers n
)
string
(
REGEX REPLACE
".*/"
""
subdir_name
"
${
subdir
}
"
)
if
(
NOT
${
n
}
EQUAL 0 AND NOT
"
${
subdir_name
}
"
STREQUAL
"detail"
)
set
(
subdir_header_abs
"
${
subdir
}
.h"
)
string
(
REPLACE
"
${
prefix_to_remove
}
"
""
subdir_header
"
${
subdir_header_abs
}
"
)
list
(
APPEND
${
out_headers
}
${
subdir_header
}
)
#create file content
set
(
content
"#pragma once
\n\n
// This file is generated!
\n\n
"
)
foreach
(
header
${
headers
}
)
string
(
REPLACE
"
${
subdir
}
/"
"
${
subdir_name
}
/"
h
"
${
header
}
"
)
set
(
content
"
${
content
}
#include
\"
${
h
}
\"\n
"
)
endforeach
()
#check for file change
simox_update_file
(
"
${
subdir_header_abs
}
"
"
${
content
}
"
)
endif
()
endforeach
()
endmacro
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment