Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/interval #2

Merged
merged 39 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
feedbec
CI : Add Report.CI
thomaslepoix Sep 9, 2022
6592d9b
add Coord operators
thomaslepoix Oct 11, 2022
9caf08a
add & test MeshlinePolicyManager::detect_intervals() + MeshlinePolicy…
thomaslepoix Oct 11, 2022
08001c6
add & mostly test Interval
thomaslepoix Oct 13, 2022
1041f08
fix : detect_rotation(Polygon) floating point bug
thomaslepoix Oct 24, 2022
70fbaf5
minor fixes
thomaslepoix Oct 25, 2022
fbffff6
enforce detect_rotation(Polygon) test
thomaslepoix Oct 25, 2022
170411f
add AllGridAxis helper for enum-indexed array
thomaslepoix Oct 25, 2022
a156357
add domain getters
thomaslepoix Oct 25, 2022
f30ea7f
add Polygon::name
thomaslepoix Oct 25, 2022
846be27
add Entity & Visitable
thomaslepoix Oct 25, 2022
e984a70
add SerializerToPlantuml & SerializerToPrettyprint visitors
thomaslepoix Oct 25, 2022
a4a1b85
revive main with lpf and stub demonstrations
thomaslepoix Oct 25, 2022
b042345
various fixes
thomaslepoix Oct 25, 2022
f325741
test to_string() funcs
thomaslepoix Oct 26, 2022
f0ac3ed
CI : checkout v2 -> v3
thomaslepoix Oct 28, 2022
32ddffb
CI : switch back from Report.CI to dorny/test-reporter
thomaslepoix Oct 28, 2022
09cdbc9
refactor Polygon & Board building
thomaslepoix Nov 1, 2022
6b598c1
add .editorconfig
thomaslepoix Nov 4, 2022
e519214
refactor: abort() -> unreachable()
thomaslepoix Nov 7, 2022
3eec67f
refactor : 3D Plane & Axis
thomaslepoix Nov 23, 2022
3753dba
add DEBUG version of unreachable() that invoke abort()
thomaslepoix Nov 24, 2022
86cff0a
refactor : add default implementations of EntityVisitor methods
thomaslepoix Nov 29, 2022
3ee5162
add SerializerToCsx
thomaslepoix Nov 29, 2022
46c7c40
refactor : constexpr signum + explicit casts
thomaslepoix Nov 29, 2022
42d9709
CMake : add CMakePresets.json
thomaslepoix Dec 5, 2022
8a6c823
add CPM_DISABLE & pugixml dependency
thomaslepoix Dec 6, 2022
b62b803
CMake : CPM 0.32.2 -> 0.36.0
thomaslepoix Dec 11, 2022
be22929
CMake : fix CPM dependencies for cache usage
thomaslepoix Dec 11, 2022
c6b7474
refactor : add domain namespace
thomaslepoix Dec 12, 2022
cbbcbf4
refactor : types.hpp -> normal.hpp
thomaslepoix Dec 12, 2022
6946ac2
refactor : noexcept a func
thomaslepoix Dec 13, 2022
33726e3
fix some -Wunqualified-std-cast-call & a -Wdangling
thomaslepoix Dec 14, 2022
687ebe4
add Polygon::type
thomaslepoix Dec 14, 2022
8b87910
add WIP ParserFromCsx
thomaslepoix Dec 14, 2022
b4c4374
add Cli & CLI11 dependency
thomaslepoix Dec 14, 2022
d372674
CMake : fix CPM_DISABLE -> defaults to ENV version
thomaslepoix Dec 14, 2022
c82724c
refactor : rm old debugs
thomaslepoix Dec 15, 2022
14a892f
test : vector_utils contains() & contains_that()
thomaslepoix Dec 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

indent_size = 4
indent_style = tab
tab_width = 4

[*.{json,nix,yml}]
indent_size = 2
indent_style = space
55 changes: 54 additions & 1 deletion .github/workflows/test_sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
sudo apt update
sudo apt install -y \
gcovr
# gcovr \
# libxml2-utils

- name: "Dependencies: Sonar"
run: |
Expand All @@ -39,6 +41,11 @@ jobs:
-o /tmp/sonar/build-wrapper-linux-x86.zip \
-d /tmp/sonar/

# - name: "Dependencies: Report.CI"
# run: |
# curl https://report.ci/report.py \
# > /tmp/report.py

- name: "Dependencies: Catch2"
run: |
git clone https://github.com/catchorg/Catch2.git
Expand All @@ -47,7 +54,7 @@ jobs:
sudo cmake --build build/ --target install

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down Expand Up @@ -78,3 +85,49 @@ jobs:
-Dsonar.host.url="https://sonarcloud.io" \
-Dsonar.login=${{ secrets.SONAR_TOKEN }} \
-Dsonar.cfamily.cache.enabled=false

# - name: Produce test report
# run: |
# build/test/unit/openemsh_unittest \
# -r xml::out=build/test/unit/openemsh_unittest_result.catch.xml \
# || true
#
# - name: Downgrade Catch XML format
# run: |
# sed \
# -i build/test/unit/openemsh_unittest_result.catch.xml \
# -e 's/<Catch2TestRun/<Catch/g' \
# -e '3i\<Group name="openemsh_unittest">' \
# -e "s/^<\/Catch2TestRun>/<\/Group>/"
# cat build/test/unit/openemsh_unittest_result.catch.xml \
# | tail -3 \
# | head -1 \
# >> build/test/unit/openemsh_unittest_result.catch.xml
# sed \
# -i build/test/unit/openemsh_unittest_result.catch.xml \
# -e '$a\</Catch>'
# xmllint \
# build/test/unit/openemsh_unittest_result.catch.xml \
# -o build/test/unit/openemsh_unittest_result.catch.xml \
# --format
#
# - name: Export test report
# run: |
# python /tmp/report.py \
# --name "Unittest"
# --token ${{ secrets.REPORT_CI_TOKEN }} \
# --include-as-catch build/test/unit/*.catch.xml

- name: Produce test report
run: |
build/test/unit/openemsh_unittest \
-r junit::out=build/test/unit/openemsh_unittest_result.xml \
|| true

- name: Export test report
uses: dorny/test-reporter@v1
with:
name: Unit tests
path: build/test/unit/openemsh_unittest_result.xml
reporter: java-junit
fail-on-error: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CMakeUserPresets.json
*build*/
.vscode/
result/
Expand Down
51 changes: 39 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ set( CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
)
#]]

find_package( CMakeUtils QUIET )
if( CMakeUtils_FOUND )
message( STATUS "Found CMakeUtils: ${CMakeUtils_DIR}" )
else()
message( STATUS "Not found CMakeUtils: Trying to download it with CPM" )
option( CPM_DISABLE "Don't use CPM to retrieve dependencies" "$ENV{CPM_DISABLE}" )

if( NOT CPM_DISABLE )
message( STATUS "Downloading dependencies with CPM" )

list( APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake"
Expand All @@ -43,14 +42,42 @@ else()
DOWNLOAD_ONLY
)

set( CMakeUtils_DIR "${FETCHCONTENT_BASE_DIR}/cmake-utils-src" )
set( CMakeUtils_DIR "${cmake-utils_SOURCE_DIR}" )

CPMAddPackage(
NAME pugixml
GITHUB_REPOSITORY zeux/pugixml
VERSION 1.12.1
OPTIONS
"BUILD_SHARED_LIBS ON"
)

set( pugixml_DIR "${pugixml_BINARY_DIR}" )

CPMAddPackage(
NAME CLI11
GITHUB_REPOSITORY CLIUtils/CLI11
VERSION 2.3.1
)

set( CLI11_DIR "${CLI11_BINARY_DIR}" )
endif()

find_package( CMakeUtils QUIET )
if( CMakeUtils_FOUND )
message( STATUS "Found CMakeUtils: ${CMakeUtils_DIR}" )
else()
message( STATUS "Not found CMakeUtils: Only minimal build enabled" )
endif()

find_package( pugixml REQUIRED )
if( pugixml_FOUND )
message( STATUS "Found pugixml: ${pugixml_DIR} ${PUGIXML_VERSION}" )
endif()

find_package( CMakeUtils QUIET )
if( CMakeUtils_FOUND )
message( STATUS "Found CMakeUtils: ${CMakeUtils_DIR}" )
else()
message( STATUS "Not found CMakeUtils: Only minimal build enabled" )
endif()
find_package( CLI11 REQUIRED )
if( CLI11_FOUND )
message( STATUS "Found CLI11: ${CLI11_DIR} ${CLI11_VERSION}" )
endif()

if( CMakeUtils_FOUND )
Expand Down
71 changes: 71 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"version": 5,
"cmakeMinimumRequired": {
"major": 3,
"minor": 24,
"patch": 0
},
"configurePresets": [
{
"name": "common",
"hidden": true,
"binaryDir": "${sourceDir}/build",
"generator": "Unix Makefiles",
"cacheVariables": {
"CPM_DISABLE": "$penv{CPM_DISABLE}"
}
},
{
"name": "release",
"inherits": "common",
"environment": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "debug",
"inherits": "common",
"environment": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "coverage",
"inherits": "debug",
"cacheVariables": {
"COVERAGE": true,
"COVERAGE_ERROR": false
}
},
{
"name": "coverage-sonar",
"inherits": "coverage",
"environment": {
"C": "gcc",
"CXX": "g++"
},
"cacheVariables": {
"SONAR": true
}
},
{
"name": "static",
"inherits": "debug",
"cacheVariables": {
"CODECHECKER_REPORT": true
}
}
],
"buildPresets": [
{
"name": "coverage",
"configurePreset": "coverage",
"targets": "coverage"
},
{
"name": "codechecker",
"configurePreset": "static",
"targets": "codechecker"
}
]
}
6 changes: 3 additions & 3 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
set(CPM_DOWNLOAD_VERSION 0.32.2)
set(CPM_DOWNLOAD_VERSION 0.36.0)

if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
Expand Down
14 changes: 14 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, cmake-utils
, git
, texlive
, pugixml
}:

with pkgs;
Expand All @@ -24,6 +25,19 @@ stdenv.mkDerivation {
})
];

buildInputs = [
cli11
(pugixml.override { shared = true; })
];

cmakeFlags = [
"-DCPM_DISABLE=ON"
];

shellHook = ''
export CPM_DISABLE=ON
'';

meta = {
homepage = "https://github.com/Open-RFlab/openemsh";
description = "OpenEMS mesher draft";
Expand Down
43 changes: 43 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ target_sources( openemsh
"${CMAKE_CURRENT_SOURCE_DIR}/domain/conflicts/conflict_too_close_meshline_policies.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/conflicts/i_conflict_origin.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/mesh/i_meshline_origin.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/mesh/interval.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/mesh/meshline.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/mesh/meshline_policy.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/meshline_policy_manager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/conflict_manager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/board.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/infra/parsers/csxcad_layer/point_3d.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/infra/parsers/parser_from_csx.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/infra/serializers/serializer_to_csx.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/infra/serializers/serializer_to_plantuml.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/infra/serializers/serializer_to_prettyprint.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/infra/utils/to_string.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/cli.cpp"
)

target_compile_definitions( openemsh
Expand All @@ -48,6 +56,41 @@ target_include_directories( openemsh
${CMAKE_CURRENT_SOURCE_DIR}
)

target_link_libraries( openemsh
CLI11::CLI11
pugixml::shared
)

add_executable( openemsh_bin )

target_sources( openemsh_bin
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
)

target_compile_features( openemsh_bin
PRIVATE
cxx_std_17
)

target_compile_options( openemsh_bin
PRIVATE
$<$<CONFIG:Coverage>:-O0>
$<$<OR:$<CONFIG:Coverage>,$<CONFIG:Debug>>:-Wall>
$<$<OR:$<CONFIG:Coverage>,$<CONFIG:Debug>>:-Wextra>
# $<$<OR:$<CONFIG:Coverage>,$<CONFIG:Debug>>:-Weffc++>
$<$<OR:$<CONFIG:Coverage>,$<CONFIG:Debug>>:-fexceptions>
)

target_include_directories( openemsh_bin
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)

target_link_libraries( openemsh_bin
openemsh
)

#[[
install(
TARGETS openemsh
Expand Down
Loading
Loading