diff --git a/.gitattributes b/.gitattributes index dfe0770..d5a8c65 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ # Auto detect text files and perform LF normalization * text=auto + diff --git a/.gitignore b/.gitignore index 06c43b5..c0805d4 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ [Bb]in/ [Bb]uild/ +# Bazel +bazel-* + + diff --git a/00-sample/00-clang-hello-world/engine.cpp b/00-sample/00-clang-hello-world/engine.cpp new file mode 100644 index 0000000..6ba3d11 --- /dev/null +++ b/00-sample/00-clang-hello-world/engine.cpp @@ -0,0 +1,6 @@ +#include "engine.h" + +const char *engine::get_name() +{ + return "engine"; +} \ No newline at end of file diff --git a/00-sample/00-clang-hello-world/engine.h b/00-sample/00-clang-hello-world/engine.h new file mode 100644 index 0000000..d12dd8d --- /dev/null +++ b/00-sample/00-clang-hello-world/engine.h @@ -0,0 +1,6 @@ +#pragma once + +namespace engine +{ + const char* get_name(); +} // namespace engine diff --git a/00-sample/00-clang-hello-world/main.cpp b/00-sample/00-clang-hello-world/main.cpp new file mode 100644 index 0000000..2b2b693 --- /dev/null +++ b/00-sample/00-clang-hello-world/main.cpp @@ -0,0 +1,8 @@ +#include +#include "engine.h" + +int main() +{ + printf("hello clang %s\n", engine::get_name()); + return 0; +} \ No newline at end of file diff --git a/00-sample/01-clang-static_lib/build.cmd b/00-sample/01-clang-static_lib/build.cmd new file mode 100644 index 0000000..b347463 --- /dev/null +++ b/00-sample/01-clang-static_lib/build.cmd @@ -0,0 +1,18 @@ +@echo off +setlocal + +::set variables +set cxx=clang++ +set flags=-std=c++20 +set build_dir=build + +if not exist %build_dir% mkdir %build_dir% + +echo [CLI Build] compile libraries +%cxx% %flags% -c src/engine.cpp -o %build_dir%/engine.obj + +echo [CLI Build] creating static lib +llvm-lib %build_dir%/engine.obj /OUT:"%build_dir%/engine.lib" + +echo [CLI Build] build excutable ... +%cxx% src/main.cpp -L%build_dir% -lengine -o %build_dir%/simple.exe diff --git a/00-sample/01-clang-static_lib/src/engine.cpp b/00-sample/01-clang-static_lib/src/engine.cpp new file mode 100644 index 0000000..e1ae30b --- /dev/null +++ b/00-sample/01-clang-static_lib/src/engine.cpp @@ -0,0 +1,11 @@ +#include "engine.h" + +void engine::print_all() { + std::vector strs; + strs.emplace_back("hello"); + strs.emplace_back("engine"); + + for(size_t i = 0; i < strs.size(); ++i){ + printf("name : %s\n", strs[i]); + } +} \ No newline at end of file diff --git a/00-sample/01-clang-static_lib/src/engine.h b/00-sample/01-clang-static_lib/src/engine.h new file mode 100644 index 0000000..ab38e90 --- /dev/null +++ b/00-sample/01-clang-static_lib/src/engine.h @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace engine +{ + void print_all(); +} // namespace engine diff --git a/00-sample/01-clang-static_lib/src/main.cpp b/00-sample/01-clang-static_lib/src/main.cpp new file mode 100644 index 0000000..8f26ccd --- /dev/null +++ b/00-sample/01-clang-static_lib/src/main.cpp @@ -0,0 +1,9 @@ +#include +#include "engine.h" + +int main(int args, char* argv[]) +{ + engine::print_all(); + printf("hello world\n"); + return 0; +} \ No newline at end of file diff --git a/00-sample/02-bazel-hello-world/BUILD b/00-sample/02-bazel-hello-world/BUILD new file mode 100644 index 0000000..57fb46d --- /dev/null +++ b/00-sample/02-bazel-hello-world/BUILD @@ -0,0 +1,5 @@ +cc_binary( + name = "main", + srcs = ["main.cpp"], + out = [simple.exe] +) \ No newline at end of file diff --git a/00-sample/02-bazel-hello-world/MODULE.bazel b/00-sample/02-bazel-hello-world/MODULE.bazel new file mode 100644 index 0000000..00bb183 --- /dev/null +++ b/00-sample/02-bazel-hello-world/MODULE.bazel @@ -0,0 +1,6 @@ +############################################################################### +# Bazel now uses Bzlmod by default to manage external dependencies. +# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. +# +# For more details, please check https://github.com/bazelbuild/bazel/issues/18958 +############################################################################### diff --git a/00-sample/02-bazel-hello-world/MODULE.bazel.lock b/00-sample/02-bazel-hello-world/MODULE.bazel.lock new file mode 100644 index 0000000..56c6b0f --- /dev/null +++ b/00-sample/02-bazel-hello-world/MODULE.bazel.lock @@ -0,0 +1,204 @@ +{ + "lockFileVersion": 18, + "registryFileHashes": { + "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", + "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", + "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/source.json": "9be551b8d4e3ef76875c0d744b5d6a504a27e3ae67bc6b28f46415fd2d2957da", + "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", + "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d", + "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a", + "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", + "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", + "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", + "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", + "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", + "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", + "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb", + "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/source.json": "41e9e129f80d8c8bf103a7acc337b76e54fad1214ac0a7084bf24f4cd924b8b4", + "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d", + "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", + "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", + "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f", + "https://bcr.bazel.build/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29", + "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", + "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", + "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", + "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", + "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", + "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c", + "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d", + "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df", + "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e", + "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981", + "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/source.json": "be4789e951dd5301282729fe3d4938995dc4c1a81c2ff150afc9f1b0504c6022", + "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", + "https://bcr.bazel.build/modules/re2/2023-09-01/source.json": "e044ce89c2883cd957a2969a43e79f7752f9656f6b20050b62f90ede21ec6eb4", + "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8", + "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e", + "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", + "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191", + "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", + "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", + "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/source.json": "d61627377bd7dd1da4652063e368d9366fc9a73920bfa396798ad92172cf645c", + "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e", + "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86", + "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39", + "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6", + "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31", + "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a", + "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6", + "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", + "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/8.12.0/MODULE.bazel": "8e6590b961f2defdfc2811c089c75716cb2f06c8a4edeb9a8d85eaa64ee2a761", + "https://bcr.bazel.build/modules/rules_java/8.12.0/source.json": "cbd5d55d9d38d4008a7d00bee5b5a5a4b6031fcd4a56515c9accbcd42c7be2ba", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", + "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", + "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", + "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d", + "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/source.json": "6f5f5a5a4419ae4e37c35a5bb0a6ae657ed40b7abc5a5189111b47fcebe43197", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5", + "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a", + "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1", + "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", + "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", + "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382", + "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed", + "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58", + "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7", + "https://bcr.bazel.build/modules/rules_python/0.40.0/source.json": "939d4bd2e3110f27bfb360292986bb79fd8dcefb874358ccd6cdaa7bda029320", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/source.json": "7f27af3c28037d9701487c4744b5448d26537cc66cdef0d8df7ae85411f8de95", + "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", + "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", + "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef", + "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", + "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", + "https://bcr.bazel.build/modules/stardoc/0.7.1/source.json": "b6500ffcd7b48cd72c29bb67bcac781e12701cc0d6d55d266a652583cfcdab01", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", + "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806", + "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198" + }, + "selectedYankedVersions": {}, + "moduleExtensions": { + "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { + "general": { + "bzlTransitiveDigest": "hUTp2w+RUVdL7ma5esCXZJAFnX7vLbVfLd7FwnQI6bU=", + "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_jetbrains_kotlin_git": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository", + "attributes": { + "urls": [ + "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" + ], + "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" + } + }, + "com_github_jetbrains_kotlin": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository", + "attributes": { + "git_repository_name": "com_github_jetbrains_kotlin_git", + "compiler_version": "1.9.23" + } + }, + "com_github_google_ksp": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository", + "attributes": { + "urls": [ + "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" + ], + "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", + "strip_version": "1.9.23-1.0.20" + } + }, + "com_github_pinterest_ktlint": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", + "attributes": { + "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", + "urls": [ + "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" + ], + "executable": true + } + }, + "rules_android": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + "strip_prefix": "rules_android-0.1.1", + "urls": [ + "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_kotlin+", + "bazel_tools", + "bazel_tools" + ] + ] + } + } + } +} diff --git a/00-sample/02-bazel-hello-world/WORKSPACE b/00-sample/02-bazel-hello-world/WORKSPACE new file mode 100644 index 0000000..e69de29 diff --git a/00-sample/02-bazel-hello-world/main.cpp b/00-sample/02-bazel-hello-world/main.cpp new file mode 100644 index 0000000..7f1daf6 --- /dev/null +++ b/00-sample/02-bazel-hello-world/main.cpp @@ -0,0 +1,6 @@ +#include + +int main(int args, char* argv[]){ + printf("hello world\n"); + return 0; +} \ No newline at end of file diff --git a/00-sample/02-bazel-hello-world/srcs/game/BUILD b/00-sample/02-bazel-hello-world/srcs/game/BUILD new file mode 100644 index 0000000..e69de29 diff --git a/00-sample/02-bazel-hello-world/srcs/game/game.cpp b/00-sample/02-bazel-hello-world/srcs/game/game.cpp new file mode 100644 index 0000000..b4713c1 --- /dev/null +++ b/00-sample/02-bazel-hello-world/srcs/game/game.cpp @@ -0,0 +1,6 @@ +#include "game.h" + +const char* emt::get_game_name() +{ + return "game"; +} \ No newline at end of file diff --git a/00-sample/02-bazel-hello-world/srcs/game/game.h b/00-sample/02-bazel-hello-world/srcs/game/game.h new file mode 100644 index 0000000..a6b0939 --- /dev/null +++ b/00-sample/02-bazel-hello-world/srcs/game/game.h @@ -0,0 +1,15 @@ +#pragma once + +// ███████ ███ ███ ████████ +// ██ ████ ████ ██ +// █████ ██ ████ ██ ██ +// ██ ██ ██ ██ ██ +// ███████ ██ ██ ██ +// +// EMT Engine © 2025 EMT Studios | Author: ripcode0@gmail.com +// Distributed under the MIT License: https://opensource.org/licenses/MIT + +namespace emt +{ + const char* get_game_name(); +} // namespace emt diff --git a/00-setting/clang-gnu.cmd b/00-setting/clang-gnu.cmd new file mode 100644 index 0000000..44a19ec --- /dev/null +++ b/00-setting/clang-gnu.cmd @@ -0,0 +1,2 @@ +@echo off +clang++ --target=x86_64-w64-windows-gnu %* \ No newline at end of file diff --git a/00-setting/game/game.cpp b/00-setting/game/game.cpp new file mode 100644 index 0000000..1b926fc --- /dev/null +++ b/00-setting/game/game.cpp @@ -0,0 +1,8 @@ +#include "game.h" + +namespace game +{ + const char* get_name(){ + return "game"; + } +} // namespace game diff --git a/00-setting/game/game.h b/00-setting/game/game.h new file mode 100644 index 0000000..94590c0 --- /dev/null +++ b/00-setting/game/game.h @@ -0,0 +1,6 @@ +#pragma once + +namespace game +{ + const char* get_name(); +} // namespace game diff --git a/00-setting/main.cpp b/00-setting/main.cpp index 0b957ba..2c54137 100644 --- a/00-setting/main.cpp +++ b/00-setting/main.cpp @@ -1,5 +1,6 @@ #include +#include "game/game.h" #if defined(__clang__) #define _name "__clang__" @@ -11,6 +12,6 @@ int main(int args, char *argv[]) { uintptr_t v = 100; - printf("i like %s\n", _name); + printf("i like %s and game name : %s\n", _name, game::get_name()); return 0; } \ No newline at end of file diff --git a/00-setting/main.ilk b/00-setting/main.ilk deleted file mode 100644 index e78961b..0000000 Binary files a/00-setting/main.ilk and /dev/null differ diff --git a/00-setting/main.pdb b/00-setting/main.pdb deleted file mode 100644 index 8def8e6..0000000 Binary files a/00-setting/main.pdb and /dev/null differ diff --git a/README.md b/README.md index c5213b2..f496d92 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,23 @@ ## Compiler Settings -- **[LLVM Clang](sub/llvm-clang-vscode.md)** | [Türkçe](sub/llvm-clang-vscode-tr.md) -- **[MSYS2 GCC]()** -- **[MSVC CL](sub/win-msvc.md)** - +- **[LLVM Clang - Windows](sub/llvm-clang-vscode.md)** | [Türkçe](sub/llvm-clang-vscode-tr.md) +- **[MSYS2 GCC - Windows](sub/mingw-ucrt-vscode.md)** +- **[MSVC CL - windows](sub/win-msvc.md)** + +--- +## Getting Start +- **[CMake Kits](sub/getting_start/cmake-kits.md)** +- **[CMake Variants](sub/getting_start/cmake-variants-kor.md)** +- **[hello world with Clang On CLI]()** +--- +## Trouble Shooting +- **[Running an Executable on a System Without MinGW Installed](sub/problems/system-without-mingw.md)** --- -## Compile the Code +## Build System -- **[Command Line Compilation]()** +- **[Bazel]()** - **[Compiler Options](sub/compilers_options.md)** --- @@ -35,3 +43,12 @@ - **[CMake Library Management](sub/cmake/library/cmake_library.md)** - **[CMake Presets](sub/cmake/cmake.presets.md)** - **[CMake Toolchain](sub/cmake/toolchain/cmake_toolchain.md)** + +--- + +## Compile Options + +- **[GCC/Clang](sub/compile-options/gcc-clang/compile-options.md)** + + + diff --git a/data/ninja-v1.12.1-installer.zip b/data/ninja-v1.12.1-installer.zip new file mode 100644 index 0000000..50b46e9 Binary files /dev/null and b/data/ninja-v1.12.1-installer.zip differ diff --git a/sub/build-system/bazel/bazel_basic.md b/sub/build-system/bazel/bazel_basic.md new file mode 100644 index 0000000..3ea47da --- /dev/null +++ b/sub/build-system/bazel/bazel_basic.md @@ -0,0 +1 @@ +##### \ No newline at end of file diff --git a/sub/cmake/toolchain/cmake_toolchain-kor.md b/sub/cmake/toolchain/cmake_toolchain-kor.md new file mode 100644 index 0000000..562d413 --- /dev/null +++ b/sub/cmake/toolchain/cmake_toolchain-kor.md @@ -0,0 +1,27 @@ +### CMake 툴체인 + +#### 툴체인 파일이란? + +`CMake`에서 *툴체인 파일(toolchain file)*은 빌드 환경을 사전에 정의하는 구성 스크립트입니다. +이 파일에서는 **컴파일러 경로**, **링커**, **시스템 루트**, **환경 변수** 등을 지정합니다. +이를 통해 시스템 기본 설정 대신 `LLVM`, `MinGW` 등 다양한 커스텀 툴체인을 사용하여 빌드할 수 있습니다. + +#### 툴체인 파일 수동 사용 방법 + +프로젝트를 구성할 때 툴체인 파일을 직접 지정할 수 있습니다: + +```cmd +cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=/xxx-toolchain.cmake +``` + +#### Toolchain file 을 이용 간단한 예제 +##### +```cmd +│ CMakeLists.txt +│ +├───cmake +│ clang-toolchain.cmake +│ +└───src + main.cpp +``` \ No newline at end of file diff --git a/sub/cmake/toolchain/cmake_toolchain.md b/sub/cmake/toolchain/cmake_toolchain.md index f9e4c6c..5be3d0a 100644 --- a/sub/cmake/toolchain/cmake_toolchain.md +++ b/sub/cmake/toolchain/cmake_toolchain.md @@ -1,5 +1,15 @@ -### CMake Toolchain +### CMake Toolchain -* [MSVC NMake Makefiles](msvc_nmake.md) +#### What is a Toolchain File? -[**back**](../../../README.md) +In `CMake`, a *toolchain file* is a configuration script that defines the build environment ahead of time. +It specifies the **compiler path**, **linker**, **system root**, and **environment variables**. +This enables you to build using custom toolsets like `LLVM`, `MinGW` etc or other toolchains instead of relying on the system default. + +#### Manually Using a Toolchain File + +You can manually specify a toolchain file when configuring your project: + +```bash +cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=/xxx-toolchain.cmake +``` diff --git a/sub/cmake/toolchain/msvc_nmake.md b/sub/cmake/toolchain/msvc_nmake.md index 68011b5..848a521 100644 --- a/sub/cmake/toolchain/msvc_nmake.md +++ b/sub/cmake/toolchain/msvc_nmake.md @@ -3,6 +3,7 @@ * msvc-namke-toolchain.cmake ```cmake + set(VSWHERE "C:/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe") # vswhere로 최신 Visual Studio 경로 찾기 @@ -13,14 +14,14 @@ execute_process( ) if(NOT VS_PATH) - message(FATAL_ERROR "❌ Visual Studio installation not found!") + message(FATAL_ERROR "Visual Studio installation not found!") endif() # vcvarsall.bat 실행 (환경 변수 설정) set(VCVARSALL "${VS_PATH}/VC/Auxiliary/Build/vcvarsall.bat") if(NOT EXISTS ${VCVARSALL}) - message(FATAL_ERROR "❌ vcvarsall.bat not found at: ${VCVARSALL}") + message(FATAL_ERROR "vcvarsall.bat not found at: ${VCVARSALL}") endif() # 환경 변수 설정을 위해 vcvarsall 실행 @@ -37,7 +38,7 @@ execute_process( ) if(NOT CL_PATH) - message(FATAL_ERROR "❌ cl.exe not found! Run vcvarsall.bat manually.") + message(FATAL_ERROR "cl.exe not found! Run vcvarsall.bat manually.") endif() # cl.exe 및 nmake.exe 경로 설정 @@ -63,7 +64,6 @@ set(CMAKE_NMAKE_COMPILER ${CL_PATH}) # NMake용 컴파일러 명시적 지정 message(STATUS "✔ Using cl.exe: ${CL_PATH}") message(STATUS "✔ Using nmake.exe: ${CMAKE_MAKE_PROGRAM}") message(STATUS "✔ MSVC environment initialized using ${VCVARSALL}") - ``` * CMakePresets.json diff --git a/sub/compile-options/gcc-clang/compile-coptions_kor.md b/sub/compile-options/gcc-clang/compile-coptions_kor.md new file mode 100644 index 0000000..63922e4 --- /dev/null +++ b/sub/compile-options/gcc-clang/compile-coptions_kor.md @@ -0,0 +1,143 @@ +# GCC / Clang 컴파일 옵션 +--- +#### 기본 컴파일 옵션 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-c` | 컴파일만 수행하고 링크는 하지 않음 | `.o`(오브젝트) 파일 생성 | +| `-o <파일명>` | 출력 파일 이름 지정 | 기본값: `a.out` 또는 `a.exe` | +| `-v` | 컴파일 진행 로그 출력 | 내부 명령어 확인 가능 | +| `--version` | 컴파일러 버전 정보 출력 | 버전 및 트리플 확인용 | +| `--help` | 사용 가능한 옵션 목록 출력 | Clang은 `--help-hidden`도 있음 | + +--- + +#### 최적화 옵션 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-O0` | 최적화 비활성화 | 디버깅에 적합 | +| `-O1` | 기본적인 최적화 | 컴파일 속도 빠름 | +| `-O2` | 일반적인 최적화 | 실무에서 가장 널리 사용 | +| `-O3` | 고급 최적화 | 실행 속도 향상, 바이너리 커질 수 있음 | +| `-Os` | 코드 크기 최적화 | 임베디드/저용량 목적 | +| `-Oz` | Clang 전용, 더 aggressive한 크기 최적화 | `-Os`보다 작은 출력물 | +| `-Ofast` | `-O3` + 정확성 희생 | 표준 위반 가능성 있음 | +| `-march=native` | 현재 CPU에 최적화 | 타 머신 실행 시 오류 가능 | +| `-mtune=` | 실행 성능을 특정 CPU에 맞춤 | 바이너리 호환 유지 | +| `-flto` | Link Time Optimization | 전체 프로그램 최적화 수행 | + +--- + +#### 디버깅/분석 옵션 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-g`, `-g3`, `-ggdb` | 디버깅 심볼 포함 | `-g3`은 매크로 정보 포함 | +| `-pg` | gprof용 프로파일링 정보 생성 | `gprof` 사용 시 필요 | +| `-fno-omit-frame-pointer` | 스택 추적 가능 | perf, sanitizer, gdb 등에 유용 | +| `-fsanitize=address` | 메모리 오류 검출 | 런타임에 메모리 접근 검사 | +| `-fsanitize=undefined` | 정의되지 않은 동작 검사 | shift overflow, null deref 등 | +| `-fsanitize=thread` | 데이터 레이스 탐지 | 병렬 처리 환경 필수 도구 | +| `-fstack-protector[-strong|-all]` | 스택 보호 삽입 | 보안 취약점 완화 | + +--- + +#### 표준/언어 관련 옵션 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-std=c11`, `-std=c++20` | 언어 표준 지정 | 최신 C/C++ 버전 가능 | +| `-ansi` | C89/C++98로 제한 | 구식 시스템 호환 목적 | +| `-fno-exceptions` | 예외 기능 제거 (C++) | 바이너리 크기 감소 | +| `-fno-rtti` | RTTI 제거 (C++) | 객체 타입 정보 제거 | +| `-pedantic` | 표준 위반시 경고 | 엄격한 표준 준수 검사 | +| `-fms-extensions` | MSVC 확장 허용 | Windows 이식 시 사용 | + +--- + +#### 전처리 관련 옵션 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-E` | 전처리만 수행 | 출력은 stdout | +| `-I<경로>` | 헤더 검색 경로 지정 | 상대/절대 경로 모두 가능 | +| `-isystem <경로>` | 시스템 헤더로 간주 | `-Wall` 경고 무시됨 | +| `-D<매크로>=값` | 매크로 정의 | 컴파일 시 조건부 분기 처리 | +| `-U<매크로>` | 매크로 제거 | 기존 정의 무효화 | +| `-P` | `#line` 제거 | 전처리 결과 정리용 | + +--- + +#### 아키텍처/타겟/플랫폼 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-m32`, `-m64` | 32/64비트 바이너리 생성 | 타겟 아키텍처 설정 | +| `--target=<트리플>` | Clang 크로스 컴파일용 | 예: `x86_64-w64-windows-gnu` | +| `-fPIC` | 포인터 독립 코드 | 공유 라이브러리용 필수 | +| `-fPIE`, `-pie` | PIE(위치 독립 실행 파일) 생성 | 보안용 | + +--- + +#### 출력 / 진단 관련 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-fcolor-diagnostics` | 컬러 출력 (Clang 기본값) | 오류/경고 하이라이트 | +| `-fdiagnostics-color=always` | GCC에서도 컬러 출력 | `never`, `auto` 등도 가능 | +| `-fsyntax-only` | 문법만 검사 | 빌드 시간 줄이기용 | + +--- + +#### 정적 분석 (Clang 전용) + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `--analyze` | 정적 분석 수행 | `clang-analyzer` | +| `-Xclang` | 내부 Clang 옵션 전달 | 고급 사용자용 | +| `-Rpass=...` | 최적화 로그 출력 | `inline`, `loop-vectorize` 등 | +| `-print-target-triple` | 컴파일 타겟 트리플 출력 | 크로스 컴파일 디버그용 | + +--- + +#### 기본 경고 옵션 + +| 옵션 | 설명 | 비고 | +|------|------|------| +| `-Wall` | 일반적인 경고 대부분 활성화 | 기본적으로 거의 항상 사용 | +| `-Wextra` | 추가 경고 활성화 | `-Wall`에 포함되지 않은 항목까지 | +| `-Werror` | 모든 경고를 컴파일 오류로 처리 | CI 환경 등에서 유용 | +| `-Wno-` | 특정 경고 비활성화 | 예: `-Wno-unused-variable` | +| `-W` | 특정 경고만 개별 활성화 | 예: `-Wshadow` | +| `-w` | 모든 경고 비활성화 | 비추천: 디버깅 어려워짐 | +| `-pedantic` | 표준 위반에 대해 경고 | 엄격한 C/C++ 표준 적용 | +| `-pedantic-errors` | 표준 위반 시 에러 처리 | `-Werror`와 함께 사용 가능 | + +--- + +#### 유용한 경고 옵션 모음 + +| 옵션 | 설명 | +|------|------| +| `-Wunused-variable` | 사용되지 않은 변수 경고 | +| `-Wunused-parameter` | 사용되지 않은 함수 인자 경고 | +| `-Wshadow` | 변수 그림자 경고 (지역 변수 vs 멤버 변수 등) | +| `-Wsign-compare` | 부호 있는/없는 타입 비교 경고 | +| `-Wconversion` | 암묵적 형변환 경고 | +| `-Wfloat-equal` | 부동소수점 직접 비교 경고 | +| `-Wformat` | `printf`, `scanf` 포맷 오류 | +| `-Wnull-dereference` | 널 포인터 역참조 경고 | +| `-Wswitch` | switch 문에 빠진 case 경고 | +| `-Wswitch-enum` | enum switch에 빠진 항목 경고 | +| `-Wreorder` | C++ 멤버 초기화 순서 경고 | +| `-Wimplicit-fallthrough` | switch/case fallthrough 경고 | +| `-Wuninitialized` | 초기화되지 않은 변수 사용 경고 | +| `-Wreturn-type` | 함수 리턴 타입 오류 경고 | +| `-Wmissing-braces` | 중첩 초기화 괄호 누락 경고 | +| `-Wcast-align` | 잘못된 정렬 변환 경고 | + +#### 특정 경고 무시 +```bash +clang++ main.cpp -Wall -Wextra -Wno-unused-parameter +``` \ No newline at end of file diff --git a/sub/compile-options/gcc-clang/compile-options copy 2.md b/sub/compile-options/gcc-clang/compile-options copy 2.md new file mode 100644 index 0000000..e784f81 --- /dev/null +++ b/sub/compile-options/gcc-clang/compile-options copy 2.md @@ -0,0 +1,150 @@ +## GCC / Clang Compiler Options Overview + +--- + +#### Basic Compilation Options + +| Option | Description | Notes | +|--------|-------------|-------| +| `-c` | Compile only, do not link | Generates `.o` (object) file | +| `-o ` | Specify output file name | Default is `a.out` or `a.exe` | +| `-v` | Verbose output | Shows internal toolchain commands | +| `--version` | Print compiler version info | Also displays target triple | +| `--help` | List all available options | `--help-hidden` for Clang internal flags | + +--- + +#### Optimization Options + +| Option | Description | Notes | +|--------|-------------|-------| +| `-O0` | No optimization | Best for debugging | +| `-O1` | Basic optimization | Fast compilation | +| `-O2` | General-purpose optimization | Widely used in production | +| `-O3` | Aggressive optimization | Increases performance and binary size | +| `-Os` | Optimize for size | Embedded systems / limited space | +| `-Oz` | Clang-only: maximize size reduction | Smaller than `-Os` | +| `-Ofast` | `-O3` + unsafe optimizations | May break standards compliance | +| `-march=native` | Optimize for current CPU | Binary might not run on other systems | +| `-mtune=` | Tune performance for given CPU | Maintains binary compatibility | +| `-flto` | Enable Link Time Optimization | Cross-translation-unit optimization | + +--- + +#### Debugging / Analysis Options + +| Option | Description | Notes | +|--------|-------------|-------| +| `-g`, `-g3`, `-ggdb` | Include debug symbols | `-g3` includes macros | +| `-pg` | Add gprof profiling info | Use with `gprof` | +| `-fno-omit-frame-pointer` | Retain frame pointer | Required for some profilers | +| `-fsanitize=address` | Detect memory errors | Use-after-free, buffer overflows, etc. | +| `-fsanitize=undefined` | Detect undefined behavior | e.g., invalid shifts, null derefs | +| `-fsanitize=thread` | Detect data races | For multithreaded programs | +| `-fstack-protector[-strong|-all]` | Add stack canaries | Mitigates stack buffer overflows | + +--- + +#### Language / Standard Options + +| Option | Description | Notes | +|--------|-------------|-------| +| `-std=c11`, `-std=c++20` | Specify language standard | Clang supports newest standards | +| `-ansi` | Enable ANSI mode | Equivalent to C89 / C++98 | +| `-fno-exceptions` | Disable C++ exceptions | Reduces binary size | +| `-fno-rtti` | Disable RTTI | For lightweight C++ builds | +| `-pedantic` | Warn on non-standard code | Enforces strict standard compliance | +| `-fms-extensions` | Enable MSVC compatibility | Useful for Windows ports | + +--- + +#### Preprocessor Options + +| Option | Description | Notes | +|--------|-------------|-------| +| `-E` | Run preprocessor only | Output sent to stdout | +| `-I` | Add include search path | Accepts relative or absolute path | +| `-isystem ` | Add system include path | Silences `-Wall` warnings | +| `-Dmacro=value` | Define macro | Used in conditional compilation | +| `-Umacro` | Undefine macro | Cancels predefined values | +| `-P` | Suppress `#line` output | For clean preprocessed output | + +--- + +#### Architecture / Target / Platform Options + +| Option | Description | Notes | +|--------|-------------|-------| +| `-m32`, `-m64` | Generate 32/64-bit binaries | Depends on toolchain support | +| `--target=` | Set target triple | e.g., `x86_64-w64-windows-gnu` | +| `-fPIC` | Position Independent Code | Required for shared libraries | +| `-fPIE`, `-pie` | Generate Position Independent Executables | Improves security (ASLR) | + +--- + +#### Diagnostics / Output Formatting + +| Option | Description | Notes | +|--------|-------------|-------| +| `-fcolor-diagnostics` | Enable color diagnostics | Default in Clang | +| `-fdiagnostics-color=always` | Force color output in GCC | Accepts `never`, `auto`, `always` | +| `-fsyntax-only` | Only check syntax, no compilation | Speeds up static analysis | + +--- + +#### Static Analysis (Clang Only) + +| Option | Description | Notes | +|--------|-------------|-------| +| `--analyze` | Run Clang Static Analyzer | Detects common bugs | +| `-Xclang` | Pass internal options to Clang | Advanced usage | +| `-Rpass=` | Report successful optimizations | e.g., `loop-vectorize`, `inline` | +| `-print-target-triple` | Print current target triple | Useful for debugging cross-compilation | + +--- + +#### Basic Warning Options + +| Option | Description | Notes | +|--------|-------------|-------| +| `-Wall` | Enable most common warnings | Recommended | +| `-Wextra` | Enable extra warnings | Complements `-Wall` | +| `-Werror` | Treat warnings as errors | Strict mode for CI/CD | +| `-Wno-` | Disable specific warning | e.g., `-Wno-unused-variable` | +| `-W` | Enable specific warning | e.g., `-Wshadow` | +| `-w` | Disable all warnings | Not recommended | +| `-pedantic` | Warn on all standard violations | Strict standard conformance | +| `-pedantic-errors` | Treat standard violations as errors | Similar to `-Werror` | + +--- + +#### Commonly Useful Warning Options + +| Option | Description | +|--------|-------------| +| `-Wunused-variable` | Warn about unused variables | +| `-Wunused-parameter` | Warn about unused function arguments | +| `-Wshadow` | Warn about variable shadowing | +| `-Wsign-compare` | Warn about signed/unsigned comparisons | +| `-Wconversion` | Warn about implicit type conversions | +| `-Wfloat-equal` | Warn about direct float comparisons | +| `-Wformat` | Warn about incorrect printf/scanf formats | +| `-Wnull-dereference` | Warn about null pointer usage | +| `-Wswitch` | Warn on incomplete switch statements | +| `-Wswitch-enum` | Warn if enum values not fully handled | +| `-Wreorder` | Warn on C++ member initializer order | +| `-Wimplicit-fallthrough` | Warn on case fallthrough | +| `-Wuninitialized` | Warn about uninitialized variables | +| `-Wreturn-type` | Warn if return types are missing | +| `-Wmissing-braces` | Warn on missing initializer braces | +| `-Wcast-align` | Warn on potentially unsafe cast alignments | + +--- + +#### Example: Suppress a Specific Warning + +```bash +clang++ main.cpp -Wall -Wextra -Wno-unused-parameter +``` + +[Back To Main](../../../README.md) \ No newline at end of file diff --git a/sub/compile-options/gcc-clang/compile-options copy.md b/sub/compile-options/gcc-clang/compile-options copy.md new file mode 100644 index 0000000..044c34c --- /dev/null +++ b/sub/compile-options/gcc-clang/compile-options copy.md @@ -0,0 +1,91 @@ +# GCC / Clang Compiler Options Overview + +| Flag | Description | Notes | +|--------|-------------|-------| +| **Basic Compilation Options** ||| +| `-c` | Compile only, do not link | Generates `.o` file | +| `-o ` | Specify output file name | Default: `a.out` / `a.exe` | +| `-v` | Verbose output | Shows internal toolchain commands | +| `--version` | Print compiler version info | Includes target triple | +| `--help` | List options | `--help-hidden` for Clang internals | +| **Optimization Options** ||| +| `-O0` | No optimization | Best for debugging | +| `-O1` | Basic optimization | Fast compile time | +| `-O2` | General optimization | Common in production | +| `-O3` | Aggressive optimization | Larger, faster binaries | +| `-Os` | Optimize for size | Ideal for embedded | +| `-Oz` | Clang-only: maximize size reduction | Smaller than `-Os` | +| `-Ofast` | `-O3` + unsafe optimizations | May break standard compliance | +| `-march=native` | Optimize for current CPU | Not portable | +| `-mtune=` | Tune for CPU, keep compatibility | Performance hint | +| `-flto` | Link Time Optimization | Cross-TU optimization | +| ** Debugging / Analysis Options** ||| +| `-g`, `-g3`, `-ggdb` | Include debug symbols | `-g3` includes macros | +| `-pg` | gprof profiling info | Used with `gprof` | +| `-fno-omit-frame-pointer` | Retain frame pointer | Needed by some profilers | +| `-fsanitize=address` | Detect memory errors | e.g., use-after-free | +| `-fsanitize=undefined` | Detect UB | null deref, etc. | +| `-fsanitize=thread` | Detect data races | For multithreading | +| `-fstack-protector`, `-strong`, `-all` | Stack canaries | Overflow protection | +| **Language / Standard Options** ||| +| `-std=c11`, `-std=c++20` | Specify standard | Clang has latest | +| `-ansi` | Enable ANSI mode | C89 / C++98 | +| `-fno-exceptions` | Disable C++ exceptions | Smaller binaries | +| `-fno-rtti` | Disable RTTI | Lightweight builds | +| `-pedantic` | Warn on non-standard code | Strict conformance | +| `-fms-extensions` | Enable MSVC compatibility | Windows porting | +| **Preprocessor Options** ||| +| `-E` | Run preprocessor only | Output to stdout | +| `-I` | Add include path | Relative/absolute | +| `-isystem ` | Add system include path | Silences `-Wall` | +| `-Dmacro=value` | Define macro | Conditional builds | +| `-Umacro` | Undefine macro | Cancel predefined | +| `-P` | Suppress `#line` in output | Clean preprocessor output | +| **Architecture / Target / Platform Options** ||| +| `-m32`, `-m64` | Generate 32/64-bit code | Depends on toolchain | +| `--target=` | Set target triple | e.g., `x86_64-linux-gnu` | +| `-fPIC` | Position Independent Code | Required for shared libs | +| `-fPIE`, `-pie` | PIE executables | Enables ASLR | +| **Diagnostics / Formatting Options** ||| +| `-fcolor-diagnostics` | Enable color output | Default in Clang | +| `-fdiagnostics-color=always` | Force color (GCC) | Use with `auto`, `never` | +| `-fsyntax-only` | Check syntax only | No output | +| **Static Analysis (Clang Only)** ||| +| `--analyze` | Clang static analyzer | Bug detection | +| `-Xclang` | Pass Clang internal options | Advanced | +| `-Rpass=` | Report optimizations | e.g., `inline` | +| `-print-target-triple` | Show current target triple | Useful for debugging | +| **Basic Warning Options** ||| +| `-Wall` | Common warnings | Default set | +| `-Wextra` | Extra warnings | Stricter code | +| `-Werror` | Warnings = errors | Use in CI/CD | +| `-Wno-` | Disable specific warning | e.g., `-Wno-unused` | +| `-W` | Enable specific warning | e.g., `-Wshadow` | +| `-w` | Disable all warnings | Not recommended | +| `-pedantic` | Warn on standard violations | Same as above | +| `-pedantic-errors` | Violations = errors | Like `-Werror` | +| **Common Specific Warning Options** ||| +| `-Wunused-variable` | Warn on unused variables | | +| `-Wunused-parameter` | Warn on unused parameters | | +| `-Wshadow` | Warn on shadowed variables | | +| `-Wsign-compare` | Signed/unsigned comparison | | +| `-Wconversion` | Implicit type conversions | | +| `-Wfloat-equal` | Float equality | Risky comparison | +| `-Wformat` | Printf/scanf format issues | Format string bugs | +| `-Wnull-dereference` | Null pointer usage | Clang only | +| `-Wswitch` | Incomplete switch | Not all cases handled | +| `-Wswitch-enum` | All enum values handled? | | +| `-Wreorder` | Member init order mismatch | C++ only | +| `-Wimplicit-fallthrough` | Case fallthrough | Missing comment | +| `-Wuninitialized` | Uninitialized variables | Runtime bugs | +| `-Wreturn-type` | Missing return value | Common bug | +| `-Wmissing-braces` | Init braces | Struct/array init | +| `-Wcast-align` | Cast alignment risks | | + +--- + +#### Example: Suppress a Specific Warning + +```bash +clang++ main.cpp -Wall -Wextra -Wno-unused-parameter +``` \ No newline at end of file diff --git a/sub/compile-options/gcc-clang/compile-options.md b/sub/compile-options/gcc-clang/compile-options.md new file mode 100644 index 0000000..044c34c --- /dev/null +++ b/sub/compile-options/gcc-clang/compile-options.md @@ -0,0 +1,91 @@ +# GCC / Clang Compiler Options Overview + +| Flag | Description | Notes | +|--------|-------------|-------| +| **Basic Compilation Options** ||| +| `-c` | Compile only, do not link | Generates `.o` file | +| `-o ` | Specify output file name | Default: `a.out` / `a.exe` | +| `-v` | Verbose output | Shows internal toolchain commands | +| `--version` | Print compiler version info | Includes target triple | +| `--help` | List options | `--help-hidden` for Clang internals | +| **Optimization Options** ||| +| `-O0` | No optimization | Best for debugging | +| `-O1` | Basic optimization | Fast compile time | +| `-O2` | General optimization | Common in production | +| `-O3` | Aggressive optimization | Larger, faster binaries | +| `-Os` | Optimize for size | Ideal for embedded | +| `-Oz` | Clang-only: maximize size reduction | Smaller than `-Os` | +| `-Ofast` | `-O3` + unsafe optimizations | May break standard compliance | +| `-march=native` | Optimize for current CPU | Not portable | +| `-mtune=` | Tune for CPU, keep compatibility | Performance hint | +| `-flto` | Link Time Optimization | Cross-TU optimization | +| ** Debugging / Analysis Options** ||| +| `-g`, `-g3`, `-ggdb` | Include debug symbols | `-g3` includes macros | +| `-pg` | gprof profiling info | Used with `gprof` | +| `-fno-omit-frame-pointer` | Retain frame pointer | Needed by some profilers | +| `-fsanitize=address` | Detect memory errors | e.g., use-after-free | +| `-fsanitize=undefined` | Detect UB | null deref, etc. | +| `-fsanitize=thread` | Detect data races | For multithreading | +| `-fstack-protector`, `-strong`, `-all` | Stack canaries | Overflow protection | +| **Language / Standard Options** ||| +| `-std=c11`, `-std=c++20` | Specify standard | Clang has latest | +| `-ansi` | Enable ANSI mode | C89 / C++98 | +| `-fno-exceptions` | Disable C++ exceptions | Smaller binaries | +| `-fno-rtti` | Disable RTTI | Lightweight builds | +| `-pedantic` | Warn on non-standard code | Strict conformance | +| `-fms-extensions` | Enable MSVC compatibility | Windows porting | +| **Preprocessor Options** ||| +| `-E` | Run preprocessor only | Output to stdout | +| `-I` | Add include path | Relative/absolute | +| `-isystem ` | Add system include path | Silences `-Wall` | +| `-Dmacro=value` | Define macro | Conditional builds | +| `-Umacro` | Undefine macro | Cancel predefined | +| `-P` | Suppress `#line` in output | Clean preprocessor output | +| **Architecture / Target / Platform Options** ||| +| `-m32`, `-m64` | Generate 32/64-bit code | Depends on toolchain | +| `--target=` | Set target triple | e.g., `x86_64-linux-gnu` | +| `-fPIC` | Position Independent Code | Required for shared libs | +| `-fPIE`, `-pie` | PIE executables | Enables ASLR | +| **Diagnostics / Formatting Options** ||| +| `-fcolor-diagnostics` | Enable color output | Default in Clang | +| `-fdiagnostics-color=always` | Force color (GCC) | Use with `auto`, `never` | +| `-fsyntax-only` | Check syntax only | No output | +| **Static Analysis (Clang Only)** ||| +| `--analyze` | Clang static analyzer | Bug detection | +| `-Xclang` | Pass Clang internal options | Advanced | +| `-Rpass=` | Report optimizations | e.g., `inline` | +| `-print-target-triple` | Show current target triple | Useful for debugging | +| **Basic Warning Options** ||| +| `-Wall` | Common warnings | Default set | +| `-Wextra` | Extra warnings | Stricter code | +| `-Werror` | Warnings = errors | Use in CI/CD | +| `-Wno-` | Disable specific warning | e.g., `-Wno-unused` | +| `-W` | Enable specific warning | e.g., `-Wshadow` | +| `-w` | Disable all warnings | Not recommended | +| `-pedantic` | Warn on standard violations | Same as above | +| `-pedantic-errors` | Violations = errors | Like `-Werror` | +| **Common Specific Warning Options** ||| +| `-Wunused-variable` | Warn on unused variables | | +| `-Wunused-parameter` | Warn on unused parameters | | +| `-Wshadow` | Warn on shadowed variables | | +| `-Wsign-compare` | Signed/unsigned comparison | | +| `-Wconversion` | Implicit type conversions | | +| `-Wfloat-equal` | Float equality | Risky comparison | +| `-Wformat` | Printf/scanf format issues | Format string bugs | +| `-Wnull-dereference` | Null pointer usage | Clang only | +| `-Wswitch` | Incomplete switch | Not all cases handled | +| `-Wswitch-enum` | All enum values handled? | | +| `-Wreorder` | Member init order mismatch | C++ only | +| `-Wimplicit-fallthrough` | Case fallthrough | Missing comment | +| `-Wuninitialized` | Uninitialized variables | Runtime bugs | +| `-Wreturn-type` | Missing return value | Common bug | +| `-Wmissing-braces` | Init braces | Struct/array init | +| `-Wcast-align` | Cast alignment risks | | + +--- + +#### Example: Suppress a Specific Warning + +```bash +clang++ main.cpp -Wall -Wextra -Wno-unused-parameter +``` \ No newline at end of file diff --git a/sub/getting_start/cmake-kits-kor.md b/sub/getting_start/cmake-kits-kor.md new file mode 100644 index 0000000..538cf8e --- /dev/null +++ b/sub/getting_start/cmake-kits-kor.md @@ -0,0 +1,98 @@ +### CMake Kits + +**CMake Kits** 은 `VSCode` 확장인 `CMake Tools` 에서 사용되는 메타 정보로, +컴파일러 및 빌드 환경을 쉽게 전환하고 관리할 수 있도록 도와줍니다. +여러 툴체인을 사용할 때 프로젝트 간 빠르게 전환하는 데 매우 유용합니다. + +- `cmake-tools-kits.json` : `사용자(Global)` 단위 설정 +- `.vscode/CMake-Kits.json` : `프로젝트 단위(Local)` 설정 + +#### Kits 사용 방법 + +* 명령 팔레트 열기 + + `Ctrl + Shift + P`를 눌러 **명령 팔레트**를 엽니다. + +* Kit 선택하기 + * `CMake: Select a Kit` 입력 : 사용 가능한 툴체인 목록이 표시됨 + * `CMakePresets` 가 활성화되어 있으면 Kit 메뉴가 비활성화됩니다. 아래 설정으로 끌 수 있습니다 + `.vscode/setting.json` + ``` + "cmake.useCMakePresets": "never" + ``` + +* 툴체인 선택 + 원하는 컴파일러 환경 (예: Visual Studio, Clang, GCC 등)을 선택합니다. + +#### Kits 탐지 방식 + +CMake Tools는 내부적으로 다음 명령어들을 사용하여 시스템에 설치된 컴파일러 및 툴체인을 자동으로 검색합니다: + +- `which` (유닉스 계열) +- `where` (Windows) +- `vswhere` (Visual Studio 설치 탐색용) + +이를 통해 다양한 플랫폼과 컴파일러 환경에 맞는 Kits를 자동으로 스캔하고 구성할 수 있습니다. + + +#### 글로벌 kit 설정 파일 + +* `CMake Tools` 에서는 전역(Global) 및 로컬(Local) Kits 설정을 지원합니다. +* `명령 팔레트` (`Ctrl + Shift + P`)를 열고 + `CMake: Edit User-Local CMake Kits`를 입력하면 `글로벌 kit 설정 파일` 을 편집할 수 있습니다. + +* 플랫폼별 `글로벌 kit 설정 파일` 기본 위치는 다음과 같습니다: +``` +[MacOS]     /Users//.local/share/CMakeTools/cmake-tools-kits.json +[Windows]   C:\Users\\AppData\Local\CMakeTools\cmake-tools-kits.json +[Ubuntu]    /home//.local/share/CMakeTools/cmake-tools-kits.json +``` + +```json +[ + { + "name": "Clang 20.1.7 x86_64-w64-windows-gnu (clang64)", + "compilers": { + "C": "C:\\msys64\\clang64\\bin\\clang.exe", + "CXX": "C:\\msys64\\clang64\\bin\\clang++.exe" + }, + "isTrusted": true, + "environmentVariables": { + "CMT_MINGW_PATH": "C:\\msys64\\clang64\\bin", + "MSYSTEM": "CLANG64", + "MSYSTEM_PREFIX": "/clang64", + "PATH": "C:\\msys64\\clang64\\bin;C:\\msys64\\usr\\bin;${env:PATH}" + } + }, + ..etc +] +``` +#### 프로젝트 Local Kits 설정 +* `.vscode/CMake-Kits.json` 파일에 로컬 Kits 을 명시할 수 있습니다. +* 하지만 변경 후 즉시 적용되지는 않으며, 아래 순서를 따라야 적용됩니다 + * `VSCode` 재시작 + * `CMake: Select a Kit` 실행 + * 새로 정의된 Kit 목록 스캔 + +#### Local kits 을 만들어보자 +##### MSVC 예시 +* 먼저, 아래 명령어를 통해 `vcvars64.bat`의 경로를 찾습니다: +```cmd +where /R "C:\Program Files\Microsoft Visual Studio" vcvars64.bat +``` +* 찾은 경로를 .vscode/cmake-kits.json 에 다음과 같이 등록합니다 +```json +[ + { + "name": "msvc-cl", + "compilers": { + "C": "cl.exe", + "CXX": "cl.exe" + }, + "environmentSetupScript": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Auxiliary/Build/vcvars64.bat" + } +] +``` + +* environmentSetupScript는 Visual Studio 환경 변수 초기화를 위한 스크립트입니다. +* 설정 후 반드시 VSCode를 재시작하고 Kit을 다시 선택해야 적용됩니다. \ No newline at end of file diff --git a/sub/getting_start/cmake-kits.md b/sub/getting_start/cmake-kits.md new file mode 100644 index 0000000..e8342b9 --- /dev/null +++ b/sub/getting_start/cmake-kits.md @@ -0,0 +1,109 @@ +### CMake Kits + +**CMake Kits** are metadata used by the `CMake Tools` extension in `VSCode`, enabling users to easily switch and manage compiler and build environments. This is especially useful when working with multiple toolchains and switching between projects. + +- `cmake-tools-kits.json`: Global user-level configuration +- `.vscode/CMake-Kits.json`: Project-level local configuration + +#### How to Use Kits + +- Open Command Palette + + - Press `Ctrl + Shift + P` to open the **Command Palette**. + +- Select a Kit + + - Type `CMake: Select a Kit` to show the available toolchains. + - If `CMakePresets` is enabled, the Kit menu will be disabled. You can disable it with the following setting in `.vscode/settings.json`: + + ```json + "cmake.useCMakePresets": "never" + ``` + +- Choose a Toolchain + + - Select the desired compiler environment (e.g., Visual Studio, Clang, GCC). + +#### Kit Detection Method + +CMake Tools automatically scans for installed compilers and toolchains using the following commands: + +- `which` (for Unix-based systems) +- `where` (for Windows) +- `vswhere` (for detecting Visual Studio installations) + +This allows automatic detection and setup of Kits suitable for various platforms and compiler environments. + +#### Global Kit Configuration File (cmake-tools-kits.json) + +CMake Tools supports both global and local Kits configuration. + +- To edit the **global kit configuration file**, open the Command Palette (`Ctrl + Shift + P`) and run `CMake: Edit User-Local CMake Kits`. + +- Default paths for the global configuration file by platform: + +``` +[MacOS] /Users//.local/share/CMakeTools/cmake-tools-kits.json +[Windows] C:\Users\\AppData\Local\CMakeTools\cmake-tools-kits.json +[Ubuntu] /home//.local/share/CMakeTools/cmake-tools-kits.json +``` + +Example: + +```json +[ + { + "name": "Clang 20.1.7 x86_64-w64-windows-gnu (clang64)", + "compilers": { + "C": "C:\\msys64\\clang64\\bin\\clang.exe", + "CXX": "C:\\msys64\\clang64\\bin\\clang++.exe" + }, + "isTrusted": true, + "environmentVariables": { + "CMT_MINGW_PATH": "C:\\msys64\\clang64\\bin", + "MSYSTEM": "CLANG64", + "MSYSTEM_PREFIX": "/clang64", + "PATH": "C:\\msys64\\clang64\\bin;C:\\msys64\\usr\\bin;${env:PATH}" + } + } +] +``` + +#### Project Local Kits Configuration (cmake-kits.json) + +- You can define local Kits in the `.vscode/cmake-kits.json` file. +- However, changes are not applied immediately. Follow these steps: + - Restart `VSCode` + - Run `CMake: Select a Kit` + - Rescan Kits to recognize the new entry + +#### Creating Local Kits + +##### Example: MSVC + +1. Find the path to `vcvars64.bat` using: + +```cmd +where /R "C:\Program Files\Microsoft Visual Studio" vcvars64.bat +``` + +2. Register it in `.vscode/cmake-kits.json` like this: + +```json +[ + { + "name": "msvc-cl", + "compilers": { + "C": "cl.exe", + "CXX": "cl.exe" + }, + "environmentSetupScript": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Auxiliary/Build/vcvars64.bat" + } +] +``` + +- `environmentSetupScript` is a script that initializes Visual Studio's environment variables. +- You must restart VSCode and reselect the Kit after configuring this to apply changes. + +[Back](../../README.md) + diff --git a/sub/getting_start/cmake-variants-kor.md b/sub/getting_start/cmake-variants-kor.md new file mode 100644 index 0000000..0fb2bcf --- /dev/null +++ b/sub/getting_start/cmake-variants-kor.md @@ -0,0 +1,62 @@ +### CMake Variants + +### cmake-variants.json + +* 위치 :`./vscode/cmake-variants.json` +* 항목 키 + - buildTypes: 빌드 유형(디버그/릴리즈)을 정의 + - linkage: 정적/동적 링크 여부 정의 + +#### BuildTypes 설정 + +```json +{ + "buildTypes": { + "default": "Debug", + "description": "Build Type Selection", + "choices": { + "Debug": { + "short": "Debug", + "long": "Build with debuging information", + "buildType": "Debug" + }, + "Release": { + "short": "Release", + "long": "Build with optimizations", + "buildType": "Release" + } + } + } +} +``` + +* `short` : 표시되는 짧은 이름 (예: "Debug") +* `long` : 빌드 타입에 대한 설명 +* `buildType` : `CMake` 의 `CMAKE_BUILD_TYPE` 값 + +#### linkage 설정 + +```json +"linkage" : { + "default": "static", + "description" : "static libs", + "choices": + { + "static" :{ + "short" : "Static", + "long" : "build with static libaries", + "linkage" : "static" + } + } + + } +``` + +* linkage 는 빌드 시 정적 또는 동적 라이브러리 사용 여부를 제어합니다. + +#### 선택 팔레트 + +LLVM Clang + + +[Back](../../README.md) \ No newline at end of file diff --git a/sub/getting_start/llvm-clang-cli-basic.md b/sub/getting_start/llvm-clang-cli-basic.md new file mode 100644 index 0000000..2bc7fd6 --- /dev/null +++ b/sub/getting_start/llvm-clang-cli-basic.md @@ -0,0 +1,20 @@ +##### LLVM Clang Basic On CLI (Command Line Interface) + +* `타겟 트리플` 이란? + * 3가지 혹은 4가지 조합의 구성 요소로 이루어진 문자열 + * `arch-vendor-os[-abi]` 형식 + * 예 + * `x86_64-w64-windows-gnu` + * `x86_64-pc-windows-msvc` + * `aarch64-unknown-linux-gnu` +* 설치된 `Clang` 의 `타겟 트리플` 확인 + ```cmd + clang++ -v + + clang version 19.1.0 + Target: x86_64-pc-windows-msvc + Thread model: posix + InstalledDir: C:\Program Files\LLVM\bin + ``` +* 간단한 `hello wolrd` 컴파일 하기 + * `ABI` 가 `msvc` 나 `gnu` 일 경우 링커나 툴 오브젝트의 이름이 다름 \ No newline at end of file diff --git a/sub/git/git_collabo.md b/sub/git/git_collabo.md new file mode 100644 index 0000000..c8cc6f4 --- /dev/null +++ b/sub/git/git_collabo.md @@ -0,0 +1,99 @@ +## 협업 방식 개요 +유저 B는 A의 저장소를 포크(Fork) 한 후 자신의 원격 저장소에서 작업합니다. 이후 변경 사항을 A의 원격 저장소(오리지널 저장소)로 반영하려면 Pull Request(PR) 를 보내야 합니다. +A는 PR을 검토한 후 병합할 수 있습니다. + +--- +### ① 유저 A (저장소 오너) +#### 1. GitHub에서 저장소 생성 + +``` sh +git init +git add . +git commit -m "Initial commit" +git branch -M main +git remote add origin https://github.com/A/repo.git +git push -u origin main +``` + +#### 2.유저 B가 협업할 수 있도록 저장소를 공개(public)하거나 초대 + +--- + +### ② 유저 B (포크 및 로컬 클론) +#### 1. A의 저장소를 포크(Fork) + +* GitHub에서 A/repo를 포크하여 B/repo 생성됨. +#### 2. 포크한 저장소를 로컬에 클론 + +``` sh +git clone https://github.com/B/repo.git +cd repo +``` +#### 3. A의 원본 저장소를 원격 추가 (업스트림 설정) + +``` sh +git remote add upstream https://github.com/A/repo.git +git remote -v # 원격 저장소 확인 (origin: 본인 repo, upstream: A의 repo) +``` +--- +### ③ 유저 B (새 브랜치에서 작업) +#### 1. 새 브랜치 생성 및 작업 + +``` sh +git checkout -b feature-branch +# 파일 수정 +git add . +git commit -m "새 기능 추가" +``` +#### 2. 포크한 저장소(origin)로 푸시 + +``` sh +git push origin feature-branch +``` +#### 3. GitHub에서 PR 생성 + +* GitHub에서 B/repo로 이동 → "New pull request" 버튼 클릭 +* B/repo(feature-branch) → A/repo(main) 방향으로 PR 생성 +* A가 검토 후 머지할 수 있도록 PR 설명 작성 +---- +### ④ 유저 A (PR 리뷰 및 병합) +#### 1. GitHub에서 PR 확인 및 코드 리뷰 + +* 변경 사항 확인 후 코멘트 달기 또는 승인 +* 필요 시 B에게 수정 요청 (B가 로컬에서 수정 후 git push 하면 PR에 반영됨) + +#### 2. PR을 머지 + +* 문제가 없다면 "Merge pull request" 클릭하여 main 브랜치에 병합 +* 병합 후 브랜치 삭제 가능 (Delete branch) + +--- + +### ⑤ 유저 B (업스트림 변경 사항 반영) +B는 A의 저장소가 최신 상태로 유지되므로, 본인 로컬 저장소도 이를 반영해야 함. + +#### 1. 최신 코드 가져오기 + +``` sh +git checkout main +git fetch upstream +git merge upstream/main +``` + +#### 2. 포크 저장소(origin)에도 최신 코드 반영 + +```sh +git push origin main +새로운 작업을 위해 다시 브랜치 생성 +``` + +``` sh +git checkout -b another-feature +``` + +#### 3. 협업 시 주의할 점 +* PR을 자주 생성하고 작은 단위로 작업하기 (큰 기능을 한꺼번에 PR로 보내면 코드 리뷰가 어려움) +* A의 저장소에서 변경 사항이 생겼다면 B는 항상 fetch upstream 후 작업할 것 +* 같은 브랜치에서 여러 사람이 동시에 작업하지 않기 (충돌 위험) +* PR 승인 전까지 작업 브랜치는 수정 가능 (강제 푸시 시 주의!) + diff --git a/sub/git/git_collaboration.md b/sub/git/git_collaboration.md new file mode 100644 index 0000000..23b4c5a --- /dev/null +++ b/sub/git/git_collaboration.md @@ -0,0 +1,194 @@ +# 📌 GitHub 협업 가이드 (Fork 기반 & Shared Repo 기반) + +이 문서는 GitHub에서 협업하는 다양한 방법을 정리합니다. +✅ **Fork 기반 협업** +✅ **Shared Repository(공유 저장소) 기반 협업** +✅ **Git Flow 전략 적용** + +--- + +## 🔹 **1. GitHub 협업 방식 개요** +GitHub 협업 방식은 크게 **두 가지**로 나뉩니다. + +| 협업 방식 | 설명 | 사용 예시 | +|-----------|------|---------| +| **Fork 기반 협업** | 원본 저장소(A)를 포크한 후 작업, PR(Pull Request)로 반영 | 오픈소스 프로젝트, 외부 기여 | +| **Shared Repository 협업** | 같은 저장소에서 브랜치를 나눠 작업, PR 또는 직접 Merge | 팀 내 개발, 기업 프로젝트 | + +--- + +## 🔹 **2. Fork 기반 협업 (유저 A: 저장소 오너, 유저 B: 포크한 유저)** +포크 기반 협업에서는 **각자가 독립적인 저장소를 유지하면서 원본 저장소(A)로 기여**합니다. + +### 🏁 **[유저 A] 원본 저장소 생성** +```sh +git init +git add . +git commit -m "Initial commit" +git branch -M main +git remote add origin https://github.com/A/repo.git +git push -u origin main +``` + +GitHub에서 저장소를 생성 후 유저 B가 포크할 수 있도록 공개(Public) 설정 + +### 🔄 [유저 B] A의 저장소 포크 후 로컬 클론 +``` sh +# 1. 원본 저장소(A)를 포크 +# 2. 포크한 저장소를 로컬로 클론 +git clone https://github.com/B/repo.git +cd repo + +# 3. A의 원본 저장소(upstream) 추가 +git remote add upstream https://github.com/A/repo.git + +# 4. 원격 저장소 확인 (origin: 포크한 저장소, upstream: 원본 저장소) +git remote -v +``` + +### 🚀 [유저 B] 기능 개발 및 PR 생성 + +```sh +# 1. 새로운 기능을 위한 브랜치 생성 +git checkout -b feature-branch + +# 2. 코드 수정 후 커밋 +git add . +git commit -m "새 기능 추가" + +# 3. 포크한 저장소(origin)로 푸시 +git push origin feature-branch + +``` + +### 👀 [유저 A] PR 리뷰 및 병합 +* 1.GitHub에서 PR 확인 및 코드 리뷰 +* 2.PR 병합 (Merge) +```sh +git checkout main +git merge feature-branch +git push origin main +``` +* 브랜치 삭제 (필요 시) +``` sh +git branch -d feature-branch +git push origin --delete feature-branch +``` + +### 🔄 [유저 B] 원본 저장소와 동기화 +``` sh +# 1. 원본 저장소(A)의 최신 코드 가져오기 +git checkout main +git fetch upstream +git merge upstream/main + +# 2. 포크 저장소(origin)에도 최신 코드 반영 +git push origin main +``` + +### 🔹 3. Shared Repository (공유 저장소) 협업 +* 같은 저장소를 사용하는 팀원 간 협업 방법 + +🏁 브랜치 전략 + +|Branch|explation| +|----|----| +|main |안정적인 배포 버전 유지| +|develop |새로운 기능 개발을 위한 기본 브랜치| +|feature |새로운 기능 개발용 브랜치 (작업 후 develop으로 병합)| +|hotfix |긴급 버그 수정 (작업 후 main과 develop에 병합)| + + +### 🔄 협업 흐름 (기본적인 Feature Branch Workflow) +```sh +# 1. 최신 코드 가져오기 +git checkout develop +git pull origin develop + +# 2. 기능 개발 브랜치 생성 +git checkout -b feature/new-feature + +# 3. 코드 수정 후 커밋 +git add . +git commit -m "새 기능 추가" + +# 4. 원격 저장소로 푸시 +git push origin feature/new-feature + +# 5. GitHub에서 PR 생성 후 리뷰 요청 +# 6. PR이 승인되면 develop 브랜치로 병합 +``` + +### 🔹 4. Git Flow 전략 적용 +Git Flow는 브랜치를 체계적으로 관리하는 방식으로, 팀 협업에서 많이 사용됩니다. + +#### 📌 Git Flow 주요 브랜치 + +|브랜치|설명| +|---|---| +|main |배포용 브랜치| +|develop |개발 브랜치| +|feature/* |기능 개발 브랜치| +|release/* |배포 준비 브랜치| +|hotfix/* |긴급 버그 수정 브랜치| + +#### 🚀 Git Flow 협업 방식 + +``` sh +# 1. Git Flow 초기화 (처음 한 번만 실행) +git flow init + +# 2. 새로운 기능 개발 시작 +git flow feature start new-feature + +# 3. 코드 수정 후 커밋 +git add . +git commit -m "새 기능 개발" + +# 4. 기능 개발 완료 후 develop 브랜치로 병합 +git flow feature finish new-feature +``` +### 🔹 5. 전체 협업 흐름 정리 +#### ✅ Fork 기반 협업 +``` txt +┌──────────────────────────┐ +│ [user A] repos │ +│ https://github.com/A │ +└──────────────────────────┘ + (Fork) +┌──────────────────────────┐ +│ [user B] folk repos │ +│ https://github.com/B │ +└──────────────────────────┘ + (Clone) + ┌────────────────┐ + │ [local env] │ + └────────────────┘ + (작업 후 Push) +[포크 저장소(B)] → PR 요청 → [원본 저장소(A)] + +``` + +#### ✅ Shared Repository 협업 +``` plaintext +┌────────────────────────────┐ +│ [원격 저장소] GitHub │ +│ origin/main │ +└────────────────────────────┘ + ⬆️ (Push) + ┌────────────────────┐ + │ [개발자 A] │ + │ develop 브랜치 │ + └────────────────────┘ + ⬇️ (Pull) + ┌────────────────────┐ + │ [개발자 B] │ + │ develop 브랜치 │ + └────────────────────┘ + ``` + +#### 🎯 6. 협업 시 주의할 점 +✔️ PR을 작은 단위로 생성하여 리뷰를 쉽게 하자 +✔️ Merge 전 항상 최신 코드(git pull)를 가져오자 +✔️ 충돌 방지를 위해 브랜치 전략을 지키자 +✔️ 팀 내 Git 컨벤션을 정하고 따르자 diff --git a/sub/image/msys2.png b/sub/image/msys2.png new file mode 100644 index 0000000..0b2f8ed Binary files /dev/null and b/sub/image/msys2.png differ diff --git a/sub/image/select-variants.png b/sub/image/select-variants.png new file mode 100644 index 0000000..c5f9e76 Binary files /dev/null and b/sub/image/select-variants.png differ diff --git a/sub/llvm-clang-format.md b/sub/llvm-clang-format.md new file mode 100644 index 0000000..59b1e1f --- /dev/null +++ b/sub/llvm-clang-format.md @@ -0,0 +1,34 @@ +## clang-format on vscode + +#### requirement extensions + +* Clang-Format : xaver.clang-format +* YAML Languages : Support by Red Hat (optional for intelligent) + +#### intelligent auto-completion + +```json +# settings.json +{ + "editor.formatOnSave": true, + "yaml.schemas": { + "https://json.schemastore.org/clang-format": "**/.clang-format" + } +} +``` + +#### to creating default clang-format + +```bash +clang-format -style=llvm -dump-config > .clang-format +``` + +#### syntax + +* As the version has increased, most options that used to be true or false have been replaced with specific keywords. +You can refer to examples for guidance. + +```bash +clang-format -dump-config > syntax.txt +``` + diff --git a/sub/llvm-clang-vscode.md b/sub/llvm-clang-vscode.md index dbfc6f9..a71c293 100644 --- a/sub/llvm-clang-vscode.md +++ b/sub/llvm-clang-vscode.md @@ -1,31 +1,50 @@ -# Prerequisites for Using VSCode with LLVM Clang +# Setting Up LLVM Clang with VSCode LLVM Clang -## Steps to Set Up LLVM with VSCode +## [ Windows ] -#### 1. Download LLVM -1. Visit the official [LLVM releases page](https://releases.llvm.org/). -2. Select the latest release version of LLVM. -3. Download the installer (e.g., `LLVM-XX.X.X-win64.exe`). -4. Run the installer and during installation: - - **Ensure you select the option to add `LLVM` to the system path** for the current user or all users. - - Use the default installation path: `C:\Program Files\LLVM\`. +### 1. Install LLVM +* Visit the official [LLVM releases page](https://releases.llvm.org/). +* Select the latest release version of `LLVM`. +* Download the Windows Installer (e.g., `LLVM-XX.X.X-win64.exe`). +* During installation: + - Make sure check the option to add `LLVM` to the system `PATH` + - Use the default installation path `C:\Program Files\LLVM\`. -#### 2. Verify Installation -1. Open the Command Prompt (`cmd`). -2. Run the following command to check if `clang++` is accessible: +### 2. Verify Installation +* Open the Command Prompt (`cmd`). +* Run the following command to check if `clang++` is accessible: ```bash clang++ --version ``` -3. If the version information is displayed, the installation is successful. +* If version info appears, `LLVM` is installed correctly -#### 3. Set Up VSCode with CMake Tools (Optional) -1. Install the `CMake Tools` extension from the `VSCode` marketplace. -2. Open the command palette with `Ctrl + Shift + P`. -3. Select `CMake: Select a Kit`. -4. If `LLVM-Clang` appears in the list of kits, the setup is complete. +### 3. Set Up VSCode with CMake Tools (Optional) +* Install the `CMake Tools` extension from the `VSCode` marketplace. +* Open the command palette with `Ctrl + Shift + P`. +* Select `CMake: Select a Kit`. +* If `LLVM-Clang` appears in the list of kits, the setup is complete. -#### 4. Install Ninja for Build System Support (Optional) -1. Download the latest Ninja build from [Ninja Releases](https://github.com/ninja-build/ninja/releases). -2. `ninja.exe` and place the contents into the `C:\Program Files\LLVM\bin` directory where `LLVM` is installed. +### 4. Install Ninja Build System (Optional) +##### (Several ways to install Ninja) +* Download the official latest `Ninja` : [Ninja Releases](https://github.com/ninja-build/ninja/releases) + * `ninja.exe` and place the contents into the `PATH` environment variables directory + * recommandation `PATH` environment variables + `C:\Program Files (x86)\Ninja` + `C:\Program Files\LLVM\bin` +* Python + * The environment variable is set to + `C:\Users\\AppData\Local\Programs\Python\Python313\Scripts` + ```cmd + python -m pip install ninja + ``` + +* Installer : [Ninja-v1.12.1-Installer](https://github.com/ripcode0/Build-System-Essentials/raw/refs/heads/main/data/ninja-v1.12.1-installer.zip) + * It is automatically installed to `C:\Program Files (x86)\Ninja` and the environment variable is registered. +* Verify Installation + ```cmd + ninja --version + where ninja + ``` +[Back to Main](../README.md) \ No newline at end of file diff --git a/sub/mingw-ucrt-vscode.md b/sub/mingw-ucrt-vscode.md new file mode 100644 index 0000000..7e03d53 --- /dev/null +++ b/sub/mingw-ucrt-vscode.md @@ -0,0 +1,33 @@ +# Setting Up MSYS2 MinGW with VSCode + +MSYS2 Logo + +## [ Windows ] + +### 1. Install MSYS2 +* Downloading Official installer [msys2-x86_64-installer.exe](https://github.com/msys2/msys2-installer/releases/download/2025-06-22/msys2-x86_64-20250622.exe) +* During installation: + - Use the default installation path `C:\msys64`. + - in Finished section check the "Run MSYS2 now." +* MSYS2 turminal is ready +```bash +pacman -S mingw-w64-ucrt-x86_64-gcc +pacman -S mingw-w64-ucrt-x86_64-gdb +``` + +### 2. Add the Environment Variables +* Press `Win + R` to open the Run dialog. +* Type the following command with double quotes and press Enter: + ```bash + SystemPropertiesAdvanced.exe + ``` +* This will directly open the Advanced tab of the System Properties window, where you can click the `Environment Variables...` button. + + - Add `Path` `C:\msys64\ucrt64\bin` +* Verify Installation + ```cmd + where gcc + gcc --version + ``` + +[Back To Main](../README.md) \ No newline at end of file diff --git a/sub/problems/system-without-mingw-kor.md b/sub/problems/system-without-mingw-kor.md new file mode 100644 index 0000000..3ea2531 --- /dev/null +++ b/sub/problems/system-without-mingw-kor.md @@ -0,0 +1,26 @@ +#### MinGW가 설치되지 않은 PC에서 실행 파일 실행하기 + +* MinGW로 빌드한 실행 파일(simple.exe)은 다른 PC에서 실행하려면 필요한 DLL 파일도 함께 있어야 합니다. +* simple.exe 에 사용된 DLL 리스트 추출 +```cmd +objdump -p simple.exe | findstr "DLL" +``` +```yaml + DLL Name: libgcc_s_seh-1.dll + DLL Name: KERNEL32.dll + DLL Name: api-ms-win-crt-convert-l1-1-0.dll + ... + DLL Name: libstdc++-6.dll +``` +* `KERNEL32.dll`, `api-ms-win-crt-*.dll` + - Windows 10 이상에서는 기본 제공, 따로 복사할 필요 없음 +* `libgcc_s_seh-1.dll` `libstdc++-6.dll` + - 반드시 실행 파일과 같은 폴더에 복사해서 배포 +* 필요한 경우 `libwinpthread-1.dll` 도 함께 포함 +```cmd +build/ +├── simple.exe +├── libgcc_s_seh-1.dll +├── libstdc++-6.dll +├── libwinpthread-1.dll (필요시) +``` \ No newline at end of file diff --git a/sub/problems/system-without-mingw.md b/sub/problems/system-without-mingw.md new file mode 100644 index 0000000..0c0db4b --- /dev/null +++ b/sub/problems/system-without-mingw.md @@ -0,0 +1,28 @@ +#### Running an Executable on a System Without MinGW Installed + +* If you built an executable `simple.exe` using `MinGW`, you must include the required `DLL` files to run it on a system that doesn't have MinGW installed. +* To check which `DLLs` `simple.exe` depends on, run: +```cmd +objdump -p simple.exe | findstr "DLL" +``` +```yaml + DLL Name: libgcc_s_seh-1.dll + DLL Name: KERNEL32.dll + DLL Name: api-ms-win-crt-convert-l1-1-0.dll + ... + DLL Name: libstdc++-6.dll +``` +* `KERNEL32.dll`, `api-ms-win-crt-*.dll` + - These are built into **Windows 10 and later**, so you do not need to copy them. +* `libgcc_s_seh-1.dll` `libstdc++-6.dll` + - You **must** copy these to the same folder as the executable. +* Include `libwinpthread-1.dll` as well if needed. +```cmd +build/ +├── simple.exe +├── libgcc_s_seh-1.dll +├── libstdc++-6.dll +├── libwinpthread-1.dll (if needed) +``` + +[Back](../../README.md) \ No newline at end of file diff --git a/sub/win-msvc.md b/sub/win-msvc.md index 1e652f6..ef89b10 100644 --- a/sub/win-msvc.md +++ b/sub/win-msvc.md @@ -5,15 +5,26 @@ ## Steps to Set Up MSVC with VSCode * If `visual studio` is installed already, you can skip the installation step --- -#### 1. Download MSVC +### 1. Download MSVC 1. Visit the official [visual studio releases page](https://visualstudio.microsoft.com/ko/downloads/). 2. Select the latest release version of visual studio. 3. Download the installer (e.g., `VisualStudioSetup.exe`). --- -#### 2. Verify Installation +### Use The **Kits** On VSCode +* the finding visuall studio development command prompt +```cmd +where /R "C:\Program Files\Microsoft Visual Studio" VsDevCmd.bat +``` +* apear the `VsDevCmd.bat` path +``` +C:\Program Files\Microsoft Visual Studio\...\Common7\Tools\VsDevCmd.bat +``` + +--- +### 2. Verify Installation 1. in the vscode ctrl + shift + p open the pallete 2. choose the c/c++ `Open the Workspace setting` -2. Add the following configuration to your `setting.json` file : +3. Add the following configuration to your `setting.json` file : ```json { //Adjust the settings to match the installed VS version @@ -36,13 +47,10 @@ where cl.exe //to get locate cl.exe cl.exe //to get version ``` --- -#### 3. Set Up VSCode with CMake Tools (Optional) +### 3. Set Up VSCode with CMake Tools (Optional) 1. Install the `CMake Tools` extension from the `VSCode` marketplace. 2. Open the command palette with `Ctrl + Shift + P`. 3. Choose a kit that includes the MSVC toolset (e.g., Visual Studio ...). 4. If the kit is detected, your setup is complete. ---- -#### 4. Using the `NMAKE` ---- -* [__declspec](msvc/declspec.md) \ No newline at end of file +[Back To Main](../README.md) \ No newline at end of file diff --git a/update-git.cmd b/update-git.cmd index fff313c..11e2ead 100644 --- a/update-git.cmd +++ b/update-git.cmd @@ -3,4 +3,4 @@ git add . git commit -m "updated" git status -git push origin dev +git push --all diff --git a/where b/where new file mode 100644 index 0000000..e69de29