Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Hello
GitLab will be updated tonight at 22:00. Expect short outage.
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
3ef91dc2
Commit
3ef91dc2
authored
6 years ago
by
Tomáš Pecka
Committed by
Jan Trávníček
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
CMakeGen: More constants to config
parent
ffe02679
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
Dev tp
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMake/config.ini
+7
-1
7 additions, 1 deletion
CMake/config.ini
CMake/generate.py
+11
-13
11 additions, 13 deletions
CMake/generate.py
with
18 additions
and
14 deletions
CMake/config.ini
+
7
−
1
View file @
3ef91dc2
...
...
@@ -3,11 +3,17 @@ major = 0
minor
=
0
patch
=
1
[Templates]
[CMake:Templates]
root
=
CMakeLists_root.txt
lib
=
CMakeLists_lib.txt
bin
=
CMakeLists_bin.txt
[CMake:Sources]
ExcludeSources:
.txx,
.cxx,
.hxx
SourcesDir:
src
TestSourcesDir:
test-src
[ModulesLib]
alib2algo
alib2algo_experimental
...
...
This diff is collapsed.
Click to expand it.
CMake/generate.py
+
11
−
13
View file @
3ef91dc2
...
...
@@ -9,6 +9,8 @@ import argparse
class
SmartOpen
:
SEPARATOR_SIZE
=
20
def
__init__
(
self
,
filename
,
mode
=
'
r
'
,
*
,
directory
=
'
.
'
,
encoding
=
None
,
dry_run
=
False
):
self
.
_dry_run
=
dry_run
self
.
_filename
=
filename
...
...
@@ -24,13 +26,13 @@ class SmartOpen:
def
__enter__
(
self
):
if
self
.
_dry_run
and
'
w
'
in
self
.
_mode
:
self
.
_fd
.
write
(
f
'
{
self
.
_filename
}
\n
'
+
'
-
'
*
SEPARATOR_SIZE
+
'
\n
'
)
self
.
_fd
.
write
(
f
'
{
self
.
_filename
}
\n
'
+
'
-
'
*
self
.
SEPARATOR_SIZE
+
'
\n
'
)
return
self
.
_fd
def
__exit__
(
self
,
d_type
,
value
,
traceback
):
if
self
.
_dry_run
and
'
w
'
in
self
.
_mode
:
self
.
_fd
.
write
(
'
-
'
*
SEPARATOR_SIZE
+
'
\n
'
)
self
.
_fd
.
write
(
'
-
'
*
self
.
SEPARATOR_SIZE
+
'
\n
'
)
if
self
.
_fd
!=
sys
.
stdout
:
self
.
_fd
.
close
()
...
...
@@ -40,9 +42,6 @@ class SmartOpen:
SCRIPT_DIRECTORY
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
))
ALIB_DIRECTORY
=
os
.
path
.
join
(
SCRIPT_DIRECTORY
,
"
..
"
)
SEPARATOR_SIZE
=
20
SOURCES_EXCLUDE
=
(
'
.cxx
'
,
'
.hxx
'
,
'
.txx
'
)
config
=
configparser
.
ConfigParser
(
allow_no_value
=
True
)
config
.
read
(
os
.
path
.
join
(
SCRIPT_DIRECTORY
,
'
config.ini
'
))
...
...
@@ -56,7 +55,7 @@ PACKAGES = {
}
TEMPLATES
=
{
tpl
:
SmartOpen
(
config
[
'
Templates
'
][
tpl
],
directory
=
SCRIPT_DIRECTORY
,
mode
=
'
r
'
).
read
()
for
tpl
in
[
'
root
'
,
'
lib
'
,
'
bin
'
]
tpl
:
SmartOpen
(
config
[
'
CMake:
Templates
'
][
tpl
],
directory
=
SCRIPT_DIRECTORY
,
mode
=
'
r
'
).
read
()
for
tpl
in
[
'
root
'
,
'
lib
'
,
'
bin
'
]
}
...
...
@@ -74,9 +73,11 @@ def get_source_files(project_name, directory):
source_files
=
[]
relpath_ref
=
os
.
path
.
join
(
ALIB_DIRECTORY
,
project_name
)
exclude_sources
=
tuple
(
map
(
lambda
s
:
s
.
strip
(),
config
[
'
CMake:Sources
'
][
'
ExcludeSources
'
].
split
(
'
,
'
)))
for
dp
,
dn
,
fn
in
os
.
walk
(
os
.
path
.
join
(
relpath_ref
,
directory
)):
source_files
=
source_files
+
[
os
.
path
.
relpath
(
os
.
path
.
join
(
dp
,
file
),
relpath_ref
)
for
file
in
fn
if
not
file
.
endswith
(
SOURCES_EXCLUDE
)]
for
file
in
fn
if
not
file
.
endswith
(
exclude_sources
)]
return
source_files
...
...
@@ -145,9 +146,6 @@ def create_root_cmakelist(dry_run, packages):
alib_versioning_patch
=
config
[
'
Versioning
'
][
'
patch
'
],
))
if
dry_run
:
f
.
write
(
'
-
'
*
SEPARATOR_SIZE
+
'
\n
'
)
def
create_library_package
(
project_name
,
dry_run
):
link_libs
,
link_test_libs
,
include_libs
,
include_test_libs
,
cmake_options
=
parse_makeconfig
(
...
...
@@ -161,8 +159,8 @@ def create_library_package(project_name, dry_run):
include_paths
=
include_libs
,
include_test_paths
=
include_test_libs
,
cmake_options
=
cmake_options
,
source_files
=
to_rows
(
get_source_files
(
project_name
,
'
src
'
)),
source_files_test
=
to_rows
(
get_source_files
(
project_name
,
'
test-src
'
)),
source_files
=
to_rows
(
get_source_files
(
project_name
,
config
[
'
CMake:Sources
'
][
'
SourcesDir
'
]
)),
source_files_test
=
to_rows
(
get_source_files
(
project_name
,
config
[
'
CMake:Sources
'
][
'
TestSourcesDir
'
]
)),
))
...
...
@@ -178,7 +176,7 @@ def create_executable_package(project_name, dry_run):
include_paths
=
include_libs
,
include_test_paths
=
include_test_libs
,
cmake_options
=
cmake_options
,
source_files
=
to_rows
(
get_source_files
(
project_name
,
'
src
'
)),
source_files
=
to_rows
(
get_source_files
(
project_name
,
config
[
'
CMake:Sources
'
][
'
SourcesDir
'
]
)),
))
# ----------------------------------------------------------------------------------------------------------------------
...
...
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