Skip to content

Commit

Permalink
Merge pull request #16 from NREL/2020.2.29.r0.ssc.237
Browse files Browse the repository at this point in the history
2020.2.29.r0.ssc.237
  • Loading branch information
dguittet authored Mar 16, 2020
2 parents c0ff03f + 16a4d1a commit 17c503f
Show file tree
Hide file tree
Showing 268 changed files with 98,963 additions and 92,612 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*.cpp text
*.h text
*.lk text
*.vcxproj text

# Ensure those won't be messed up with
*.jpg binary
*.data binary
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ __pycache__/
*.bin
*.mod

*.html
*.png
*.js
*.css
*.tex

build/
36 changes: 17 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
dist: Xenial
sudo: required

language: c++

os:
- linux
- osx
- linux
- osx

compiler:
- gcc

- gcc

before_script:
- wget -q https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2
- tar jxf wxWidgets-3.1.1.tar.bz2
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then (cd wxWidgets-3.1.1 && ./configure --prefix=$HOME/wx-3.1.1 && make -j2 all install); fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then (cd wxWidgets-3.1.1 && ./configure --prefix=$HOME/wx-3.1.1 --enable-stl=yes --enable-debug=no --enable-shared=no --with-cocoa --enable-macosx_arch=x86_64 --enable-unicode --enable-webview --with-cxx=11 --with-macosx-version-min=10.9 --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --disable-mediactrl && make -j2 all install); fi
- ln -s $HOME/wx-3.1.1/bin/wx-config $HOME/wx-3.1.1/bin/wx-config-3
- wget -q https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2
- tar jxf wxWidgets-3.1.1.tar.bz2
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then (cd wxWidgets-3.1.1 && ./configure --prefix=$HOME/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); fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then (cd wxWidgets-3.1.1 && ./configure --prefix=$HOME/wx-3.1.1 --enable-stl=yes --enable-debug=no --enable-shared=no --with-cocoa --enable-macosx_arch=x86_64 --enable-unicode --enable-webview --with-cxx=11 --with-macosx-version-min=10.9 --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --disable-mediactrl && make -j2 all install); fi
- sudo ln -s $HOME/wx-3.1.1/bin/wx-config /usr/local/bin/wx-config-3

script:
- export PATH=$PATH:$HOME/wx-3.1.1/bin
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make -j2 -C build_linux; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make -j2 -C build_osx; fi
- cd ../lk && cmake . -DCMAKE_BUILD_TYPE=Release && make -j2

install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libgtk-3-dev; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi

- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update && sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev libgtk2.0-dev; fi

branches:
only:
- master
- develop

only:
- master
- develop
144 changes: 144 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#####################################################################################################################
#
# CMake and System Settings
#
#####################################################################################################################

set(CMAKE_VERBOSE_MAKEFILE ON)

cmake_minimum_required(VERSION 3.11)

if (APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
endif ()

if (UNIX AND NOT CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
endif ()


#####################################################################################################################
#
# Project Sources
#
#####################################################################################################################

Project(lk)

set(LK_SRC
src/absyn.cpp
src/eval.cpp
src/parse.cpp
src/vm.cpp
src/codegen.cpp
src/invoke.cpp
src/env.cpp
src/lex.cpp
src/sqlite3.c
src/stdlib.cpp)


#####################################################################################################################
#
# Compile Options per Platform
#
#####################################################################################################################

set(CMAKE_CXX_STANDARD 11)

if (MSVC)
add_compile_options(/W3 /wd4996 /MP)
add_compile_definitions(WIN32 _CRT_SECURE_NO_DEPRECATE=1 _CRT_NON_CONFORMING_SWPRINTFS=1
_SCL_SECURE_NO_WARNINGS=1 __WXMSW__ _UNICODE NOPCH LK_USE_WXWIDGETS)
foreach (flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG)
set(${flag_var} "${${flag_var}} /D_DEBUG" CACHE STRING "compile flags" FORCE)
endforeach ()
else (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (APPLE)
add_compile_options(-arch x86_64 -fno-common)
add_definitions(-DWX_PRECOMP)
endif ()
add_compile_options(-Wall -O2 -Werror -Wno-deprecated -Wno-unused-function -Wno-deprecated-declarations)
add_definitions(-DLK_USE_WXWIDGETS)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(_DEBUG)
else ()
add_compile_options(-O3)
endif ()
endif (MSVC)


#####################################################################################################################
#
# WxWidgets Package
#
#####################################################################################################################

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_ROOT_DIR $ENV{WXMSW3})
find_package(wxWidgets REQUIRED qa webview aui richtext html propgrid adv net stc core base scintilla)
endif ()

include(${wxWidgets_USE_FILE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")


#####################################################################################################################
#
# CMake Targets
#
#####################################################################################################################

# lk library
add_library(lk STATIC ${LK_SRC})
set_target_properties(lk
PROPERTIES
DEBUG_POSTFIX "d"
PREFIX ""
)
if (MSVC)
set_target_properties(lk
PROPERTIES
LINK_FLAGS /SUBSYSTEM:CONSOLE)
endif ()

target_include_directories(lk PRIVATE include)

# sandbox executable
add_executable(lk_sandbox ${LK_SRC} sandbox/sandbox.cpp)
set_target_properties(lk_sandbox
PROPERTIES
DEBUG_POSTFIX "d"
)
if (MSVC)
set_target_properties(lk_sandbox
PROPERTIES
LINK_FLAGS /SUBSYSTEM:WINDOWS)
endif ()

target_include_directories(lk_sandbox PUBLIC include)


#####################################################################################################################
#
# Link Libraries and Options
#
#####################################################################################################################

# lk library
if (${CMAKE_PROJECT_NAME} STREQUAL export_config)
target_compile_definitions(lk PUBLIC _export_config_)
endif ()

# sandbox executable
if (UNIX)
target_link_libraries(lk_sandbox -ldl)
endif ()

target_link_libraries(lk_sandbox lk ${wxWidgets_LIBRARIES})
62 changes: 58 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,62 @@
# Contributing to LK
To get started contributing to LK, please read the [DView Contribution Policy](https://github.com/NREL/wex/blob/develop/CONTRIBUTING.MD).
The team welcomes your contribution to the project!

In particular, you'll need to email the following agreement to [[email protected]]([email protected]):
You can contribute to LK 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/lk/issues), fix an issue you discovered, or add a new feature to LK.

_I agree to contribute to DView. I agree to the following terms and conditions for my contributions: First, I agree that I am licensing my contributions under the terms of the current DView license. Second, I agree that, in order to conform to any future open source software license(s) under which DView may be provided, the terms of my license may be modified without any notice to me and without my consent. Third, I represent and warrant that I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes my contributions, I represent and warrant that I have received permission to make contributions and grant the required license on behalf of my employer._
## Contribution Policy
In the effort to make lk easy to contribute to, the contribution process is composed of four simple steps:

Thank you for your interest in contributing!
1. To get started, <a href="https://www.clahub.com/agreements/NREL/lk">sign the Contributor License Agreement</a>.
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]([email protected]) 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 lk.

<details><summary>For large contributions</summary>
<p>
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.
</p>
</details>

<details><summary>Code quality and testing</summary>
<p>
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!
</p>
</details>


<details><summary>Documentation</summary>
<p>
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 lk, we please ask you to submit some documentation as a Word, LaTex, Markdown or simple text document.

</p>
</details>

<details><summary>For further assistance</summary>
<p>
Nicholas DiOrio
NREL Software Engineering
[email protected]
303.384.7359
</p>
</details>

<details><summary>Resources for learning GitHub</summary>
<p>

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.

</p>
</details>
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2019, Alliance for Sustainable Energy
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 changes: 0 additions & 11 deletions LICENSE.md

This file was deleted.

Loading

0 comments on commit 17c503f

Please sign in to comment.