Skip to content

Commit

Permalink
Saner line length/wrapping for cmake-format, applied across system
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed Feb 11, 2021
1 parent 2101734 commit fe37948
Show file tree
Hide file tree
Showing 26 changed files with 1,186 additions and 1,696 deletions.
14 changes: 5 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ target_link_libraries(project_options INTERFACE Threads::Threads)
include(cmake/Sanitizers.cmake)
enable_sanitizers(project_options)



include(cmake/Version.cmake)

set(OPENGL_REQUIRED
Expand Down Expand Up @@ -208,7 +206,6 @@ include(cmake/CompilerFlags.cmake)

add_subdirectory(third_party)


target_include_directories(project_options INTERFACE ${PROJECT_SOURCE_DIR}/src)
target_include_directories(project_options INTERFACE ${PROJECT_SOURCE_DIR}/third_party)
target_include_directories(project_options INTERFACE ${PROJECT_SOURCE_DIR}/third_party/btwxt/src)
Expand Down Expand Up @@ -237,19 +234,18 @@ target_include_directories(project_options INTERFACE ${PROJECT_SOURCE_DIR}/third
target_include_directories(project_options INTERFACE "${kiva_BINARY_DIR}/src/libkiva")
target_include_directories(project_options SYSTEM INTERFACE "${kiva_SOURCE_DIR}/vendor/boost-1.61.0/")


add_subdirectory(scripts/dev/generate_embeddable_epJSON_schema)
set_target_properties(generate_embeddedable_epJSON_schema PROPERTIES FOLDER "Internal")

if( OPENGL_FOUND )
set(BUILD_PENUMBRA_TESTING OFF CACHE BOOL "")
if(OPENGL_FOUND)
set(BUILD_PENUMBRA_TESTING
OFF
CACHE BOOL "")
endif()

# E+ required libraries
add_subdirectory(idd)



execute_process(
COMMAND ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/scripts/dev/generate_epJSON_schema/generate_epJSON_schema.py" "${PROJECT_SOURCE_DIR}"
TIMEOUT 30
Expand Down Expand Up @@ -298,7 +294,7 @@ if(BUILD_TESTING)

set_target_properties(btwxt_tests PROPERTIES FOLDER ThirdParty/Btwxt)
set_target_properties(kiva_tests PROPERTIES FOLDER ThirdParty/Kiva)
if( OPENGL_FOUND AND BUILD_PENUMBRA_TESTING)
if(OPENGL_FOUND AND BUILD_PENUMBRA_TESTING)
set_target_properties(penumbra_tests PROPERTIES FOLDER ThirdParty/Penumbra)
endif()
endif()
Expand Down
11 changes: 3 additions & 8 deletions cmake/CMakeAddFortranSubdirectory.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ include(CMakeParseArguments)

function(_setup_mingw_config_and_build source_dir build_dir)
# Look for a MinGW gfortran.
find_program(
MINGW_GFORTRAN
NAMES gfortran
PATHS c:/MinGW/bin "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin")
find_program(MINGW_GFORTRAN NAMES gfortran
PATHS c:/MinGW/bin "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin")
if(NOT MINGW_GFORTRAN)
message(FATAL_ERROR "gfortran not found, please install MinGW with the gfortran option."
"Or set the cache variable MINGW_GFORTRAN to the full path. " " This is required to build")
Expand Down Expand Up @@ -149,10 +147,7 @@ function(cmake_add_fortran_subdirectory subdir)
# create imported targets for all libraries
foreach(lib ${libraries})
add_library(${lib} SHARED IMPORTED GLOBAL)
set_property(
TARGET ${lib}
APPEND
PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(${lib} PROPERTIES IMPORTED_IMPLIB_NOCONFIG "${library_dir}/lib${lib}.lib" IMPORTED_LOCATION_NOCONFIG
"${binary_dir}/lib${lib}.dll")
add_dependencies(${lib} ${project_name}_build)
Expand Down
48 changes: 30 additions & 18 deletions cmake/CMakeCPackOptions.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,38 @@ if(CPACK_GENERATOR MATCHES "NSIS")
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGING_INSTALL_PREFIX}")
set(CPACK_NSIS_INSTALL_ROOT "C:")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGING_INSTALL_PREFIX}")
set(CPACK_NSIS_DEFINES "
set(CPACK_NSIS_DEFINES
"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER \"${CPACK_PACKAGING_INSTALL_PREFIX} Programs\"
!include \"LogicLib.nsh\"
!include \"x64.nsh\"
")
set(CPACK_PACKAGING_INSTALL_PREFIX "")

set(CPACK_NSIS_MENU_LINKS
"Documentation/index.html" "EnergyPlus Documentation"
"PostProcess/EP-Compare/EP-Compare.exe" "EP-Compare"
"PreProcess/EPDraw/EPDrawGUI.exe" "EPDrawGUI"
"EP-Launch.exe" "EP-Launch"
"ExampleFiles/ExampleFiles.html" "Example Files Summary"
"ExampleFiles/ExampleFiles-ObjectsLink.html" "ExampleFiles Link to Objects"
"PreProcess/IDFEditor/IDFEditor.exe" "IDFEditor"
"PreProcess/IDFVersionUpdater/IDFVersionUpdater.exe" "IDFVersionUpdater"
"readme.html" "Readme Notes"
"PreProcess/WeatherConverter/Weather.exe" "Weather Statistics and Conversions"
)

set(CPACK_NSIS_PAGE_COMPONENTS "
"Documentation/index.html"
"EnergyPlus Documentation"
"PostProcess/EP-Compare/EP-Compare.exe"
"EP-Compare"
"PreProcess/EPDraw/EPDrawGUI.exe"
"EPDrawGUI"
"EP-Launch.exe"
"EP-Launch"
"ExampleFiles/ExampleFiles.html"
"Example Files Summary"
"ExampleFiles/ExampleFiles-ObjectsLink.html"
"ExampleFiles Link to Objects"
"PreProcess/IDFEditor/IDFEditor.exe"
"IDFEditor"
"PreProcess/IDFVersionUpdater/IDFVersionUpdater.exe"
"IDFVersionUpdater"
"readme.html"
"Readme Notes"
"PreProcess/WeatherConverter/Weather.exe"
"Weather Statistics and Conversions")

set(CPACK_NSIS_PAGE_COMPONENTS
"
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME \"$INSTDIR\\readme.html\"
Expand Down Expand Up @@ -64,7 +75,8 @@ if(CPACK_GENERATOR MATCHES "NSIS")
FunctionEnd
")

set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
"
WriteRegStr HKEY_CURRENT_USER \"Software\\VB and VBA Program Settings\\EP-Launch\\UpdateCheck\" \"AutoCheck\" \"True\"
WriteRegStr HKEY_CURRENT_USER \"Software\\VB and VBA Program Settings\\EP-Launch\\UpdateCheck\" \"CheckURL\" \"http://nrel.github.io/EnergyPlus/epupdate.htm\"
StrCpy $0 \"#@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@-@CPACK_PACKAGE_VERSION_BUILD@\"
Expand Down Expand Up @@ -164,7 +176,8 @@ if(CPACK_GENERATOR MATCHES "NSIS")
\${EndIf}
RMDir /r $INSTDIR\\temp
")
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
"
MessageBox MB_YESNO|MB_ICONEXCLAMATION \"The installer copied the following files to the system directory during installation:$\\r$\\n$\\r$\\nMSCOMCTL.OCX$\\r$\\nComDlg32.OCX$\\r$\\nMsvcrtd.dll$\\r$\\nDforrt.dll$\\r$\\nGswdll32.dll$\\r$\\nGsw32.exe$\\r$\\nGraph32.ocx$\\r$\\nMSINET.OCX$\\r$\\nVsflex7L.ocx$\\r$\\nMsflxgrd.ocx$\\r$\\n$\\r$\\nThese files may be in use by other programs. Click Yes to remove these files. If you are unsure, click No.\" IDYES true IDNO false
true:
\${If} \${RunningX64}
Expand Down Expand Up @@ -211,8 +224,7 @@ endif()

if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
set(CPACK_PACKAGE_RELOCATABLE false)
set( CPACK_PACKAGE_VENDOR "usdoe" )
set(CPACK_PACKAGE_VENDOR "usdoe")
configure_file(@CMAKE_SOURCE_DIR@/cmake/CPack.Info.plist.in.in "@CMAKE_BINARY_DIR@/Modules/CPack.Info.plist.in")
set(CPACK_RESOURCE_FILE_README "@CMAKE_SOURCE_DIR@/release/readme.html")
endif()

56 changes: 32 additions & 24 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ if(MSVC AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) # Visual C++ (VS
# 4355 Passing this pointer in class initializer (object is incomplete so bases/members can only use this in limited ways)
# 4996 Deprecated functions (/D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS)
# 4503 The decorated name was longer than the compiler limit (4096), and was truncated.
target_compile_options(project_warnings INTERFACE
/wd4068
/wd4101
/wd4102
/wd4244
/wd4258
/wd4267
/wd4355
/wd4996
/wd4503) # Disables warning messages listed above
target_compile_options(
project_warnings
INTERFACE /wd4068
/wd4101
/wd4102
/wd4244
/wd4258
/wd4267
/wd4355
/wd4996
/wd4503) # Disables warning messages listed above

target_compile_definitions(project_options INTERFACE NOMINMAX) # Avoid build errors due to STL/Windows min-max conflicts
target_compile_definitions(project_options INTERFACE WIN32_LEAN_AND_MEAN) # Excludes rarely used services and headers from compilation
Expand All @@ -59,14 +60,12 @@ if(MSVC AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) # Visual C++ (VS
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/RTCsu>) # Runtime checks
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:/fp:strict>) # Floating point model
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/DMSVC_DEBUG>) # Triggers code in main.cc to catch floating point NaNs
elseif(
CMAKE_COMPILER_IS_GNUCXX
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # g++/Clang
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # g++/Clang

# COMPILER FLAGS
target_compile_options(project_options INTERFACE -pipe) # Faster compiler processing
target_compile_options(project_warnings INTERFACE -Wpedantic) # Turn on warnings about constructs/situations that may be non-portable or outside of the standard
target_compile_options(project_warnings INTERFACE -Wpedantic
)# Turn on warnings about constructs/situations that may be non-portable or outside of the standard
target_compile_options(project_warnings INTERFACE -Wall -Wextra) # Turn on warnings
target_compile_options(project_warnings INTERFACE -Wno-unknown-pragmas)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)
Expand Down Expand Up @@ -115,7 +114,8 @@ elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
target_compile_options(project_options INTERFACE /nologo) # Skip banner text
target_compile_options(project_options INTERFACE /Qcxx-features) # Enables standard C++ features without disabling Microsoft extensions
target_compile_options(project_options INTERFACE /Wall) # Enable all warnings
target_compile_options(project_options INTERFACE /Qdiag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075) # Disable warnings listed above

target_compile_options(project_options INTERFACE /Qdiag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075)
target_compile_definitions(project_options INTERFACE /DNOMINMAX) # Avoid build errors due to STL/Windows min-max conflicts
target_compile_definitions(project_options INTERFACE /DWIN32_LEAN_AND_MEAN) # Excludes rarely used services and headers from compilation

Expand All @@ -135,12 +135,17 @@ elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")

# ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:/fp:source>) # Use source-specified floating point precision

target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/Qtrapuv>) # Initialize local variables to unusual values to help detect use uninitialized
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/check:stack,uninit)# Enables runtime checking of the stack (buffer over and underruns; pointer verification>) and uninitialized variables

# Initialize local variables to unusual values to help detect use uninitialized
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/Qtrapuv>)

# Enables runtime checking of the stack (buffer over and underruns; pointer verification>) and uninitialized variables
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/check:stack,uninit)
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/Gs0>) # Enable stack checking for all functions
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/GS>) # Buffer overrun detection
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:/Qfp-stack-check>)# Tells the compiler to generate extra code after every function call to ensure fp stack is as expected

# Tells the compiler to generate extra code after every function call to ensure fp stack is as expected
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:/Qfp-stack-check>)
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:/traceback>) # Enables traceback on error

elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
Expand All @@ -160,7 +165,7 @@ elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")

# COMPILER FLAGS
target_compile_options(project_warnings INTERFACE -Wall) # Enable all warnings
target_compile_options(project_warnings INTERFACE -diag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075) # Disable warnings listed above
target_compile_options(project_warnings INTERFACE -diag-disable:161,177,488,809,869,1786,2259,3280,10382,11074,11075)# Disable warnings listed above

# Optimization options that had no significant benefit for EnergyPlus
# -ipo instead of -ip
Expand All @@ -177,10 +182,13 @@ elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
target_compile_options(project_options INTERFACE $<$<CONFIG:Release>:-inline-factor=225>) # Enables more aggressive inlining

# ADDITIONAL DEBUG-MODE-SPECIFIC FLAGS
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-strict-ansi>) # Strict language conformance: Performance impact so limit to debug build
# Strict language conformance: Performance impact so limit to debug build
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-strict-ansi>)
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:-fp-model source>) # Use source-specified floating point precision
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-ftrapuv>) # Initialize local variables to unusual values to help detect use uninitialized
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-check=stack,uninit)# Enables runtime checking of the stack (buffer over and underruns; pointer verification>) and uninitialized variables
# Initialize local variables to unusual values to help detect use uninitialized
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-ftrapuv>)
# Enables runtime checking of the stack (buffer over and underruns; pointer verification>) and uninitialized variables
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-check=stack,uninit)
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-fstack-security-check>) # Buffer overrun detection
target_compile_options(project_fp_options INTERFACE $<$<CONFIG:Debug>:-fp-stack-check>) # Check the floating point stack after every function call
target_compile_options(project_options INTERFACE $<$<CONFIG:Debug>:-traceback>) # Enables traceback on error
Expand Down
2 changes: 0 additions & 2 deletions cmake/Fortran.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

add_library(fortran_project_options INTERFACE)
set(FORTRAN_STATIC_EXE FALSE)
set(FORTRAN_SKIP_RPATH FALSE)
Expand Down Expand Up @@ -39,4 +38,3 @@ else() # Windows
endif()
endif()
target_compile_options(fortran_project_options INTERFACE -ffree-line-length-275)

Loading

4 comments on commit fe37948

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-MacOS-10.15-clang-11.0.0: OK (3009 of 3009 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3049 of 3049 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1573 of 1573 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_modernize (lefticus) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (722 of 722 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.