From 87ded6809807f45d60610ab48e941b540ca730d7 Mon Sep 17 00:00:00 2001 From: dguittet Date: Fri, 10 Apr 2020 12:17:33 -0600 Subject: [PATCH 01/21] refactor cmakelists --- CMakeLists.txt | 319 ++----------------------------------------- src/CMakeLists.txt | 193 ++++++++++++++++++++++++++ tools/CMakeLists.txt | 140 +++++++++++++++++++ 3 files changed, 348 insertions(+), 304 deletions(-) create mode 100644 src/CMakeLists.txt create mode 100644 tools/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cff6e19..f9b95fd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,13 @@ cmake_minimum_required(VERSION 3.11) +option(skip_tools "Skips the wex sandbox and Dview builds" OFF) + +# +# If project isn't system_advisor_model and skip_tools=1, +# environment vars LK_LIB and LKD_LIB can be used to specify where to find those libraries +# + if (APPLE) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version") endif () @@ -15,173 +22,13 @@ if (UNIX AND NOT CMAKE_C_COMPILER) set(CMAKE_CXX_COMPILER g++) endif () - -##################################################################################################################### -# -# Project Settings -# -##################################################################################################################### - -Project(wex C CXX) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) if (NOT APPLE) set(CURL_DIR build_resources/libcurl_ssl_x64) endif () -set(WEX_SRC - src/clipper/clipper.cpp - src/codeedit.cpp - src/csv.cpp - src/dclatex.cpp - src/dview/dvautocolourassigner.cpp - src/dview/dvdcctrl.cpp - src/dview/dvdmapctrl.cpp - src/dview/dvfilereader.cpp - src/dview/dvplotctrl.cpp - src/dview/dvplotctrlsettings.cpp - src/dview/dvplothelper.cpp - src/dview/dvpncdfctrl.cpp - src/dview/dvprofilectrl.cpp - src/dview/dvscatterplotctrl.cpp - src/dview/dvselectionlist.cpp - src/dview/dvstatisticstablectrl.cpp - src/dview/dvtimeseriesctrl.cpp - src/dview/dvtimeseriesdataset.cpp - src/easycurl.cpp - src/extgrid.cpp - src/exttext.cpp - src/exttextstream.cpp - src/exttree.cpp - src/gleasy.cpp - src/jsonreader.cpp - src/jsonval.cpp - src/jsonwriter.cpp - src/label.cpp - src/lkscript.cpp - src/metro.cpp - src/mswfatal.cpp - src/pagelayout.cpp - src/pageobjects.cpp - src/plot/mplcontour.cpp - src/plot/plannotation.cpp - src/plot/plcontourplot.cpp - src/plot/ploutdev.cpp - src/plot/plplot.cpp - src/plot/plsectorplot.cpp - src/plot/pltext.cpp - src/plot/plwindrose.cpp - src/radiochoice.cpp - src/diurnal.cpp - src/numeric.cpp - src/pdf/pdfannotation.cpp - src/pdf/pdfbarcode.cpp - src/pdf/pdfcffdecoder.cpp - src/pdf/pdfcffindex.cpp - src/pdf/pdfcolour.cpp - src/pdf/pdfdc.cpp - src/pdf/pdfdecode.cpp - src/pdf/pdfdocument.cpp - src/pdf/pdfencoding.cpp - src/pdf/pdfencrypt.cpp - src/pdf/pdffont.cpp - src/pdf/pdffontdata.cpp - src/pdf/pdffontdatacore.cpp - src/pdf/pdffontdataopentype.cpp - src/pdf/pdffontdatatruetype.cpp - src/pdf/pdffontdatatype0.cpp - src/pdf/pdffontdatatype1.cpp - src/pdf/pdffontdescription.cpp - src/pdf/pdffontdetails.cpp - src/pdf/pdffontextended.cpp - src/pdf/pdffontmanager.cpp - src/pdf/pdffontparser.cpp - src/pdf/pdffontparsertruetype.cpp - src/pdf/pdffontparsertype1.cpp - src/pdf/pdffontsubsetcff.cpp - src/pdf/pdffontsubsettruetype.cpp - src/pdf/pdffontvolt.cpp - src/pdf/pdfform.cpp - src/pdf/pdfgradient.cpp - src/pdf/pdfgraphics.cpp - src/pdf/pdfimage.cpp - src/pdf/pdfkernel.cpp - src/pdf/pdflayer.cpp - src/pdf/pdfobjects.cpp - src/pdf/pdfocg.cpp - src/pdf/pdfparser.cpp - src/pdf/pdfpattern.cpp - src/pdf/pdfprint.cpp - src/pdf/pdfrijndael.cpp - src/pdf/pdftemplate.cpp - src/pdf/pdfutility.cpp - src/pdf/pdfxml.cpp - src/plot/plaxis.cpp - src/plot/plcolourmap.cpp - src/plot/plbarplot.cpp - src/plot/plhistplot.cpp - src/plot/pllineplot.cpp - src/plot/plplotctrl.cpp - src/plot/plscatterplot.cpp - src/registration.cpp - src/snaplay.cpp - src/tpdlg.cpp - src/uiform.cpp - src/utils.cpp - src/freetype/src/base/ftbase.c - src/freetype/src/base/ftbbox.c - src/freetype/src/base/ftbitmap.c - src/freetype/src/base/ftfntfmt.c - src/freetype/src/base/ftgasp.c - src/freetype/src/base/ftglyph.c - src/freetype/src/base/ftinit.c - src/freetype/src/base/ftstroke.c - src/freetype/src/base/ftsynth.c - src/freetype/src/base/ftsystem.c - src/freetype/src/base/fttype1.c - src/freetype/src/cff/cff.c - src/freetype/src/cid/type1cid.c - src/freetype/src/psaux/psaux.c - src/freetype/src/pshinter/pshinter.c - src/freetype/src/psnames/psnames.c - src/freetype/src/raster/raster.c - src/freetype/src/sfnt/sfnt.c - src/freetype/src/smooth/smooth.c - src/freetype/src/truetype/truetype.c - src/freetype/src/type1/type1.c - src/freetype/src/base/ftlcdfil.c - src/plot/qhull/geom.c - src/plot/qhull/geom2.c - src/plot/qhull/global.c - src/plot/qhull/io.c - src/plot/qhull/libqhull.c - src/plot/qhull/mem.c - src/plot/qhull/merge.c - src/plot/qhull/poly.c - src/plot/qhull/poly2.c - src/plot/qhull/qset.c - src/plot/qhull/random.c - src/plot/qhull/rboxlib.c - src/plot/qhull/stat.c - src/plot/qhull/user.c - src/plot/qhull/usermem.c - src/plot/qhull/userprintf.c - src/plot/qhull/userprintf_rbox.c - ) - -if (WIN32) - list(APPEND WEX_SRC - src/ole/activex.cpp - src/ole/excelauto.cpp - src/ole/iehtmlwin.cpp - ) -endif () - -set(DVIEW_SRC - tools/dview/dview.cpp - ../lk/src/sqlite3.c - ) +Project(wex C CXX) ##################################################################################################################### @@ -211,6 +58,8 @@ else () endif () endif () +set(LKDIR $ENV{LKDIR}) + ##################################################################################################################### # @@ -241,149 +90,11 @@ endif () ##################################################################################################################### # -# CMake Targets -# -##################################################################################################################### - -# wex -add_library(wex STATIC ${WEX_SRC}) -set_target_properties(wex - PROPERTIES - DEBUG_POSTFIX "d" - PREFIX "" - ) -if (MSVC) - set_target_properties(wex - PROPERTIES - LINK_FLAGS /SUBSYSTEM:CONSOLE) -endif () - -target_include_directories(wex PRIVATE include src/freetype/include ../lk/include ${CURL_DIR}/include) - -# wexsandbox -add_executable(wexsandbox ${WEX_SRC} tools/sandbox/sandbox.cpp) -set_target_properties(wexsandbox - PROPERTIES - DEBUG_POSTFIX "d" - ) -if (MSVC) - set_target_properties(wexsandbox - PROPERTIES - LINK_FLAGS /SUBSYSTEM:WINDOWS) -endif () - -target_include_directories(wexsandbox SYSTEM PRIVATE include src/freetype/include ../lk/include ${CURL_DIR}/include) - -if (APPLE) - # dview bundle - set(DVIEW_ICON ${CMAKE_CURRENT_SOURCE_DIR}/build_resources/DView.icns) - set_source_files_properties(${DVIEW_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") - set(APPS "\${CMAKE_INSTALL_PREFIX}/DView.app") -elseif (WIN32) - set(DVIEW_ICON ${CMAKE_CURRENT_SOURCE_DIR}/build_resources/dview.rc) - set(APPS "\${CMAKE_INSTALL_PREFIX}/DView.exe") -endif () - -add_executable(DView - WIN32 - MACOSX_BUNDLE - ${DVIEW_SRC} - ${DVIEW_ICON}) - -target_include_directories(DView SYSTEM PRIVATE include src/freetype/include ../lk/include ${CURL_DIR}/include) - -set_target_properties(DView - PROPERTIES - DEBUG_POSTFIX "d" - ) - -##################################################################################################################### -# -# Link Libraries and Options -# -##################################################################################################################### - -# wex -target_link_libraries(wex ${wxWidgets_LIBRARIES}) -if (MSVC) - target_compile_definitions(wex PUBLIC _LIB LK_USE_WXWIDGETS) -endif () -if (${CMAKE_PROJECT_NAME} STREQUAL export_config) - target_compile_definitions(wex PUBLIC _export_config_) -endif () - -# DView -target_link_libraries(DView wex) -if (MSVC) - target_link_libraries(DView Winhttp) -elseif (UNIX AND NOT APPLE) - target_link_libraries(DView ${CMAKE_DL_LIBS} ${FONTCONFIG_LIBRARY}) -endif () - -# wex sandbox -if (${CMAKE_PROJECT_NAME} STREQUAL system_advisor_model) - target_link_libraries(wexsandbox lk) -else () - if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR MSVC) - unset(LKD_LIB CACHE) - find_library(LKD_LIB - NAMES lkd.a lkd.lib - PATHS ../lk/build ../lk/build_msvc/Debug) - target_link_libraries(wexsandbox debug ${LKD_LIB}) - endif () - unset(LK_LIB CACHE) - find_library(LK_LIB - NAMES lk.a lk.lib - PATHS ../lk/build ../lk/build_msvc/Release) - target_link_libraries(wexsandbox optimized ${LK_LIB}) -endif () -target_link_libraries(wexsandbox wex ${wxWidgets_LIBRARIES}) - -if (UNIX) - target_link_libraries(wexsandbox -ldl -lcurl) -elseif (MSVC) - find_library(CURL_LIB - NAMES libcurl.lib - PATHS build_resources/libcurl_ssl_x64/lib) - target_link_libraries(wexsandbox ${CURL_LIB} Winhttp) -endif () - - -##################################################################################################################### -# -# Target Installation +# Project Settings # ##################################################################################################################### -if (APPLE) - install(TARGETS DView DESTINATION .) - install(CODE " - include(BundleUtilities) - set(BU_CHMOD_BUNDLE_ITEMS true) - fixup_bundle(\"${APPS}\" \"\" \"${wxWidgets_LIBRARY_DIRS}\") - ") -endif () - -if (MSVC) - set(LIBCURL_FILES - dbghelp.dll - libcurl.dll - libeay32.dll - libssh2.dll - msvcp140.dll - openssl.exe - ssleay32.dll - vcruntime140.dll - ) - set(WEXSB_DIR ${CMAKE_CURRENT_BINARY_DIR}/$<$:Debug>$<$:Release>) - - foreach (file_i ${LIBCURL_FILES}) - file(TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build_resources/libcurl_ssl_x64/bin/${file_i} LIB_PATH) - add_custom_command( - TARGET wexsandbox - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${LIB_PATH} ${WEXSB_DIR} - ) - endforeach (file_i) -endif () +add_subdirectory(src) +if (NOT skip_tools) + add_subdirectory(tools) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..97d6e798 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,193 @@ +##################################################################################################################### +# +# Project Settings +# +##################################################################################################################### + +if (NOT APPLE) + set(CURL_DIR ../build_resources/libcurl_ssl_x64) +endif () + +set(WEX_SRC + clipper/clipper.cpp + codeedit.cpp + csv.cpp + dclatex.cpp + dview/dvautocolourassigner.cpp + dview/dvdcctrl.cpp + dview/dvdmapctrl.cpp + dview/dvfilereader.cpp + dview/dvplotctrl.cpp + dview/dvplotctrlsettings.cpp + dview/dvplothelper.cpp + dview/dvpncdfctrl.cpp + dview/dvprofilectrl.cpp + dview/dvscatterplotctrl.cpp + dview/dvselectionlist.cpp + dview/dvstatisticstablectrl.cpp + dview/dvtimeseriesctrl.cpp + dview/dvtimeseriesdataset.cpp + easycurl.cpp + extgrid.cpp + exttext.cpp + exttextstream.cpp + exttree.cpp + gleasy.cpp + jsonreader.cpp + jsonval.cpp + jsonwriter.cpp + label.cpp + lkscript.cpp + metro.cpp + mswfatal.cpp + pagelayout.cpp + pageobjects.cpp + plot/mplcontour.cpp + plot/plannotation.cpp + plot/plcontourplot.cpp + plot/ploutdev.cpp + plot/plplot.cpp + plot/plsectorplot.cpp + plot/pltext.cpp + plot/plwindrose.cpp + radiochoice.cpp + diurnal.cpp + numeric.cpp + pdf/pdfannotation.cpp + pdf/pdfbarcode.cpp + pdf/pdfcffdecoder.cpp + pdf/pdfcffindex.cpp + pdf/pdfcolour.cpp + pdf/pdfdc.cpp + pdf/pdfdecode.cpp + pdf/pdfdocument.cpp + pdf/pdfencoding.cpp + pdf/pdfencrypt.cpp + pdf/pdffont.cpp + pdf/pdffontdata.cpp + pdf/pdffontdatacore.cpp + pdf/pdffontdataopentype.cpp + pdf/pdffontdatatruetype.cpp + pdf/pdffontdatatype0.cpp + pdf/pdffontdatatype1.cpp + pdf/pdffontdescription.cpp + pdf/pdffontdetails.cpp + pdf/pdffontextended.cpp + pdf/pdffontmanager.cpp + pdf/pdffontparser.cpp + pdf/pdffontparsertruetype.cpp + pdf/pdffontparsertype1.cpp + pdf/pdffontsubsetcff.cpp + pdf/pdffontsubsettruetype.cpp + pdf/pdffontvolt.cpp + pdf/pdfform.cpp + pdf/pdfgradient.cpp + pdf/pdfgraphics.cpp + pdf/pdfimage.cpp + pdf/pdfkernel.cpp + pdf/pdflayer.cpp + pdf/pdfobjects.cpp + pdf/pdfocg.cpp + pdf/pdfparser.cpp + pdf/pdfpattern.cpp + pdf/pdfprint.cpp + pdf/pdfrijndael.cpp + pdf/pdftemplate.cpp + pdf/pdfutility.cpp + pdf/pdfxml.cpp + plot/plaxis.cpp + plot/plcolourmap.cpp + plot/plbarplot.cpp + plot/plhistplot.cpp + plot/pllineplot.cpp + plot/plplotctrl.cpp + plot/plscatterplot.cpp + registration.cpp + snaplay.cpp + tpdlg.cpp + uiform.cpp + utils.cpp + freetype/src/base/ftbase.c + freetype/src/base/ftbbox.c + freetype/src/base/ftbitmap.c + freetype/src/base/ftfntfmt.c + freetype/src/base/ftgasp.c + freetype/src/base/ftglyph.c + freetype/src/base/ftinit.c + freetype/src/base/ftstroke.c + freetype/src/base/ftsynth.c + freetype/src/base/ftsystem.c + freetype/src/base/fttype1.c + freetype/src/cff/cff.c + freetype/src/cid/type1cid.c + freetype/src/psaux/psaux.c + freetype/src/pshinter/pshinter.c + freetype/src/psnames/psnames.c + freetype/src/raster/raster.c + freetype/src/sfnt/sfnt.c + freetype/src/smooth/smooth.c + freetype/src/truetype/truetype.c + freetype/src/type1/type1.c + freetype/src/base/ftlcdfil.c + plot/qhull/geom.c + plot/qhull/geom2.c + plot/qhull/global.c + plot/qhull/io.c + plot/qhull/libqhull.c + plot/qhull/mem.c + plot/qhull/merge.c + plot/qhull/poly.c + plot/qhull/poly2.c + plot/qhull/qset.c + plot/qhull/random.c + plot/qhull/rboxlib.c + plot/qhull/stat.c + plot/qhull/user.c + plot/qhull/usermem.c + plot/qhull/userprintf.c + plot/qhull/userprintf_rbox.c + ) + +if (WIN32) + list(APPEND WEX_SRC + ole/activex.cpp + ole/excelauto.cpp + ole/iehtmlwin.cpp + ) +endif () + + +##################################################################################################################### +# +# CMake Targets +# +##################################################################################################################### + +add_library(wex STATIC ${WEX_SRC}) +set_target_properties(wex + PROPERTIES + DEBUG_POSTFIX "d" + PREFIX "" + ) +if (MSVC) + set_target_properties(wex + PROPERTIES + LINK_FLAGS /SUBSYSTEM:CONSOLE) +endif () + +target_include_directories(wex PRIVATE ../include freetype/include ${LKDIR}/include ${CURL_DIR}/include) + + +##################################################################################################################### +# +# Link Libraries and Options +# +##################################################################################################################### + +target_link_libraries(wex ${wxWidgets_LIBRARIES}) +if (MSVC) + target_compile_definitions(wex PUBLIC _LIB LK_USE_WXWIDGETS) +endif () +if (${CMAKE_PROJECT_NAME} STREQUAL export_config) + target_compile_definitions(wex PUBLIC _export_config_) +endif () diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000..bd7bec84 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,140 @@ +##################################################################################################################### +# +# Project Settings +# +##################################################################################################################### + +set(wexsandbox_SRC + sandbox/sandbox.cpp) + +set(DVIEW_SRC + dview/dview.cpp + ${LKDIR}/src/sqlite3.c + ) + +##################################################################################################################### +# +# CMake Targets +# +##################################################################################################################### + +# wexsandbox +add_executable(wexsandbox ${WEX_SRC} ${wexsandbox_SRC}) +set_target_properties(wexsandbox + PROPERTIES + DEBUG_POSTFIX "d" + ) +if (MSVC) + set_target_properties(wexsandbox + PROPERTIES + LINK_FLAGS /SUBSYSTEM:WINDOWS) +endif () + +target_include_directories(wexsandbox SYSTEM PRIVATE ../include ../src/freetype/include ${LKDIR}/include ${CURL_DIR}/include) + +if (APPLE) + # dview bundle + set(DVIEW_ICON ${CMAKE_CURRENT_SOURCE_DIR}/../build_resources/DView.icns) + set_source_files_properties(${DVIEW_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") + set(APPS "\${CMAKE_INSTALL_PREFIX}/DView.app") +elseif (WIN32) + set(DVIEW_ICON ${CMAKE_CURRENT_SOURCE_DIR}/../build_resources/dview.rc) + set(APPS "\${CMAKE_INSTALL_PREFIX}/DView.exe") +endif () + +add_executable(DView + WIN32 + MACOSX_BUNDLE + ${DVIEW_SRC} + ${DVIEW_ICON}) + +target_include_directories(DView SYSTEM PRIVATE ../include ../src/freetype/include ${LKDIR}/include ${CURL_DIR}/include) + +set_target_properties(DView + PROPERTIES + DEBUG_POSTFIX "d" + ) + +##################################################################################################################### +# +# Link Libraries and Options +# +##################################################################################################################### + +# DView +target_link_libraries(DView wex) +if (MSVC) + target_link_libraries(DView Winhttp) +elseif (UNIX AND NOT APPLE) + target_link_libraries(DView ${CMAKE_DL_LIBS} ${FONTCONFIG_LIBRARY}) +endif () + +# wex sandbox +if (${CMAKE_PROJECT_NAME} STREQUAL system_advisor_model) + target_link_libraries(wexsandbox lk) +else () + if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR MSVC) + unset(LKD_LIB CACHE) + find_library(LKD_LIB + NAMES lkd.a lkd.lib + PATHS $ENV{LKD_LIB} ../lk/build ../lk/build/Debug) + target_link_libraries(wexsandbox debug ${LKD_LIB}) + endif () + if (CMAKE_BUILD_TYPE STREQUAL "Release" OR MSVC) + unset(LK_LIB CACHE) + find_library(LK_LIB + NAMES lk.a lk.lib + PATHS $ENV{LK_LIB} ../lk/build ../lk/build/Release) + target_link_libraries(wexsandbox optimized ${LK_LIB}) + endif() +endif () +target_link_libraries(wexsandbox wex ${wxWidgets_LIBRARIES}) + +if (UNIX) + target_link_libraries(wexsandbox -ldl -lcurl) +elseif (MSVC) + find_library(CURL_LIB + NAMES libcurl.lib + PATHS ../build_resources/libcurl_ssl_x64/lib) + target_link_libraries(wexsandbox ${CURL_LIB} Winhttp) +endif () + + +##################################################################################################################### +# +# Target Installation +# +##################################################################################################################### + +if (APPLE) + install(TARGETS DView DESTINATION .) + install(CODE " + include(BundleUtilities) + set(BU_CHMOD_BUNDLE_ITEMS true) + fixup_bundle(\"${APPS}\" \"\" \"${wxWidgets_LIBRARY_DIRS}\") + ") +endif () + +if (MSVC) + set(LIBCURL_FILES + dbghelp.dll + libcurl.dll + libeay32.dll + libssh2.dll + msvcp140.dll + openssl.exe + ssleay32.dll + vcruntime140.dll + ) + set(WEXSB_DIR ${CMAKE_CURRENT_BINARY_DIR}/$<$:Debug>$<$:Release>) + + foreach (file_i ${LIBCURL_FILES}) + file(TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build_resources/libcurl_ssl_x64/bin/${file_i} LIB_PATH) + add_custom_command( + TARGET wexsandbox + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy ${LIB_PATH} ${WEXSB_DIR} + ) + endforeach (file_i) +endif () From b7af73f7821140a24551492812cb39e6b890bdbc Mon Sep 17 00:00:00 2001 From: dguittet Date: Fri, 10 Apr 2020 13:22:29 -0600 Subject: [PATCH 02/21] building on windows --- CMakeLists.txt | 2 -- src/CMakeLists.txt | 2 +- tools/CMakeLists.txt | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9b95fd3..2b763e47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,6 @@ else () endif () endif () -set(LKDIR $ENV{LKDIR}) - ##################################################################################################################### # diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 97d6e798..9ee7a528 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -175,7 +175,7 @@ if (MSVC) LINK_FLAGS /SUBSYSTEM:CONSOLE) endif () -target_include_directories(wex PRIVATE ../include freetype/include ${LKDIR}/include ${CURL_DIR}/include) +target_include_directories(wex PRIVATE ../include freetype/include $ENV{LKDIR}/include ${CURL_DIR}/include) ##################################################################################################################### diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index bd7bec84..65f073ed 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -7,6 +7,8 @@ set(wexsandbox_SRC sandbox/sandbox.cpp) +file(TO_CMAKE_PATH "$ENV{LKDIR}" LKDIR) + set(DVIEW_SRC dview/dview.cpp ${LKDIR}/src/sqlite3.c From ebc464d1145a0b92ac3145401f45a746dbec4a9d Mon Sep 17 00:00:00 2001 From: Janine Date: Fri, 22 May 2020 12:39:38 -0600 Subject: [PATCH 03/21] Update CONTRIBUTING.MD --- CONTRIBUTING.MD | 59 ++----------------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/CONTRIBUTING.MD b/CONTRIBUTING.MD index 72644352..1904c856 100644 --- a/CONTRIBUTING.MD +++ b/CONTRIBUTING.MD @@ -1,61 +1,6 @@ # Contributing to WEX and DView The team welcomes your contribution to the project! -You can contribute to WEX by letting us know about problems or suggesting new features, or by making your own changes or additions to the code. You may want to report or help us fix an [issue someone else reported](https://github.com/NREL/WEX/issues), fix an issue you discovered, or add a new feature to WEX. +You can contribute to WEX or DView by letting us know about problems or suggesting new features, or by making your own changes or additions to the code. You may want to report or help us fix an [issue someone else reported](https://github.com/NREL/wex/issues), fix an issue you discovered, or add a new feature. If you have a question about using SAM, you can ask us on the [SAM support forum](https://sam.nrel.gov/support). -## Contribution Policy -In the effort to make SAM easy to contribute to, the contribution process is composed of four simple steps: - -1. To get started, sign the Contributor License Agreement. -2. [Fork](https://help.github.com/articles/fork-a-repo/) the repo. -3. Make your modifications. For large new features, we suggest that you [email us](nicholas.diorio@nrel.gov) before you start working so that we coordinate your contribution (see more info for large contributions below!). -4. Create a [pull request](https://help.github.com/articles/about-pull-requests/). - -### Additional contribution help -Some additional details on what makes it more likely that your code will be readily accepted into the main development version of WEX. - -
For large contributions -

-If your contribution is larger (e.g. a new feature), it helps us to have a detailed description of the project that you are proposing, the precise functionalities that you plan to implement as part of the project, and a time frame for implementation. After we review your materials, we may ask you to revise your materials. For the greatest likelihood of success, it would be great to align on functionalities to be addressed. -

-
- -
Code quality and testing -

-We want SAM to adhere to high quality standards. Please try and broadly adhere to the same style of code in the area you will be working. Any bugs, either discovered by you, us, or any users will be tracked on the GitHub issues page. We request you that you take full responsibility for correcting bugs. We'd also really love for you to write a new unit test for the code you contribute! -

-
- - -
Documentation -

-Proper documentation is crucial for our users; without it users will not know how to use your contribution! If you add a new feature to SAM, we please ask you to submit some documentation as a Word, LaTex, Markdown or simple text document that our team will integrate SAM’s Help system. -

-
- -
For further assistance -

-Nicholas DiOrio -NREL Software Engineering -nicholas.diorio@nrel.gov -303.384.7359 -

-
- -
Resources for learning GitHub -

- -If you are new to GitHub, you can find helpful articles to help you learn how it works on the web. Some examples are: - -* [Using the Fork-and-Branch Git Workflow](https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/) from Scott's Weblog is a good introduction. - -* [Git Concepts: Branches, Forks, and Pull Requests](http://willi.am/blog/2014/05/12/git-concepts-branches-forks-and-pull-requests/) from Will Anderson is useful, although the video on the page does not work. - -* [3.2 Git Branching - Basic Branching and Merging](https://www.git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging) from the Git documentation. - -* [Fork a Repo](https://help.github.com/articles/fork-a-repo/) from GitHub Help. - -* [About pull requests](https://help.github.com/articles/about-pull-requests/) from GitHub Help. - -

-
+Please see our wiki page for our contribution policy: [https://github.com/NREL/SAM/wiki/Contribution-Policy](https://github.com/NREL/SAM/wiki/Contribution-Policy). From caa7b79119551dd9b457b091fa325d6d8f719730 Mon Sep 17 00:00:00 2001 From: dguittet Date: Fri, 5 Jun 2020 17:56:00 -0600 Subject: [PATCH 04/21] move output dir to main wex output folder --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9ee7a528..18626dcc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -168,6 +168,7 @@ set_target_properties(wex PROPERTIES DEBUG_POSTFIX "d" PREFIX "" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../" ) if (MSVC) set_target_properties(wex From 22f8278b39903b3264decc8378da863b3c87665c Mon Sep 17 00:00:00 2001 From: dguittet Date: Fri, 5 Jun 2020 18:22:17 -0600 Subject: [PATCH 05/21] fix wexsandbox CMakeLists --- tools/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 65f073ed..f4006a84 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -79,14 +79,14 @@ else () unset(LKD_LIB CACHE) find_library(LKD_LIB NAMES lkd.a lkd.lib - PATHS $ENV{LKD_LIB} ../lk/build ../lk/build/Debug) + PATHS $ENV{LKD_LIB} $ENV{LKDIR}/build $ENV{LKDIR}/build/Debug) target_link_libraries(wexsandbox debug ${LKD_LIB}) endif () if (CMAKE_BUILD_TYPE STREQUAL "Release" OR MSVC) unset(LK_LIB CACHE) find_library(LK_LIB NAMES lk.a lk.lib - PATHS $ENV{LK_LIB} ../lk/build ../lk/build/Release) + PATHS $ENV{LK_LIB} $ENV{LKDIR}/build $ENV{LKDIR}/build/Release) target_link_libraries(wexsandbox optimized ${LK_LIB}) endif() endif () From 65a2823fa7c29894fecc0d655521796681bb0e87 Mon Sep 17 00:00:00 2001 From: dguittet Date: Sat, 6 Jun 2020 13:51:10 -0600 Subject: [PATCH 06/21] CMakeLists fix output directory --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 18626dcc..6812ab49 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -168,7 +168,7 @@ set_target_properties(wex PROPERTIES DEBUG_POSTFIX "d" PREFIX "" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/../" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) if (MSVC) set_target_properties(wex From 6263e469f90b0c6374deabbf02436df2ad188926 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Tue, 9 Jun 2020 21:38:23 +1000 Subject: [PATCH 07/21] * clipper.cpp: Add initialisation for simple types in struct TEdge and then explicitly initialise TEdge when creating the edge array. Remove memset() call in InitEdge(), which produces a G++ warning. --- src/clipper/clipper.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/clipper/clipper.cpp b/src/clipper/clipper.cpp index 16155a33..741aa97c 100644 --- a/src/clipper/clipper.cpp +++ b/src/clipper/clipper.cpp @@ -70,20 +70,20 @@ namespace ClipperLib { IntPoint Curr; IntPoint Top; IntPoint Delta; - double Dx; - PolyType PolyTyp; - EdgeSide Side; - int WindDelta; //1 or -1 depending on winding direction - int WindCnt; - int WindCnt2; //winding count of the opposite polytype - int OutIdx; - TEdge *Next; - TEdge *Prev; - TEdge *NextInLML; - TEdge *NextInAEL; - TEdge *PrevInAEL; - TEdge *NextInSEL; - TEdge *PrevInSEL; + double Dx = 0; + PolyType PolyTyp = static_cast(0); + EdgeSide Side = static_cast(0); + int WindDelta = 0; //1 or -1 depending on winding direction + int WindCnt = 0; + int WindCnt2 = 0; //winding count of the opposite polytype + int OutIdx = 0; + TEdge *Next = 0; + TEdge *Prev = 0; + TEdge *NextInLML = 0; + TEdge *NextInAEL = 0; + TEdge *PrevInAEL = 0; + TEdge *NextInSEL = 0; + TEdge *PrevInSEL = 0; }; struct IntersectNode { @@ -640,7 +640,6 @@ namespace ClipperLib { //------------------------------------------------------------------------------ inline void InitEdge(TEdge *e, TEdge *eNext, TEdge *ePrev, const IntPoint &Pt) { - std::memset(e, 0, sizeof(TEdge)); e->Next = eNext; e->Prev = ePrev; e->Curr = Pt; @@ -937,7 +936,7 @@ namespace ClipperLib { if ((Closed && highI < 2) || (!Closed && highI < 1)) return false; //create a new edge array ... - TEdge *edges = new TEdge[highI + 1]; + TEdge *edges = new TEdge[highI + 1](); bool IsFlat = true; //1. Basic (first) edge initialization ... From 39e05605a5eaeb99cf29500bfb0201b7cffb63cd Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Thu, 18 Jun 2020 23:35:49 +1000 Subject: [PATCH 08/21] Remove unused 'bitmap' variable causing an unused variable warning. (#98) --- tools/sandbox/sandbox.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/sandbox/sandbox.cpp b/tools/sandbox/sandbox.cpp index a32b2339..b2ee354a 100644 --- a/tools/sandbox/sandbox.cpp +++ b/tools/sandbox/sandbox.cpp @@ -50,8 +50,6 @@ class PngTestApp : public wxApp { wxInitAllImageHandlers(); wxFrame *frm = new wxFrame(NULL, wxID_ANY, "SchedCtrl", wxDefaultPosition, wxSize(300, 200)); frm->SetBackgroundColour(*wxWHITE); - wxStaticBitmap *bitmap = new wxStaticBitmap(frm, wxID_ANY, wxBITMAP_PNG_FROM_DATA(time)); - frm->Show(); return true; } From f89311a40e369446debc5346242869f278dab251 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Thu, 18 Jun 2020 23:38:28 +1000 Subject: [PATCH 09/21] Make seedbuf one character shorter than command so that G++ does not (#101) warn about strncat usage where there may be insufficient space for the null terminator in the destination string. --- src/plot/qhull/rboxlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plot/qhull/rboxlib.c b/src/plot/qhull/rboxlib.c index f62c24fe..16a45d2b 100644 --- a/src/plot/qhull/rboxlib.c +++ b/src/plot/qhull/rboxlib.c @@ -114,7 +114,7 @@ int qh_rboxpoints(FILE *fout, FILE *ferr, char *rbox_command) { double anglediff, angle, x, y, cube = 0.0, diamond = 0.0; double box = qh_DEFAULTbox; /* scale all numbers before output */ double randmax = qh_RANDOMmax; - char command[200], seedbuf[200]; + char command[200], seedbuf[199]; char *s = command, *t, *first_point = NULL; time_t timedata; int exitcode; From 45a7657c1692dbb12804760afc9735ac14c1b015 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Thu, 18 Jun 2020 23:44:42 +1000 Subject: [PATCH 10/21] Remove deprecated wxWidgets method wxCodeEditControl::SetStyleBits. (#102) According to my reading of the wxWidgets and Scintilla manuals, we can just do away with this without any other changes. --- src/codeedit.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/codeedit.cpp b/src/codeedit.cpp index 78dba7b3..1625269a 100644 --- a/src/codeedit.cpp +++ b/src/codeedit.cpp @@ -303,7 +303,6 @@ void wxCodeEditCtrl::SetLanguage(Language lang) { // first, revert to standard style m_lang = NONE; - SetStyleBits(8); SetLayoutCache(wxSTC_CACHE_PAGE); SetLexer(wxSTC_LEX_NULL); From 589387f7771418f51dd2430f464c7b9ec2be800f Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Tue, 7 Jul 2020 05:36:26 +1000 Subject: [PATCH 11/21] Silence g++ warnings about unused variables with -Wall for some CJK MS (#105) fonts. Patch taken from upstream commit bf355c7. See: https://github.com/utelle/wxpdfdoc/issues/69 --- src/pdf/pdfcjkfontdata.inc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pdf/pdfcjkfontdata.inc b/src/pdf/pdfcjkfontdata.inc index f0a75463..cc9e9481 100644 --- a/src/pdf/pdfcjkfontdata.inc +++ b/src/pdf/pdfcjkfontdata.inc @@ -2,6 +2,10 @@ #include "wex/pdf/pdfcjkfontdata.h" +#ifndef WXPDFDOC_ENABLE_CJK_MS_FONTS +#define WXPDFDOC_ENABLE_CJK_MS_FONTS 0 +#endif + static short cwAllHw[] = { 500, 500, 500, 500, 500, 500, 500, 500, @@ -82,6 +86,8 @@ static short cwUhc[] = 625, 625, 500, 583, 583, 583, 750 }; +#if WXPDFDOC_ENABLE_CJK_MS_FONTS + static short cwPGothic[] = { 305, 219, 500, 500, 500, 500, 594, 203, @@ -130,6 +136,8 @@ static short cwPMincho[] = 469, 477, 453, 242, 219, 242, 500 }; +#endif + static const wxPdfCjkFontDesc gs_cjkFontTable[] = { {wxT("big5"), wxT("MSungStd-Light-Acro"), wxT("cp-950"), wxT("CNS1"), wxT("0"), wxT("ETenms-B5-H"), @@ -149,7 +157,7 @@ static const wxPdfCjkFontDesc gs_cjkFontTable[] = {wxT("uhc-hw"), wxT("HYSMyeongJoStd-Medium-Acro--KSCms-UHC-HW-H"), wxT("cp-949"), wxT("Korea1"), wxT("1"), wxT("KSCms-UHC-HW-H"), cwAllHw, wxT("[0 -200 1000 900]"), 800, -200, 800, 6, 0, 50, 1000, 616, -130, 40}, -#if 0 +#if WXPDFDOC_ENABLE_CJK_MS_FONTS // These M$ fonts don't work cross platform. // To make them available as Type0 fonts they should be registered via RegisterFontCJK. { wxT("gothic"), wxT("MS-Gothic"), wxT("cp-932"), wxT("Japan1"), wxT("2"), wxT("90msp-RKSJ-H"), cwAllHw, wxT("[0 0 1000 1000]"), 1000, 0, 1000, 6, 0, 10, 1000, 553, -66, 74 }, @@ -158,6 +166,7 @@ static const wxPdfCjkFontDesc gs_cjkFontTable[] = { wxT("mincho"), wxT("MS-Mincho"), wxT("cp-932"), wxT("Japan1"), wxT("2"), wxT("90msp-RKSJ-H"), cwAllHw, wxT("[0 0 1000 1000]"), 1000, 0, 1000, 6, 0, 10, 1000, 450, -94, 47 }, { wxT("pmincho"), wxT("MS-PMincho"), wxT("cp-932"), wxT("Japan1"), wxT("2"), wxT("90msp-RKSJ-H"), cwPMincho, wxT("[0 0 1000 1000]"), 1000, 0, 1000, 6, 0, 10, 1000, 450, -94, 47 }, #endif + // Last dummy entry {wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString, NULL, wxEmptyString, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} From 7211dc6dfcefc929b7641b1f792b37eb081edb62 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Sat, 11 Jul 2020 04:08:43 +1000 Subject: [PATCH 12/21] Pass -Wno-unused-but-set-variable for DView and Qhull sources (#104) * Pass -Wno-unused-but-set-variable for DView and Qhull sources. * Pass -Wno-unused-functions when compiling freetype/src/base/ftbase.c. * Pass -Werror when compiling on Linux. * Revert "Pass -Werror when compiling on Linux." This reverts commit 38184b4ecd0ba7d3caf6480b0b03ea5f3c7be794. --- src/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6812ab49..15902bd0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -176,6 +176,15 @@ if (MSVC) LINK_FLAGS /SUBSYSTEM:CONSOLE) endif () +file(GLOB DVIEW_SRC_FILES dview/*.cpp) +file(GLOB QHULL_SRC_FILES plot/qhull/*.c) + +set_source_files_properties(freetype/src/base/ftbase.c + PROPERTIES COMPILE_FLAGS -Wno-unused-function) + +set_source_files_properties(${DVIEW_SRC_FILES} ${QHULL_SRC_FILES} + PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable) + target_include_directories(wex PRIVATE ../include freetype/include $ENV{LKDIR}/include ${CURL_DIR}/include) From cb197739377e09011acef21388f9faafa1fcb54f Mon Sep 17 00:00:00 2001 From: Brian Mirletz Date: Mon, 13 Jul 2020 13:31:03 -0600 Subject: [PATCH 13/21] disable warning suppression for msvc systems so wex can compile. We already suppressed these warnings for mscv at level w3 --- src/CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 15902bd0..077b6d7f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -176,14 +176,16 @@ if (MSVC) LINK_FLAGS /SUBSYSTEM:CONSOLE) endif () -file(GLOB DVIEW_SRC_FILES dview/*.cpp) -file(GLOB QHULL_SRC_FILES plot/qhull/*.c) +if (NOT MSVC) + file(GLOB DVIEW_SRC_FILES dview/*.cpp) + file(GLOB QHULL_SRC_FILES plot/qhull/*.c) -set_source_files_properties(freetype/src/base/ftbase.c - PROPERTIES COMPILE_FLAGS -Wno-unused-function) + set_source_files_properties(freetype/src/base/ftbase.c + PROPERTIES COMPILE_FLAGS -Wno-unused-function) -set_source_files_properties(${DVIEW_SRC_FILES} ${QHULL_SRC_FILES} - PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable) + set_source_files_properties(${DVIEW_SRC_FILES} ${QHULL_SRC_FILES} + PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable) +endif () target_include_directories(wex PRIVATE ../include freetype/include $ENV{LKDIR}/include ${CURL_DIR}/include) From bb6d3dfeb987544a7a818635cbfc9e9da824c872 Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Tue, 21 Jul 2020 10:17:14 +1000 Subject: [PATCH 14/21] Set CFLAGS and CXXFLAGS to -Werror for Travis CI (#106) * Set CFLAGS and CXXFLAGS to -Werror so that these are included in the CMake compiler flags. It is best to not impose -Werror on users trying to build this library for themselves as local issues could produce spurious warnings that will cause the build to fail -- and users to complain. * Set CFLAGS and CXXFLAGS at cmake invoication only. Setting them in the environment caused problems with other compling that happens. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 425f1032..68996c1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ before_script: script: - export PATH=$PATH:$HOME/wx-3.1.1/bin - - mkdir ${LKDIR}/build && cd ${LKDIR}/build && cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build . --target lk -- -j2 + - mkdir ${LKDIR}/build && cd ${LKDIR}/build && cmake -E env CFLAGS="-Werror" CXXFLAGS="-Werror" cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build . --target lk -- -j2 - cd ${HOME}/build/NREL/wex && cmake . -DCMAKE_BUILD_TYPE=Release && make -j2 install: From 04e2ef15916e37f4a6330a95a5e29299749e9606 Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Tue, 21 Jul 2020 04:18:38 -0600 Subject: [PATCH 15/21] Update sector plotting to handle requests from ME group outputs --- src/plot/ploutdev.cpp | 2 +- src/plot/plsectorplot.cpp | 2 ++ tools/sandbox/sandbox.cpp | 47 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/plot/ploutdev.cpp b/src/plot/ploutdev.cpp index f194025f..eb9aedbd 100644 --- a/src/plot/ploutdev.cpp +++ b/src/plot/ploutdev.cpp @@ -527,7 +527,7 @@ void wxPLGraphicsOutputDevice::TextColour(const wxColour &c) { m_textColour = c; } -//#define FREETYPE_TEXT 1 +#define FREETYPE_TEXT 1 #define FT_FONT_FACE_DEFAULT 0 #include diff --git a/src/plot/plsectorplot.cpp b/src/plot/plsectorplot.cpp index 21396aff..5c1dd758 100644 --- a/src/plot/plsectorplot.cpp +++ b/src/plot/plsectorplot.cpp @@ -187,6 +187,8 @@ void wxPLSectorPlot::Draw(wxPLOutputDevice &dc, const wxPLDeviceMapping &map) { // draw sectors dc.NoPen(); + // allow for pen colors and section border + dc.Pen(*wxWHITE, 1.5); for (size_t i = 0; i < m_sectors.size(); i++) { sector &S = m_sectors[i]; dc.Brush(cl[i % cl.size()]); diff --git a/tools/sandbox/sandbox.cpp b/tools/sandbox/sandbox.cpp index b2ee354a..9e954b99 100644 --- a/tools/sandbox/sandbox.cpp +++ b/tools/sandbox/sandbox.cpp @@ -760,6 +760,46 @@ void TestPlotAnnotations(wxWindow *parent) { frame->Show(); } + +void TestMELCOESectorPlot(wxWindow* parent) { + wxFrame* frame = new wxFrame(parent, wxID_ANY, wxT("ME LCOE"), + wxDefaultPosition, wxSize(500, 400)); + wxPLPlotCtrl* plot = new wxPLPlotCtrl(frame, wxID_ANY, wxDefaultPosition, wxDefaultSize); + //plot->SetBackgroundColour( *wxWHITE ); + plot->SetTitle(wxT("Example of LCOE Contribution Pie Chart for ME SAM Results")); + plot->ShowGrid(false, false); + + wxPLSectorPlot* sec = new wxPLSectorPlot(); +// sec->AddSector(64.89, "Total device cost"); +// sec->AddSector(17.27, "Total balance of system cost"); +// sec->AddSector(6.79, "Total financial cost"); +// sec->AddSector(11.05, "Total operating cost (annual)"); + sec->AddSector(32, "Total device cost"); + sec->AddSector(9, "Total balance of system cost"); + sec->AddSector(4, "Total financial cost"); + sec->AddSector(55, "Total operating cost (annual)"); + sec->SetCenterHoleSize(0.0); +// sec->SetCalloutSize(65.9); +// sec->SetBorder(100.4); +// sec->ShowSegmentValues(true); + // sec->SetTextSpace(20.0); + sec->SetAntiAliasing(true); + std::vector clr; + clr.push_back(wxColour(51,88,153)); + clr.push_back(wxColour(363,160,183)); + clr.push_back(wxColour(121,145,206)); + clr.push_back(wxColour(84,130,53)); + sec->SetColours(clr); + + sec->SetFormat(wxNUMERIC_REAL, wxNUMERIC_GENERIC, false, wxEmptyString, " %"); + plot->AddPlot(sec); + plot->ShowAxes(false); + plot->SetBorderWidth(0); + frame->Show(); +} + + + void TestSectorPlot(wxWindow *parent) { wxFrame *frame = new wxFrame(parent, wxID_ANY, wxT("Sector plots in \x01dc\x03AE\x03AA\x00C7\x00D6\x018C\x01dd"), wxDefaultPosition, wxSize(500, 400)); @@ -1321,8 +1361,8 @@ class MyApp : public wxApp { // int nf = wxFreeTypeLoadAllFonts(); // wxMessageBox( wxString::Format("Loaded %d fonts in %d ms.", nf, (int)sw.Time()) ); - TestContourPlot(); - TestWaveAnnualEnergyPlot(); +// TestContourPlot(); +// TestWaveAnnualEnergyPlot(); // TestPLPlot(0); // TestPLPolarPlot(0); @@ -1330,9 +1370,10 @@ class MyApp : public wxApp { // TestStackedBarPlot(0); // TestSAMStackedBarPlot(0); TestSectorPlot(0); + TestMELCOESectorPlot(0); // TestTextLayout(); //TestFreeTypeText(); - TestPlotAnnotations(0); +// TestPlotAnnotations(0); // TestWindPrufFigure2(0); // TestWindPrufFigure5(0); From 5cd4740bf5da3213f03350fdd4b78ce88eccb666 Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Wed, 5 Aug 2020 04:55:13 -0600 Subject: [PATCH 16/21] wex updates for sector plots --- src/plot/plplot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plot/plplot.cpp b/src/plot/plplot.cpp index 26fb183b..b39d1ea5 100644 --- a/src/plot/plplot.cpp +++ b/src/plot/plplot.cpp @@ -1482,7 +1482,7 @@ void wxPLPlot::DrawGrid(wxPLOutputDevice &dc, wxPLAxis::TickData::TickSize size) if (m_x1.axis != 0) xgrid_axis = &m_x1; else if (m_x2.axis != 0) xgrid_axis = &m_x2; - if (xgrid_axis != 0) { + if (xgrid_axis != 0 && xgrid_axis->layout != 0) { std::vector ticks = xgrid_axis->layout->ticks(size); for (size_t i = 0; i < ticks.size(); i++) { double xpos = xgrid_axis->axis->WorldToPhysical(ticks[i], m_plotRects[0].x, From 79814f4ba8a00cd40ae22145c7ba03989c6795ec Mon Sep 17 00:00:00 2001 From: Brian Mirletz Date: Thu, 5 Nov 2020 16:41:28 -0700 Subject: [PATCH 17/21] Add wxWidgets environment variable in case the developer doesn't have root access to create the symlink --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b763e47..3993274c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,8 +67,13 @@ endif () # setup wxWidgets if (UNIX) - set(wxWidgets_CONFIG_EXECUTABLE /usr/local/bin/wx-config-3) - find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base) + if (EXISTS /usr/local/bin/wx-config-3) + set(wxWidgets_CONFIG_EXECUTABLE /usr/local/bin/wx-config-3) + find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base) + else () + set(wxWidgets_CONFIG_EXECUTABLE $ENV{WXMSW3}) + find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base) + endif () else () set(wxWidgets_ROOT_DIR $ENV{WXMSW3}) find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base scintilla) From fe5debec42724d7bfe3b688c027d4e93dab4b948 Mon Sep 17 00:00:00 2001 From: Brian Mirletz Date: Fri, 6 Nov 2020 09:53:38 -0700 Subject: [PATCH 18/21] Change path for wxWidgets env variable to be more similar to Windows --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3993274c..e671ac4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ if (UNIX) set(wxWidgets_CONFIG_EXECUTABLE /usr/local/bin/wx-config-3) find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base) else () - set(wxWidgets_CONFIG_EXECUTABLE $ENV{WXMSW3}) + set(wxWidgets_CONFIG_EXECUTABLE $ENV{WXMSW3}/bin/wx-config) find_package(wxWidgets REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base) endif () else () From 6dd3d9683e1a130dc5a4afdcec53dffd2da62044 Mon Sep 17 00:00:00 2001 From: Brian Mirletz Date: Fri, 6 Nov 2020 15:13:18 -0700 Subject: [PATCH 19/21] add lgtm yml file for static analysis --- .lgtm.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .lgtm.yml diff --git a/.lgtm.yml b/.lgtm.yml new file mode 100644 index 00000000..652d6bd7 --- /dev/null +++ b/.lgtm.yml @@ -0,0 +1,34 @@ +extraction: + cpp: + prepare: + packages: + - g++ + - libgtk2.0-dev + - libgl1-mesa-dev + - mesa-common-dev + - freeglut3-dev + - libcurl4-openssl-dev + - libc6 + + after_prepare: + - wget -q https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2 -O $LGTM_WORKSPACE/wxWidgets-3.1.1.tar.bz2 + - cd $LGTM_WORKSPACE + - tar jxf wxWidgets-3.1.1.tar.bz2 + - cd wxWidgets-3.1.1 + - ./configure --prefix=$LGTM_WORKSPACE/wx-3.1.1 --enable-shared=no --enable-stl=yes --enable-debug=no --with-gtk=2 --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --without-libjbig --without-liblzma --without-gtkprint --with-libnotify=no --with-libmspack=no --with-gnomevfs=no --with-opengl=yes --with-sdl=no --with-cxx=11 + - make -j2 all install + - export WXMSW3=$LGTM_WORKSPACE/wx-3.1.1 + - (cd ../ && pwd) + - export LKDIR=$LGTM_WORKSPACE/build/lk + - export WEXDIR=$LGTM_SRC + - git clone --depth=1 https://github.com/NREL/lk $LKDIR; + - export PATH=$PATH:$HOME/wx-3.1.1/bin + + configure: + command: + - mkdir $LKDIR/build && cd $LKDIR/build && cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build . -j 4 --target lk + - mkdir $WEXDIR/build && cd $WEXDIR/build && cmake .. -DCMAKE_BUILD_TYPE=Release + index: + build_command: + cd $WEXDIR/build && make -j 4 + \ No newline at end of file From e7d5e3a4c280de1800164eff45dd09b96804132f Mon Sep 17 00:00:00 2001 From: Darice L Guittet Date: Tue, 10 Nov 2020 10:34:50 -0700 Subject: [PATCH 20/21] rename skip_tools to SAM_SKIP_TOOLS (#111) --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e671ac4e..7a7aa6ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,10 +6,10 @@ cmake_minimum_required(VERSION 3.11) -option(skip_tools "Skips the wex sandbox and Dview builds" OFF) +option(SAM_SKIP_TOOLS "Skips the wex sandbox and Dview builds" OFF) # -# If project isn't system_advisor_model and skip_tools=1, +# If project isn't system_advisor_model and SAM_SKIP_TOOLS=1, # environment vars LK_LIB and LKD_LIB can be used to specify where to find those libraries # @@ -98,6 +98,6 @@ endif () ##################################################################################################################### add_subdirectory(src) -if (NOT skip_tools) +if (NOT SAM_SKIP_TOOLS) add_subdirectory(tools) endif() From a2469aee80e52ae5b26cd069497e5c50a46b20bd Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Sun, 29 Nov 2020 01:29:13 -0700 Subject: [PATCH 21/21] MacOS test to address SAM issue 462 --- src/codeedit.cpp | 1 + src/plot/ploutdev.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/codeedit.cpp b/src/codeedit.cpp index 1625269a..78dba7b3 100644 --- a/src/codeedit.cpp +++ b/src/codeedit.cpp @@ -303,6 +303,7 @@ void wxCodeEditCtrl::SetLanguage(Language lang) { // first, revert to standard style m_lang = NONE; + SetStyleBits(8); SetLayoutCache(wxSTC_CACHE_PAGE); SetLexer(wxSTC_LEX_NULL); diff --git a/src/plot/ploutdev.cpp b/src/plot/ploutdev.cpp index eb9aedbd..f194025f 100644 --- a/src/plot/ploutdev.cpp +++ b/src/plot/ploutdev.cpp @@ -527,7 +527,7 @@ void wxPLGraphicsOutputDevice::TextColour(const wxColour &c) { m_textColour = c; } -#define FREETYPE_TEXT 1 +//#define FREETYPE_TEXT 1 #define FT_FONT_FACE_DEFAULT 0 #include