Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jan Koniarik
emlabcpp
Commits
544764f7
Commit
544764f7
authored
Oct 23, 2021
by
Jan Koniarik
Browse files
reworked how examples are compiled
parent
e1d4ea0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/CMakeLists.txt
deleted
100644 → 0
View file @
e1d4ea0e
cmake_minimum_required
(
VERSION 3.10.2
)
project
(
emlabcpp_examples
)
set
(
CMAKE_CXX_STANDARD 20
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_EXTENSIONS OFF
)
add_compile_options
(
-g
-Werror
-Wextra
-Wpedantic
-Wnon-virtual-dtor
-Wold-style-cast
-Wcast-align
-Wunused
-Woverloaded-virtual
-Wnull-dereference
-Wformat=2
#-Wduplicated-cond
#-Wlogical-op
#-Wuseless-cast
-Wunreachable-code
-Wsign-conversion
-Wconversion
-Wdouble-promotion
-fmax-errors=5
)
include_directories
(
../include/
)
add_executable
(
algorithm algorithm.cpp
)
examples/examples.cmake
0 → 100644
View file @
544764f7
function
(
add_emlabcpp_example name
)
add_executable
(
${
name
}
_example examples/
${
name
}
.cpp
)
emlabcpp_setup_test
(
${
name
}
_example
)
endfunction
()
add_emlabcpp_example
(
algorithm
)
add_emlabcpp_example
(
protocol
)
tests/tests.cmake
View file @
544764f7
...
...
@@ -6,7 +6,12 @@ set(CMAKE_CXX_STANDARD 20)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_EXTENSIONS OFF
)
add_compile_options
(
function
(
emlabcpp_setup_test target
)
target_include_directories
(
${
target
}
PRIVATE tests/include/
)
target_link_libraries
(
${
target
}
emlabcpp
)
add_test
(
NAME
${
target
}
COMMAND
${
target
}
)
target_compile_options
(
${
target
}
PRIVATE
-gdwarf
-Werror
-Wextra
...
...
@@ -28,11 +33,12 @@ add_compile_options(
-DEMLABCPP_ASSERT_NATIVE
)
endfunction
()
function
(
add_emlabcpp_test name
)
add_executable
(
${
name
}
tests/
${
name
}
.cpp
)
target_link_libraries
(
${
name
}
GTest::GTest GTest::Main emlabcpp
)
target_include_directories
(
${
name
}
PRIVATE tests/include/
)
add_test
(
NAME
${
name
}
COMMAND
${
name
}
)
target_link_libraries
(
${
name
}
GTest::GTest GTest::Main
)
emlabcpp_setup_test
(
${
name
}
)
endfunction
()
add_emlabcpp_test
(
static_circular_buffer_test
)
...
...
@@ -48,9 +54,11 @@ add_emlabcpp_test(protocol_def_test)
add_emlabcpp_test
(
protocol_sophisticated_test
)
add_emlabcpp_test
(
protocol_register_map_test
)
file
(
GLOB_RECURSE HEADER_FILES
"
${
PROJECT_SOURCE_DIR
}
/include/*.h"
)
include
(
examples/examples.cmake
)
#file(GLOB_RECURSE HEADER_FILES
# "${PROJECT_SOURCE_DIR}/include/*.h"
#)
#add_format_test(
# TARGET emlabcpp_format
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment