NREL / EnergyPlus

EnergyPlus™ is a whole building energy simulation program that engineers, architects, and researchers use to model both energy consumption and water use in buildings.
https://energyplus.net
Other
1.1k stars 384 forks source link

C API header files are not installed #10072

Closed stal12 closed 1 year ago

stal12 commented 1 year ago

Issue overview

When the C library is installed, the API header files are not copied in the installation directory. Therefore clients linking against energyplus miss fundamental include files to use the library.

The relevant code is in src/EnergyPlus/CMakeLists.txt:

if(NOT BUILD_STATIC_ENERGYPLUS_API)
  install(
    TARGETS energyplusapi energyplus
    EXPORT energyplus
    RUNTIME DESTINATION ./
    LIBRARY DESTINATION ./
    ARCHIVE DESTINATION ./
    INCLUDES DESTINATION include
                         include/EnergyPlus/api
  )

  include(CMakePackageConfigHelpers)
  write_basic_package_version_file(
    "${PROJECT_BINARY_DIR}/energyplusConfigVersion.cmake"
    VERSION ${ENERGYPLUS_VERSION}
    COMPATIBILITY AnyNewerVersion
  )

  export(
    EXPORT
    energyplus
         NAMESPACE "energyplus::"
         FILE "${PROJECT_BINARY_DIR}/energyplusConfig.cmake"
  )

  install(
    EXPORT energyplus
          DESTINATION lib/cmake/energyplus
          NAMESPACE "energyplus::"
          COMPONENT "CPPAPI"
    FILE energyplusConfig.cmake
  )

  install(
    FILES
      "${PROJECT_BINARY_DIR}/energyplusConfigVersion.cmake"
    DESTINATION
      lib/cmake/energyplus/
    COMPONENT "CPPAPI"
  )
endif()

This installs the library and the cmake configuration file used to import it from other projects, but it doesn't copy the API header files.

Details

Some additional details for this issue (if relevant):

Checklist

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

jmarrec commented 1 year ago

Works as expected when -DBUILD_PACKAGE:BOOL=ON is passed to cmake.cf https://github.com/NREL/EnergyPlus/pull/10073#issuecomment-1595749268

Closing. The clear issue report and following PR is much appreciated though @stal12, thanks!