Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
schaapcommon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
schaapcommon
Commits
d470a396
Commit
d470a396
authored
2 months ago
by
Maik Nijhuis
Browse files
Options
Downloads
Patches
Plain Diff
Only fetch XTensor if needed
parent
88a89abc
No related branches found
Branches containing commit
No related tags found
1 merge request
!162
Only fetch XTensor if needed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+3
-2
3 additions, 2 deletions
.gitlab-ci.yml
CMakeLists.txt
+34
-38
34 additions, 38 deletions
CMakeLists.txt
with
37 additions
and
40 deletions
.gitlab-ci.yml
+
3
−
2
View file @
d470a396
...
...
@@ -98,17 +98,18 @@ format:
clang-tidy
:
extends
:
.needs-2204
stage
:
linting
variables
:
CLANG_TIDY_FIXES
:
clang-tidy-fixes.yml
before_script
:
-
git clone https://gitlab.com/aroffringa/aocommon.git
script
:
-
export CLANG_TIDY_FIXES=clang-tidy-fixes.yml
-
mkdir build && cd build
-
cmake -DAOCOMMON_INCLUDE_DIR=../aocommon/include -DCLANG_TIDY_FIXES_FILE=${CLANG_TIDY_FIXES} -DCLANG_TIDY_WERROR=ON -DBUILD_TESTING=ON ..
-
make check-clang-tidy
artifacts
:
when
:
on_failure
paths
:
-
build/
clang-tidy-fixes.yml
-
build/
${CLANG_TIDY_FIXES}
.build
:
stage
:
build
...
...
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
34
−
38
View file @
d470a396
...
...
@@ -44,10 +44,20 @@ add_compile_options(
-Wextra
-Wno-unused-parameter
)
# Let schaapcommon be a STATIC library, to reduce the risk on linking problems
add_library
(
schaapcommon STATIC
""
)
find_package
(
Threads REQUIRED
)
target_link_libraries
(
${
SCHAAPCOMMON_PROJECT_NAME
}
Threads::Threads
)
# Convenience conditional to distinguish between stand-alone vs dependency builds
set
(
SCHAAPCOMMON_MASTER_PROJECT OFF
)
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR
)
set
(
SCHAAPCOMMON_MASTER_PROJECT ON
)
if
(
${
CMAKE_CURRENT_SOURCE_DIR
}
STREQUAL
${
CMAKE_SOURCE_DIR
}
)
set
(
SCHAAPCOMMON_MASTER_PROJECT TRUE
)
else
()
set
(
SCHAAPCOMMON_MASTER_PROJECT FALSE
)
endif
()
if
(
SCHAAPCOMMON_MASTER_PROJECT
)
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
set
(
CLANG_TIDY_EXE
"clang-tidy"
...
...
@@ -56,9 +66,18 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
""
CACHE STRING
"Write clang-tidy fixes to yml file with specified name."
)
option
(
CLANG_TIDY_WERROR OFF
)
endif
()
if
(
CLANG_TIDY_WERROR
)
set
(
CLANG_TIDY_WARNINGS_AS_ERRORS
"*"
)
endif
()
file
(
GLOB_RECURSE ALL_CXX_SOURCE_FILES
${
CMAKE_SOURCE_DIR
}
/src/*.cc
)
add_custom_target
(
check-clang-tidy
COMMAND
${
CLANG_TIDY_EXE
}
--export-fixes=
${
CLANG_TIDY_FIXES_FILE
}
--warnings-as-errors=
${
CLANG_TIDY_WARNINGS_AS_ERRORS
}
-p .
${
ALL_CXX_SOURCE_FILES
}
)
if
(
SCHAAPCOMMON_MASTER_PROJECT
)
# Require AOCOMMON when compiled in standalone.
set
(
AOCOMMON_INCLUDE_DIR
""
...
...
@@ -89,41 +108,18 @@ if(SCHAAPCOMMON_MASTER_PROJECT)
REQUIRED
)
endif
()
else
()
include
(
"
${
CMAKE_SOURCE_DIR
}
/external/aocommon/CMake/FetchXTensor.cmake"
)
endif
()
# Compile in release mode if schaapcommon is included from external
# dependency
if
(
NOT SCHAAPCOMMON_MASTER_PROJECT
)
set
(
CMAKE_BUILD_TYPE Release
)
endif
()
# Let schaapcommon be a STATIC library, to reduce the risk on linking problems
add_library
(
schaapcommon STATIC
""
)
find_package
(
Threads REQUIRED
)
target_link_libraries
(
${
SCHAAPCOMMON_PROJECT_NAME
}
Threads::Threads
)
if
(
SCHAAPCOMMON_MASTER_PROJECT
)
if
(
CMAKE_EXPORT_COMPILE_COMMANDS
)
if
(
CLANG_TIDY_WERROR
)
set
(
CLANG_TIDY_WARNINGS_AS_ERRORS
"*"
)
endif
()
file
(
GLOB_RECURSE ALL_CXX_SOURCE_FILES
${
CMAKE_SOURCE_DIR
}
/src/*.cc
)
add_custom_target
(
check-clang-tidy
COMMAND
${
CLANG_TIDY_EXE
}
--export-fixes=
${
CLANG_TIDY_FIXES_FILE
}
--warnings-as-errors=
${
CLANG_TIDY_WARNINGS_AS_ERRORS
}
-p .
${
ALL_CXX_SOURCE_FILES
}
)
# Projects using schaapcommon and XTensor should include FetchXTensor.cmake
# *before* schaapcommon, since:
# - FetchXTensor.cmake should apply compiler directives to the entire project.
# - FetchXTensor.cmake does not support duplicate inclusion.
# Fetch XTensor if it has not been fetched before.
if
(
NOT TARGET xtensor
)
include
(
${
CMAKE_SOURCE_DIR
}
/external/aocommon/CMake/FetchXTensor.cmake
)
endif
()
# Install targets
install
(
TARGETS schaapcommon
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
# Compile in release mode if schaapcommon is included as external dependency.
set
(
CMAKE_BUILD_TYPE Release
)
endif
()
# For backwards compatibility: Build everything if SCHAAPCOMMON_MODULES is unset.
...
...
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