forked from mpusz/mp-units
build: got rid of global options for references
and literals
This commit is contained in:
@@ -41,14 +41,10 @@ class UnitsConan(ConanFile):
|
|||||||
"gsl-lite/0.37.0"
|
"gsl-lite/0.37.0"
|
||||||
)
|
)
|
||||||
options = {
|
options = {
|
||||||
"references": [True, False],
|
|
||||||
"literals": [True, False],
|
|
||||||
"downcast_mode": ["off", "on", "auto"],
|
"downcast_mode": ["off", "on", "auto"],
|
||||||
"build_docs": [True, False]
|
"build_docs": [True, False]
|
||||||
}
|
}
|
||||||
default_options = {
|
default_options = {
|
||||||
"references": True,
|
|
||||||
"literals": False,
|
|
||||||
"downcast_mode": "on",
|
"downcast_mode": "on",
|
||||||
"build_docs": True
|
"build_docs": True
|
||||||
}
|
}
|
||||||
@@ -120,8 +116,6 @@ class UnitsConan(ConanFile):
|
|||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
tc = CMakeToolchain(self)
|
tc = CMakeToolchain(self)
|
||||||
tc.variables["UNITS_REFERENCES"] = self.options.references
|
|
||||||
tc.variables["UNITS_LITERALS"] = self.options.literals
|
|
||||||
tc.variables["UNITS_DOWNCAST_MODE"] = str(self.options.downcast_mode).upper()
|
tc.variables["UNITS_DOWNCAST_MODE"] = str(self.options.downcast_mode).upper()
|
||||||
# if self._run_tests: # TODO Enable this when environment is supported in the Conan toolchain
|
# if self._run_tests: # TODO Enable this when environment is supported in the Conan toolchain
|
||||||
tc.variables["UNITS_BUILD_DOCS"] = self.options.build_docs
|
tc.variables["UNITS_BUILD_DOCS"] = self.options.build_docs
|
||||||
|
@@ -123,24 +123,6 @@ It also runs unit tests during Conan build.
|
|||||||
Conan Options
|
Conan Options
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
references
|
|
||||||
++++++++++
|
|
||||||
|
|
||||||
**Values**: ``True``/``False``
|
|
||||||
|
|
||||||
**Defaulted to**: ``True``
|
|
||||||
|
|
||||||
Determines if library should provide Quantity References for quantities of various units.
|
|
||||||
|
|
||||||
literals
|
|
||||||
++++++++
|
|
||||||
|
|
||||||
**Values**: ``True``/``False``
|
|
||||||
|
|
||||||
**Defaulted to**: ``False``
|
|
||||||
|
|
||||||
Determines if library should provide User Defined Literals (UDLs) for quantities of various units.
|
|
||||||
|
|
||||||
downcast_mode
|
downcast_mode
|
||||||
+++++++++++++
|
+++++++++++++
|
||||||
|
|
||||||
@@ -167,26 +149,6 @@ Additionally, enables project documentation generation when the project is being
|
|||||||
CMake Options
|
CMake Options
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
UNITS_REFERENCES
|
|
||||||
++++++++++++++++
|
|
||||||
|
|
||||||
**Values**: ``ON``/``OFF``
|
|
||||||
|
|
||||||
**Defaulted to**: ``ON``
|
|
||||||
|
|
||||||
Equivalent to `references`_.
|
|
||||||
|
|
||||||
|
|
||||||
UNITS_LITERALS
|
|
||||||
++++++++++++++
|
|
||||||
|
|
||||||
**Values**: ``ON``/``OFF``
|
|
||||||
|
|
||||||
**Defaulted to**: ``OFF``
|
|
||||||
|
|
||||||
Equivalent to `literals`_.
|
|
||||||
|
|
||||||
|
|
||||||
UNITS_DOWNCAST_MODE
|
UNITS_DOWNCAST_MODE
|
||||||
+++++++++++++++++++
|
+++++++++++++++++++
|
||||||
|
|
||||||
|
@@ -27,12 +27,7 @@ project(mp-units
|
|||||||
)
|
)
|
||||||
|
|
||||||
option(UNITS_AS_SYSTEM_HEADERS "Exports library as system headers" OFF)
|
option(UNITS_AS_SYSTEM_HEADERS "Exports library as system headers" OFF)
|
||||||
option(UNITS_REFERENCES "Enables definitions of Quantity References provided for quantities of various units" ON)
|
|
||||||
option(UNITS_LITERALS "Enables definitions of User Defined Literals (UDLs) provided for quantities of various units" OFF)
|
|
||||||
|
|
||||||
message(STATUS "UNITS_AS_SYSTEM_HEADERS: ${UNITS_AS_SYSTEM_HEADERS}")
|
message(STATUS "UNITS_AS_SYSTEM_HEADERS: ${UNITS_AS_SYSTEM_HEADERS}")
|
||||||
message(STATUS "UNITS_REFERENCES: ${UNITS_REFERENCES}")
|
|
||||||
message(STATUS "UNITS_LITERALS: ${UNITS_LITERALS}")
|
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
@@ -38,15 +38,3 @@ function(add_units_module name)
|
|||||||
install(TARGETS mp-units-${name} EXPORT mp-unitsTargets)
|
install(TARGETS mp-units-${name} EXPORT mp-unitsTargets)
|
||||||
install(DIRECTORY include/units TYPE INCLUDE)
|
install(DIRECTORY include/units TYPE INCLUDE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# add_units_systems(ModuleName <depependencies>...)
|
|
||||||
#
|
|
||||||
function(add_units_system name)
|
|
||||||
add_units_module(${name} ${ARGN})
|
|
||||||
target_compile_definitions(mp-units-${name} INTERFACE
|
|
||||||
$<$<BOOL:${UNITS_REFERENCES}>:UNITS_REFERENCES>
|
|
||||||
$<$<BOOL:${UNITS_LITERALS}>:UNITS_LITERALS>
|
|
||||||
)
|
|
||||||
endfunction()
|
|
||||||
|
@@ -55,11 +55,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(mp-units-core INTERFACE
|
|
||||||
$<$<BOOL:${UNITS_REFERENCES}>:UNITS_REFERENCES>
|
|
||||||
$<$<BOOL:${UNITS_LITERALS}>:UNITS_LITERALS>
|
|
||||||
)
|
|
||||||
|
|
||||||
if(DEFINED UNITS_DOWNCAST_MODE)
|
if(DEFINED UNITS_DOWNCAST_MODE)
|
||||||
set(downcast_mode_options OFF ON AUTO)
|
set(downcast_mode_options OFF ON AUTO)
|
||||||
list(FIND downcast_mode_options "${UNITS_DOWNCAST_MODE}" downcast_mode)
|
list(FIND downcast_mode_options "${UNITS_DOWNCAST_MODE}" downcast_mode)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(isq-iec80000 mp-units::si)
|
add_units_module(isq-iec80000 mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(isq-natural mp-units::isq)
|
add_units_module(isq-natural mp-units::isq)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si-cgs mp-units::si)
|
add_units_module(si-cgs mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si-fps mp-units::si)
|
add_units_module(si-fps mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si-iau mp-units::si)
|
add_units_module(si-iau mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si-imperial mp-units::si)
|
add_units_module(si-imperial mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si-international mp-units::si)
|
add_units_module(si-international mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si-typographic mp-units::si)
|
add_units_module(si-typographic mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si-us mp-units::si)
|
add_units_module(si-us mp-units::si)
|
||||||
|
@@ -22,4 +22,4 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
add_units_system(si mp-units::isq)
|
add_units_module(si mp-units::isq)
|
||||||
|
Reference in New Issue
Block a user