Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Build steps #27

Merged
merged 12 commits into from
Mar 19, 2021
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Don't track the AGF glass cat file. This can't be shipped with the release
# Don't track the AGF glass cat files. These can't be shipped with the release.
AGFGlassCat.jl
HOYA.jl
NIKON.jl
OHARA.jl
SCHOTT.jl
Sumita.jl

# Don't track sysimage file: dll on windows, so on linux
*.dll
Expand Down Expand Up @@ -44,4 +49,4 @@ docs/site/
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
Manifest.toml
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
ImageView = "86fae568-95e7-573e-a6b2-d8a6b900c9ef"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand All @@ -31,10 +32,10 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StringEncodings = "69024149-9ee7-55f6-a4c4-859efe599b68"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UrlDownload = "856ac37a-3032-4c1c-9122-f86d88358c8b"
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

Expand Down Expand Up @@ -64,6 +65,5 @@ Revise = "3.1"
StaticArrays = "1.0"
StringEncodings = "0.3"
Unitful = "1.6"
UrlDownload = "1.0"
ZipFile = "0.9"
Zygote = "0.6"
35 changes: 14 additions & 21 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,22 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE

const GLASSCAT_ROOT = joinpath(@__DIR__, "..", "src", "GlassCat")
const GLASSCAT_ROOT_DIR = joinpath(@__DIR__, "..", "src", "GlassCat")
const GLASSCAT_DATA_DIR = joinpath(GLASSCAT_ROOT_DIR, "data")
const SOURCE_DIR = joinpath("downloads", "glasscat")

const SOURCES_FILE = "sources.txt"
const GLASS_JL_FILE = "AGFGlassCat.jl"
const GLASS_JL_PATH = GLASS_JL_FILE
const DOWNLOAD_DIR = mktempdir()
const GLASS_JL_PATH = joinpath(GLASSCAT_DATA_DIR, GLASS_JL_FILE)

include(joinpath(GLASSCAT_ROOT, "GlassTypes.jl"))
include(joinpath(GLASSCAT_ROOT_DIR, "GlassTypes.jl"))
include("utils.jl")

glasspaths = [joinpath(GLASSCAT_ROOT, "OtherGlassCat.jl")]

# load all AGF files to dictionary and
# for each catalog create a module with structs containing the default values
# this is done as a string then written to a file which is then included
# download glassfiles that are easily accessed from the web so user will have some glasses to start with
downloadcatalogs(DOWNLOAD_DIR)

@info "Generating $GLASS_JL_PATH\n"
generate_cat_jl(load_glass_db(DOWNLOAD_DIR), GLASS_JL_PATH)
push!(glasspaths, GLASS_JL_PATH)
# Build a source directory using information from SOURCES_FILE
sources = [split(line, " ") for line in readlines(SOURCES_FILE)]
build_source_dir(sources, SOURCE_DIR)

# write a deps/deps.jl file that points to the generated glass cat source files
open("deps.jl", "w") do io
for glasspath in glasspaths
println(io, "include(raw\"$(joinpath(pwd(), glasspath))\")")
end
end
verified_source_names = [source[1] for source in sources]
@info "$(isfile(GLASS_JL_PATH) ? "Re-g" : "G")enerating $GLASS_JL_PATH"
@info "Using sources: $(join(verified_source_names, ", ", " and "))"
generate_agffiles(verified_source_names, SOURCE_DIR, GLASSCAT_DATA_DIR, GLASS_JL_PATH)
6 changes: 6 additions & 0 deletions deps/sources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NIKON a49714470fa875ad4fd8d11cbc0edbf1adfe877f42926d7612c1649dd9441e75 https://www.nikon.com/products/optical-glass/assets/pdf/nikon_zemax_data.zip
OHARA 0c9021bf11b8d4e660012191818685ad3110d4f9490699cabdc89aae1fd26d2e https://www.oharacorp.com/xls/OHARA_201130_CATALOG.zip
HOYA 9ca6b2bda157ba18333607f07a2af2458d7b097b86651ebb0743644b0ee96823 https://hoyaoptics.com/wp-content/uploads/2019/10/HOYA20170401.zip
SCHOTT e9aabbb8ebff116ba0c106a71afd86e72f2a397ac9bc447469129e325e795f4e https://www.schott.com/d/advanced_optics/6959f9a4-0e4f-4ef2-a302-2347468a82f5/1.31/schott-optical-glass-overview-zemax-format.zip
Sumita 6cbc566d451877e36aecd9e8be516962d8d120e70fba770c566811337aa4414d https://www.sumita-opt.co.jp/en/wp/wp-content/themes/sumita-opt-en/download-files.php files%5B%5D=zemax.agf&category=data
NHG b3db4c677b1ac67cd9cce5be2abff88d13bcf24e4349dc789b2da12fdfe1a280
Loading