Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_backend_cpu
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
Releases
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_backend_cpu
Commits
447dbc81
Commit
447dbc81
authored
1 year ago
by
Olivier BICHLER
Browse files
Options
Downloads
Patches
Plain Diff
Cleaner CMake
parent
a0817f6a
No related branches found
No related tags found
No related merge requests found
Pipeline
#31534
passed
1 year ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+5
-14
5 additions, 14 deletions
CMakeLists.txt
cmake/PybindModuleCreation.cmake
+15
-17
15 additions, 17 deletions
cmake/PybindModuleCreation.cmake
unit_tests/CMakeLists.txt
+1
-2
1 addition, 2 deletions
unit_tests/CMakeLists.txt
with
21 additions
and
33 deletions
CMakeLists.txt
+
5
−
14
View file @
447dbc81
...
...
@@ -60,9 +60,9 @@ target_include_directories(${module_name}
)
# PYTHON BINDING
generate_python_binding
(
${
project
}
${
module_name
}
)
if
(
PYBIND
)
generate_python_binding
(
${
project
}
${
module_name
}
)
# Handles Python + pybind11 headers dependencies
target_link_libraries
(
${
module_name
}
PUBLIC
...
...
@@ -74,21 +74,12 @@ endif()
target_compile_features
(
${
module_name
}
PRIVATE cxx_std_14
)
if
(
WERROR
)
target_compile_options
(
${
module_name
}
PRIVATE
target_compile_options
(
${
module_name
}
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wold-style-cast -Winline -pedantic -Werror=narrowing -Wshadow -Werror>
)
target_compile_options
(
${
module_name
}
PRIVATE
-Wall -Wextra -Wold-style-cast -Winline -pedantic -Werror=narrowing -Wshadow
$<$<BOOL:
${
WERROR
}
>:
-Werror>
>
)
target_compile_options
(
${
module_name
}
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
/W4>
)
else
()
target_compile_options
(
${
module_name
}
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wold-style-cast -Winline -pedantic -Werror=narrowing -Wshadow -Wpedantic>
)
target_compile_options
(
${
module_name
}
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
/W4>
)
endif
()
if
(
CMAKE_COMPILER_IS_GNUCXX AND COVERAGE
)
append_coverage_compiler_flags
()
...
...
This diff is collapsed.
Click to expand it.
cmake/PybindModuleCreation.cmake
+
15
−
17
View file @
447dbc81
function
(
generate_python_binding name target_to_bind
)
if
(
PYBIND
)
add_definitions
(
-DPYBIND
)
Include
(
FetchContent
)
add_definitions
(
-DPYBIND
)
Include
(
FetchContent
)
FetchContent_Declare
(
PyBind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.10.4
# or a later release
)
FetchContent_Declare
(
PyBind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.10.4
# or a later release
)
# Use the New FindPython mode, recommanded. Requires CMake 3.15+
find_package
(
Python COMPONENTS Interpreter Development
)
FetchContent_MakeAvailable
(
PyBind11
)
# Use the New FindPython mode, recommanded. Requires CMake 3.15+
find_package
(
Python COMPONENTS Interpreter Development
)
FetchContent_MakeAvailable
(
PyBind11
)
message
(
STATUS
"Creating binding for module
${
name
}
"
)
file
(
GLOB_RECURSE pybind_src_files
"python_binding/*.cpp"
)
message
(
STATUS
"Creating binding for module
${
name
}
"
)
file
(
GLOB_RECURSE pybind_src_files
"python_binding/*.cpp"
)
pybind11_add_module
(
${
name
}
MODULE
${
pybind_src_files
}
"NO_EXTRAS"
)
# NO EXTRA recquired for pip install
target_include_directories
(
${
name
}
PUBLIC
"python_binding"
)
target_link_libraries
(
${
name
}
PUBLIC
${
target_to_bind
}
)
endif
()
pybind11_add_module
(
${
name
}
MODULE
${
pybind_src_files
}
"NO_EXTRAS"
)
# NO EXTRA recquired for pip install
target_include_directories
(
${
name
}
PUBLIC
"python_binding"
)
target_link_libraries
(
${
name
}
PUBLIC
${
target_to_bind
}
)
endfunction
()
This diff is collapsed.
Click to expand it.
unit_tests/CMakeLists.txt
+
1
−
2
View file @
447dbc81
Include
(
FetchContent
)
FetchContent_Declare
(
...
...
@@ -10,7 +9,7 @@ FetchContent_Declare(
FetchContent_MakeAvailable
(
Catch2
)
file
(
GLOB_RECURSE src_files
"*.cpp"
)
message
(
STATUS
"TEST FILES :
${
src_files
}
"
)
add_executable
(
tests
${
module_name
}
${
src_files
}
)
target_link_libraries
(
tests
${
module_name
}
PUBLIC
${
module_name
}
)
...
...
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