{"id":2693,"date":"2020-06-29T16:32:26","date_gmt":"2020-06-29T07:32:26","guid":{"rendered":"https:\/\/julialang.kr\/?p=2693"},"modified":"2020-06-29T16:55:14","modified_gmt":"2020-06-29T07:55:14","slug":"julia-julia-project-creation-with-pkgtemplates-package","status":"publish","type":"post","link":"https:\/\/julialang.kr\/?p=2693","title":{"rendered":"[Julia] Julia project creation with PkgTemplates package and executable file creation example"},"content":{"rendered":"\n<p>PkgTemplates\ub294 Julia\uc5d0\uc11c project  \uc27d\uac8c \uc0dd\uc131\ud558\ub294 \uac83\uc744 \ub3c4\uc640 \uc8fc\ub294 \ud328\ud0a4\uc9c0 \uc774\ub2e4.<\/p>\n\n\n\n<p>\uc544\ub798 \uc608\uc5d0\uc11c  \/home\/shpark\/julia_test \uc544\ub798 myApp3 \ub77c\ub294 \ud328\ud0a4\uc9c0\ub97c \ub9cc\ub4dc\ub294 \ubc95\uc744 \ubcf4\uc5ec \uc900\ub2e4<\/p>\n\n\n\n<p><br>\uc124\uce58\uc640 \uc0ac\uc6a9\ubc95\uc740 \uc544\ub798\uc640 \uac19\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>julia>]\npkg> add PkgTemplates\njulia> using PkgTemplates\n\n# user : \uc6d0\ud558\ub294 \uc544\ubb34 \uc774\ub984\uc73c\ub85c (\ud544\uc218)\n# dir  : \ud504\ub85c\uc81d\ud2b8 \ud3f4\ub354\ub97c \ub9cc\ub4e4 \uc0c1\uc704 \ud3f4\ub354\ub97c \uc9c0\uc815\n#       \uc544\ub798\uc5d0\uc11c\ub294 \"\/home\/shpark\/julia_test\" \ud3f4\ub354 \uc544\ub798 \"MyApp3\" \ud504\ub85c\uc81d\ud2b8 \ud3f4\ub354\uac00 \uc0dd\uae34\ub2e4.\n# Template(;user=\"kpop\",dir=\"\/home\/shpark\/julia_test\")(\"MyApp3\")\ub85c\ub3c4 \uc0ac\uc6a9 \uac00\ub2a5\n\njulia> t = Template(;user=\"kpop\",dir=\"\/home\/shpark\/julia_test\")\njulia> t(\"MyApp3\")\n# \uc704\uc640 \uac19\uc774 \ud558\uba74 \ub77c\uc560 \ucc98\ub7fc julia \ud504\ub85c\uc81d\ud2b8\uac00 \uc0dd\uc131\ub418\uace0 \ud544\uc694\ud55c \ud30c\uc77c\ub4e4\uc744 \uc790\ub3d9\uc73c\ub85c \uc0dd\uc131 \ud55c\ub2e4.\n\n\nMyApp3\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 Manifest.toml\n\u251c\u2500\u2500 Project.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 src\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 MyApp3.jl\n\u2514\u2500\u2500 test\n    \u2514\u2500\u2500 runtests.jl\n\n# Julia\uc5d0\uc11c \uc704\uc5d0\uc11c \uc0dd\uc131\ud55c \ud504\ub85c\uc81d\ud2b8 \ud3f4\ub354\ub97c \uc9c0\uc815\ud558\uba74 julia\uc5d0\uc11c \ud504\ub85c\uc81d\ud2b8\ub97c \uc0ac\uc6a9 \ud560 \uc218 \uc788\ub2e4.\n# package\ub97c \ucd94\uac00 \ud558\uba74 Project.toml\uc5d0 \uc790\ub3d9\uc73c\ub85c \ucd94\uac00 \ub41c\ub2e4.\n$ julia -q\njulia> ]\npkg> activate \/home\/shpark\/julia_test\/MyApp3\n(MyApp3) pkg> add Plots<\/code><\/pre>\n\n\n\n<p>\uc774\uc804 \uae00\uc5d0\uc11c \uc2e4\ud589 \ud30c\uc77c \ub9cc\ub4dc\ub294 \ubc95\uc744 \uac8c\uc2dc \ud588\ub294\ub370  \uc704\uc758 \ud504\ub85c\uc81d\ud2b8\ub97c \uc0ac\uc6a9\ud574\uc11c \ub2e4\uc2dc \uad6c\uc131 \ud574\ubcf4\uc790<br>\ucc38\uc870 :  <a rel=\"noreferrer noopener\" aria-label=\" (\uc0c8\ud0ed\uc73c\ub85c \uc5f4\uae30)\" href=\"https:\/\/julialang.kr\/?p=2661\" target=\"_blank\">https:\/\/julialang.kr\/?p=2661<\/a> <br>\ub2e8 \uc774\ubc88 \uc608\uc81c\ub294 Plots package\uc758 plot\uc744 \uc0ac\uc6a9\ud55c\ub2e4.<br>compile\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud0dc\uc5d0\uc11c using Plots \uc2dc\uc5d0 5.958146 \ucd08 \uc815\ub3c4 \uac78\ub9ac\uba70 plot \ud638\ucd9c\uc2dc 6\ucd08 \uc815\ub3c4 \uac78\ub9b0\ub2e4.  plot, display\uae4c\uc9c0 \ud638\ucd9c\ud558\uba74 14\ucd08 \uc815\ub3c4 \uac78\ub9b0\ub2e4.<br>\uc2e4\ud589\ud30c\uc77c\uc744 \uad6c\uc131\ud558\uc5ec \uc2e4\ud589\uc2dc using Plots \ub294 0.001\ucd08 \ubbf8\ub9cc , plot \ud638\ucd9c\uc740 0.01\ucd08 \uc815\ub3c4 \uac78\ub9ac\uace0 , plot\uacfc display\uae4c\uc9c0 \ud638\ucd9c\ud558\uba74 2.4\ucd08 \uc815\ub3c4 \uac78\ub9b0\ub2e4.<\/p>\n\n\n\n<p>\uc2e4\ud589\ud30c\uc77c \ub9cc\ub4e4\uae30<\/p>\n\n\n\n<p>MyApp3.jl \uc18c\uc2a4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>module MyApp3\n@time using Plots\n\nfunction julia_main()::Cint\n    try\n        real_main()\n    catch\n        Base.invokelatest(Base.display_error,\n            Base.catch_stack())\n        return 1\n    end\n    return 0\nend\n\nfunction real_main()\n    # \uc678\ubd80 \uc785\ub825 \ud30c\ub77c\ubbf8\ud130\uac00 \ud544\uc694\ud558\uba74\n    # ARGS\ub97c \uc0ac\uc6a9\ud558\uba74 \ub428\n    @time begin\n        p = plot(rand(5), rand(5))\n        display(p)\n    end\n    readline()\nend\n\nif abspath(PROGRAM_FILE) == @__FILE__\n    real_main()\nend\n\nend # Module<\/code><\/pre>\n\n\n\n<p>precompile_app.jl<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using MyApp3\npush!(ARGS,\"\")\nMyApp3.julia_main()<\/code><\/pre>\n\n\n\n<p>\uc2e4\ud589\ud30c\uc77c \ub9cc\ub4e4\uae30<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>julia> using PackageCompiler\njulia> create_app(\"\/home\/shpark\/julia_test\/MyApp3\",\"\/home\/shpark\/julia_test\/MyApp3\/build\",precompile_execution_file=\"\/home\/shpark\/julia_test\/MyApp3\/precompile_app.jl\",force=true)<\/code><\/pre>\n\n\n\n<p>\uc2e4\ud589\uacb0\uacfc<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/julialang.kr\/wp-content\/uploads\/2020\/06\/image-1.png\" alt=\"\" class=\"wp-image-2695\" width=\"602\" height=\"453\" srcset=\"https:\/\/julialang.kr\/wp-content\/uploads\/2020\/06\/image-1.png 810w, https:\/\/julialang.kr\/wp-content\/uploads\/2020\/06\/image-1-300x226.png 300w, https:\/\/julialang.kr\/wp-content\/uploads\/2020\/06\/image-1-768x577.png 768w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p>MyApp3.so\ub97c \uc9c1\uc811 \ud638\ucd9c\ud574\uc11c \uc131\ub2a5 \uc0b4\ud3b4 \ubcf4\uae30<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cd \/home\/shpark\/julia_test\/MyApp3\/build\/bin\n$ julia -q -JMyApp3.so\njulia> @time using Plots\n  0.000650 seconds (1.95 k allocations: 98.203 KiB)\n\njulia> @time plot(rand(5), rand(5))\n  0.001040 seconds (2.23 k allocations: 148.398 KiB)\n\njulia> @time (p = plot(rand(5), rand(5)); display(p))\n  2.461515 seconds (96.80 k allocations: 4.867 MiB)<\/code><\/pre>\n\n\n\n<p>MyApp3.so \ub97c \uc0ac\uc6a9 \uc5c6\uc774 julia\uc5d0\uc11c \uc2e4\ud589 \ud55c \uacbd\uc6b0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cd \/home\/shpark\/julia_test\/MyApp3\/build\/bin\n$ julia -q\njulia> @time using Plots\n  6.006328 seconds (8.12 M allocations: 489.579 MiB, 1.48% gc time)\n\njulia> @time plot(rand(5), rand(5))\n  5.869596 seconds (9.80 M allocations: 489.327 MiB, 4.59% gc time)\n\n# plot\uacfc display\ub97c \uac19\uc774 \ud638\ucd9c \ud558\uae30 \uc704\ud574 julia\ub97c \ub2e4\uc2dc \uc2e4\ud589\ud55c\ub2e4.\n# \uc704\uc5d0 plot \uc2e4\ud589\uc73c\ub85c plot\uc774 \uc774\ubbf8 \ucef4\ud30c\uc77c \ub418\uc5c8\uae30 \ub54c\ubb38\uc5d0\njulia> exit()\n$ julia -q\njulia> using Plots\njulia> @time (p = plot(rand(5), rand(5)); display(p))\n  14.251147 seconds (17.86 M allocations: 893.889 MiB, 1.43% gc time)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PkgTemplates\ub294 Julia\uc5d0\uc11c project \uc27d\uac8c \uc0dd\uc131\ud558\ub294 \uac83\uc744 \ub3c4\uc640 \uc8fc\ub294 \ud328\ud0a4\uc9c0 \uc774\ub2e4. \uc544\ub798 \uc608\uc5d0\uc11c \/home\/shpark\/julia_test \uc544\ub798 myApp3 \ub77c\ub294 \ud328\ud0a4\uc9c0\ub97c \ub9cc\ub4dc\ub294 \ubc95\uc744 \ubcf4\uc5ec \uc900\ub2e4 \uc124\uce58\uc640 \uc0ac\uc6a9\ubc95\uc740 \uc544\ub798\uc640 \uac19\ub2e4. \uc774\uc804 \uae00\uc5d0\uc11c \uc2e4\ud589 \ud30c\uc77c \ub9cc\ub4dc\ub294 \ubc95\uc744 \uac8c\uc2dc \ud588\ub294\ub370 \uc704\uc758 \ud504\ub85c\uc81d\ud2b8\ub97c \uc0ac\uc6a9\ud574\uc11c \ub2e4\uc2dc \uad6c\uc131 \ud574\ubcf4\uc790\ucc38\uc870 : https:\/\/julialang.kr\/?p=2661 \ub2e8 \uc774\ubc88 \uc608\uc81c\ub294 Plots package\uc758 plot\uc744 \uc0ac\uc6a9\ud55c\ub2e4.compile\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud0dc\uc5d0\uc11c using Plots \uc2dc\uc5d0 5.958146 \ucd08 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[24],"tags":[36,39,38,37],"_links":{"self":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts\/2693"}],"collection":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2693"}],"version-history":[{"count":5,"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts\/2693\/revisions"}],"predecessor-version":[{"id":2702,"href":"https:\/\/julialang.kr\/index.php?rest_route=\/wp\/v2\/posts\/2693\/revisions\/2702"}],"wp:attachment":[{"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/julialang.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}