Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 65 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ set(LK_SRC
#
#####################################################################################################################

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)

if (MSVC)
add_compile_options(/W3 /wd4996 /MP)
Expand All @@ -57,7 +57,6 @@ if (MSVC)
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( -fno-common)
Expand All @@ -82,17 +81,53 @@ endif (MSVC)
if (UNIX)
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)
find_package(wxWidgets QUIET REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base)
else ()
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)
find_package(wxWidgets QUIET 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)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Debug and Release Builds Configured" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
# for linking to Release build of ortools
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
# Get the current debug flags and remove the /D_DEBUG option.
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
# following does not force release libraries for wxWidgets using find_package
#set(CMAKE_MAP_IMPORTED_CONFIG_DEBUG RELEASE)

set(wxWidgets_ROOT_DIR $ENV{WXMSW3})
find_package(wxWidgets REQUIRED qa webview aui richtext html propgrid adv net stc core base scintilla)
find_package(wxWidgets QUIET REQUIRED xrc webview stc richtext ribbon propgrid aui gl html qa adv core xml net base scintilla)

# message("All wxWidgets: " ${wxWidgets_LIBRARIES})
set(FOUND "false")
foreach(lib ${wxWidgets_LIBRARIES})
string(FIND ${lib} "optimized" INDEX)
string(FIND ${lib} "debug" INDEX2)
string(FIND ${lib} "wxWidgets" INDEX3)
if (INDEX GREATER_EQUAL 0) # skip once
set(FOUND "true")
continue()
elseif((INDEX2 LESS 0) AND (INDEX3 LESS 0))
set(FOUND "true")
endif()
if (${FOUND} STREQUAL "true")
set(FOUND "false")
message("lib: ${lib}")
list(APPEND WX_LIBS_LIST ${lib})
endif()
endforeach()

list(JOIN WX_LIBS_LIST ";" wxWidgets_LIBRARIES)
# message("Link Libraries for wxWidgets: ${wxWidgets_LIBRARIES}")

endif ()

include(${wxWidgets_USE_FILE})
if (wxWidgets_FOUND)
include(${wxWidgets_USE_FILE})
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")


Expand Down Expand Up @@ -151,5 +186,28 @@ if (NOT SAM_SKIP_TOOLS)
target_link_libraries(lk_sandbox -ldl)
endif ()

target_link_libraries(lk_sandbox lk ${wxWidgets_LIBRARIES})
# target_link_libraries(lk_sandbox ${wxWidgets_LIBRARIES})
# message("All wxWidgets: " ${wxWidgets_LIBRARIES})
set(FOUND "false")
foreach(lib ${wxWidgets_LIBRARIES})
string(FIND ${lib} "optimized" INDEX)
string(FIND ${lib} "debug" INDEX2)
string(FIND ${lib} "wxWidgets" INDEX3)
if (INDEX GREATER_EQUAL 0) # skip once
set(FOUND "true")
continue()
elseif((INDEX2 LESS 0) AND (INDEX3 LESS 0))
set(FOUND "true")
endif()
if (${FOUND} STREQUAL "true")
set(FOUND "false")
# message("lib: ${lib}")
list(APPEND WX_LIBS_LIST ${lib})
endif()
endforeach()

list(JOIN WX_LIBS_LIST ";" WX_LIBS)
# message("Link Libraries for lk_sandbox: ${WX_LIBS}")
target_link_libraries(lk_sandbox lk ${WX_LIBS})

endif()
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2017, 2022 Alliance for Sustainable Energy, LLC
Copyright (c) 2017, 2022 Alliance for Energy Innovation, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LK
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

LK is a scripting language originally developed for the National Renewable Energy Laboratory's [System Advisor Model™ (SAM™)](https://sam.nrel.gov). LK is designed to be small, fast, and easily embedded in other applications, and provides a way for users to to extend an application's built-in functionality.
LK is a scripting language originally developed for the National Laboratory of the Rockies' [System Advisor Model™ (SAM™)](https://sam.nrel.gov). LK is designed to be small, fast, and easily embedded in other applications, and provides a way for users to to extend an application's built-in functionality.

This repository contains a cross-platform standard library of function calls and core LK engine, which includes a lexical analyzer, parser, compiler, and virtual machine. It comprises roughly 7000 lines of ISO-standard C++ code, and is only dependent on the Standard C++ Library (STL), making LK extremely tight and portable to various platforms. LK also provides a C language API for writing extensions that can be dynamically loaded at runtime.

Expand Down
2 changes: 1 addition & 1 deletion doc/html/absyn_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/codegen_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/env_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/eval_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/invoke_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/lex_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/md__c_1__projects_lk__l_i_c_e_n_s_e.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<div class="title">LICENSE </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>LK, Copyright (c) 2008-2017, Alliance for Sustainable Energy, LLC. All rights reserved.</p>
<div class="textblock"><p>LK, Copyright (c) 2008-2017, Alliance for Energy Innovation, LLC. All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<p>(1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</p>
<p>(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.</p>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/parse_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/stdlib_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/vm_8h_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/lk/absyn.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/codegen.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/env.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/eval.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/invoke.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/lex.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/parse.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/stdlib.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion include/lk/vm.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion sandbox/sandbox.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/absyn.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/env.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/eval.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/invoke.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/lex.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/parse.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/stdlib.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion src/vm.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/lk/blob/develop/LICENSE
Copyright (c) Alliance for Energy Innovation, LLC. See also https://github.com/NatLabRockies/lk/blob/develop/LICENSE

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