Skip to content

Commit

Permalink
refactor: core-fmt and core-ostream modules merged with core
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Dec 29, 2023
1 parent 8f55e13 commit af47898
Show file tree
Hide file tree
Showing 28 changed files with 80 additions and 198 deletions.
2 changes: 1 addition & 1 deletion example/clcpp_response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with this program. If not, see http://www.gnu.org/licenses./
*/

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <iostream>
#ifdef MP_UNITS_MODULES
import mp_units;
Expand Down
2 changes: 1 addition & 1 deletion example/conversion_factor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with this program. If not, see http://www.gnu.org/licenses./
*/

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <iostream>
#include <type_traits>
#ifdef MP_UNITS_MODULES
Expand Down
2 changes: 1 addition & 1 deletion example/currency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <iostream>
#include <map>
#ifdef MP_UNITS_MODULES
import mp_units.core_io;
import mp_units.core;
#else
#include <mp-units/ostream.h>
#include <mp-units/quantity.h>
Expand Down
2 changes: 1 addition & 1 deletion example/foot_pound_second.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <iostream>
#include <string_view>
#ifdef MP_UNITS_MODULES
Expand Down
2 changes: 1 addition & 1 deletion example/glide_computer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// SOFTWARE.

#include "glide_computer_lib.h"
#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <array>
#include <exception>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion example/hello_units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// !!! renders correctly in the documentation "Examples" section. !!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <iostream>
#ifdef MP_UNITS_MODULES
import mp_units;
Expand Down
2 changes: 1 addition & 1 deletion example/include/geographic.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#pragma once

#include "ranged_representation.h"
#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <compare>
#include <limits>
#include <numbers>
Expand Down
2 changes: 1 addition & 1 deletion example/include/validated_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#pragma once

#include <gsl/gsl-lite.hpp>
#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <ostream>
#include <utility>
#ifdef MP_UNITS_MODULES
Expand Down
2 changes: 1 addition & 1 deletion example/kalman_filter/kalman.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#pragma once

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <tuple>
#ifdef MP_UNITS_MODULES
import mp_units;
Expand Down
2 changes: 1 addition & 1 deletion example/si_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// !!! renders correctly in the documentation "Examples" section. !!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <iostream>
#ifdef MP_UNITS_MODULES
import mp_units;
Expand Down
2 changes: 1 addition & 1 deletion example/spectroscopy_units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <iostream>
#include <tuple>
#ifdef MP_UNITS_MODULES
Expand Down
1 change: 0 additions & 1 deletion example/storage_tank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <cassert>
#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion example/unmanned_aerial_vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// SOFTWARE.

#include "geographic.h"
#include <mp-units/compat_fmt_macros.h>
#include <mp-units/compat_macros.h>
#include <cassert>
#include <iostream>
#ifdef MP_UNITS_MODULES
Expand Down
4 changes: 1 addition & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ if(${projectPrefix}AS_SYSTEM_HEADERS)
endif()

add_subdirectory(core)
add_subdirectory(core-fmt)
add_subdirectory(core-io)
add_subdirectory(systems)

# project-wide wrapper
add_units_module(
mp-units DEPENDENCIES mp-units::core mp-units::core-io mp-units::core-fmt mp-units::systems
mp-units DEPENDENCIES mp-units::core mp-units::systems
MODULE_INTERFACE_UNIT mp-units.cpp
)

Expand Down
43 changes: 0 additions & 43 deletions src/core-fmt/CMakeLists.txt

This file was deleted.

79 changes: 0 additions & 79 deletions src/core-fmt/include/mp-units/compat_fmt_macros.h

This file was deleted.

13 changes: 0 additions & 13 deletions src/core-fmt/mp-units-core-fmt.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions src/core-io/CMakeLists.txt

This file was deleted.

13 changes: 0 additions & 13 deletions src/core-io/mp-units-core-io.cpp

This file was deleted.

14 changes: 14 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ add_units_module(
include/mp-units/bits/core_gmf.h
include/mp-units/bits/dimension_concepts.h
include/mp-units/bits/expression_template.h
include/mp-units/bits/fmt.h
include/mp-units/bits/get_associated_quantity.h
include/mp-units/bits/get_common_base.h
include/mp-units/bits/magnitude.h
Expand All @@ -63,7 +64,9 @@ add_units_module(
include/mp-units/core.h
include/mp-units/customization_points.h
include/mp-units/dimension.h
include/mp-units/format.h
include/mp-units/math.h
include/mp-units/ostream.h
include/mp-units/quantity.h
include/mp-units/quantity_point.h
include/mp-units/quantity_spec.h
Expand All @@ -74,6 +77,17 @@ add_units_module(
MODULE_INTERFACE_UNIT mp-units-core.cpp
)

target_compile_definitions(
mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}USE_LIBFMT=$<BOOL:${${projectPrefix}USE_LIBFMT}>
)

if(${projectPrefix}USE_LIBFMT)
if(NOT TARGET fmt::fmt)
find_package(fmt CONFIG REQUIRED)
endif()
target_link_libraries(mp-units-core ${${projectPrefix}TARGET_SCOPE} fmt::fmt)
endif()

if(${projectPrefix}BUILD_CXX_MODULES)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
Expand Down
Loading

0 comments on commit af47898

Please sign in to comment.