Skip to content

LBNL-ETA/OpticalMeasurementParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

246 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpticalMeasurementParser

A C++20 library for parsing optical measurement files for glazing layers used in LBNL window calculation tools. Parses both legacy IGDB text format and JSON measurements (IGSDB-style). Built on top of BSDFXMLParser and nlohmann_json.

Requirements

  • C++20 compatible compiler (g++ 11+, clang++ 14+, MSVC 19.30+)
  • CMake 3.8+ (3.21+ if you want to use the shipped CMake presets)
  • BSDFXMLParser (fetched automatically)
  • nlohmann_json (fetched automatically)

Consuming OpticalMeasurementParser

Using FetchContent in CMake (recommended)

include(FetchContent)
FetchContent_Declare(
    OpticalMeasurementParser
    GIT_REPOSITORY https://github.com/LBNL-ETA/OpticalMeasurementParser.git
    GIT_TAG v2.3.9
)
FetchContent_MakeAvailable(OpticalMeasurementParser)

target_link_libraries(MyTarget PRIVATE OpticalMeasurementParser)

Update GIT_TAG to the desired release tag.

Building (developers)

Dependencies are downloaded automatically via CMake FetchContent on first configure. Tests build by default when OpticalMeasurementParser is the top-level project (-DBUILD_Optical_Measurement_Parser_Tests=OFF to disable).

On MSVC, /MP (multi-processor compilation) is enabled automatically so the library, tests, and dependencies compile in parallel. On GCC/Clang, pass --parallel to cmake --build.

Presets

CMakePresets.json ships four visible configure presets, plus two hidden inheritance bases:

Preset When to use it
default-debug / default-release Standard configure on any platform; CI and releases. Always fetches every dependency from its declared remote — never touches local disk. Picks the system default compiler (MSVC on Windows, system cc/c++ on Linux/macOS).
local-debug / local-release Development mode: build against sibling working copies on disk when present (see below).

Examples:

cmake --preset default-release
cmake --build build/default-release --parallel
ctest --test-dir build/default-release -C Release --output-on-failure

Local development mode (local-*)

The local preset sets a single cache flag, LBNL_LOCAL_SIBLINGS=ON. When it is on, each repo's CMakeLists prefers a sibling working copy of its direct dependencies — e.g. ../BSDFXMLParser, ../json, ../googletest next to ../OpticalMeasurementParser — over fetching them:

Direct dependency Expected sibling path
BSDFXMLParser ../BSDFXMLParser
nlohmann_json ../json
googletest ../googletest

Key properties:

  • default never uses local repos. The flag is off, so default-* builds are always pure-remote and reproducible — use them for CI and releases. (Build dirs differ per preset, so a prior local configure can't leak into a default one.)
  • Per-dependency fallback. A sibling that isn't checked out falls back to its declared remote independently, so local-* is safe to run with any subset of siblings present.
  • It propagates. LBNL_LOCAL_SIBLINGS is a cache variable, so it cascades into dependency sub-builds. A sibling dependency that also honors the flag wires up its own direct deps in turn — so the whole graph resolves from disk (e.g. a local BSDFXMLParser pulls a local FileParse, which pulls a local xmlParser). Each repo only ever names its own direct deps; it never needs to know another repo's internals.
  • Develop, then release. Local builds intentionally use your working copies, which may differ from the pinned GIT_TAGs. Get the graph green locally, then bump each repo's pinned version and release one at a time.

Per-machine compiler presets (CMakeUserPresets.json)

To use a specific compiler (vs2022-release, gcc-13-debug, clang-18-release, etc.), each developer maintains their own CMakeUserPresets.json next to CMakePresets.json. It is gitignored, read automatically by CMake (and CLion, VS Code, etc.), and stays on the developer's machine.

Personal presets inherit from one of the shipped presets (usually local, which gives you sibling-repo overrides for free) and override whatever they want. A complete realistic example -- building with WSL Clang on a Windows machine, with CLion 2023.2+ routed through the WSL toolchain automatically:

{
    "version": 6,
    "configurePresets": [
        {
            "name": "clang-release",
            "displayName": "clang (Release)",
            "inherits": "local",
            "generator": "Ninja",
            "binaryDir": "${sourceDir}/build/clang-release",
            "cacheVariables": {
                "CMAKE_C_COMPILER":   "clang",
                "CMAKE_CXX_COMPILER": "clang++",
                "CMAKE_BUILD_TYPE":   "Release"
            },
            "vendor": {
                "jetbrains.com/clion": {
                    "toolchain": "WSL"
                }
            }
        }
    ]
}

Manual configure (without presets)

cmake -B build
cmake --build build --config Release --parallel
ctest --test-dir build -C Release --output-on-failure

Clean rebuild

Delete the build/ directory and re-run the configure and build commands above.

License

See the LICENSE file.

Berkeley Lab WINDOW Calc Engine (CalcEngine) Copyright (c) 2016 - 2019, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Innovation & Partnerships Office at IPO@lbl.gov.

NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit other to do so.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors