{"id":2255,"date":"2019-10-01T09:10:57","date_gmt":"2019-10-01T06:10:57","guid":{"rendered":"http:\/\/demensdeum.com\/blog\/?p=2255"},"modified":"2024-12-16T22:32:34","modified_gmt":"2024-12-16T19:32:34","slug":"shared-library-cmake-c","status":"publish","type":"post","link":"https:\/\/demensdeum.com\/blog\/ja\/2019\/10\/01\/shared-library-cmake-c\/","title":{"rendered":"\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea CMake C++"},"content":{"rendered":"<p>\u79c1\u306f\u6700\u8fd1\u3001FlameSteelFramework \u306e\u3059\u3079\u3066\u306e\u90e8\u5206\u3092\u500b\u5225\u306e\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u6b21\u306b\u3001<a href=\"https:\/\/gitlab.com\/demensdeum\/FlameSteelCore\" target=\" \u306e CMakeLists.txt \u30d5\u30a1\u30a4\u30eb\u306e\u4f8b\u3092\u793a\u3057\u307e\u3059\u3002 _blank\" rel=\"noopener noreferrer\"> FlameSteelCore<\/a>:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>cmake_minimum_required(VERSION 3.5)\n\nproject (FlameSteelCore)\nset(CMAKE_BUILD_TYPE Release)\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR}\/src)\n\nfile(GLOB_RECURSE SOURCE_FILES\n    \"src\/FlameSteelCore\/*.cpp\"\n)\n\nadd_library(FlameSteelCore SHARED ${SOURCE_FILES})\n\ninstall(DIRECTORY \"${CMAKE_SOURCE_DIR}\/src\/FlameSteelCore\"\n        DESTINATION include\/FlameSteelFramework\n        FILES_MATCHING\n        PATTERN \"*.h\"\n)\n\ninstall(TARGETS FlameSteelCore DESTINATION lib)\n<\/code><\/pre>\n<\/div>\n<p>CMake \u304c\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9: *.cpp \u62e1\u5f35\u5b50\u3092\u6301\u3064\u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u3092 src\/FlameSteelCore\/ \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u53ce\u96c6\u3057\u3001*.h \u62e1\u5f35\u5b50\u3092\u6301\u3064\u3059\u3079\u3066\u306e\u30d8\u30c3\u30c0\u30fc\u3092 src\/FlameSteelCore \u304b\u3089 include\/FlameSteelFramework \u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059 (\u79c1\u306e\u5834\u5408)\u3053\u308c\u306f \/usr\/local\/include\/FlameSteelFramework)\u3001\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u3092 lib \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059(\/usr\/local\/lib)<br \/>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u3001LD \u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u66f4\u65b0\u304c\u5fc5\u8981\u306b\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002 sudo ldconfig\u3002<br \/>Ubuntu \u3067\u30d3\u30eb\u30c9\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306b\u306f (\u6b63\u3057\u3044\u30d3\u30eb\u30c9 \u30c4\u30fc\u30eb\u30c1\u30a7\u30fc\u30f3\u304c\u3042\u308b\u5834\u5408)\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>cmake . && make && sudo make install\n<\/code><\/pre>\n<\/div>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb \u30d7\u30ed\u30bb\u30b9\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u3001make \u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u3092\u30ed\u30fc\u30ab\u30eb \u30d5\u30a9\u30eb\u30c0\u30fc makeInstallTestPlayground \u306b\u6e21\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-unknown\" data-lang=\"unknown\"><code>cmake -DCMAKE_INSTALL_PREFIX:PATH=\/home\/demensdeum\/makeInstallTestPlayground . && make && make install\n<\/code><\/pre>\n<\/div>\n<h3>\u53c2\u8003\u6587\u732e<\/h3>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/17511496\/how-to-create-a-shared-library-with-cmake\" target=\"_blank\" rel=\"noopener noreferrer\">https: \/\/stackoverflow.com\/questions\/17511496\/how-to-create-a-shared-library-with-cmake<\/a><br \/><a href=\"https:\/\/stackoverflow.com\/questions\/6003374\/what-is-cmake-equivalent-of-configure-prefix-dir-make-all-install\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/stackoverflow.com\/questions\/6003374\/what-is-cmake-equivalent-of-configure-prefix-dir-make-all-install<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u79c1\u306f\u6700\u8fd1\u3001FlameSteelFramework \u306e\u3059\u3079\u3066\u306e\u90e8\u5206\u3092\u500b\u5225\u306e\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u6b21\u306b\u3001 FlameSteelCore: cmake_minimum_required(VERSION 3.5) project (FlameSteelCore) set(CMAKE_BUILD_TYPE Release) include_directories(${CMAKE_CURRENT_SOURCE_DIR}\/src) file(GLOB_RECURSE SOURCE_FILES &#8220;src\/FlameSteelCore\/*.cpp&#8221; ) add_library(FlameSteelCore SHARED ${SOURCE_FILES}) install(DIRECTORY &#8220;${CMAKE_SOURCE_DIR}\/src\/FlameSteelCore&#8221; DESTINATION include\/FlameSteelFramework FILES_MATCHING PATTERN &#8220;*.h&#8221; ) install(TARGETS FlameSteelCore DESTINATION lib) CMake \u304c\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9: *.cpp \u62e1\u5f35\u5b50\u3092\u6301\u3064\u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u3092 src\/FlameSteelCore\/ \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u53ce\u96c6\u3057\u3001*.h \u62e1\u5f35\u5b50\u3092\u6301\u3064\u3059\u3079\u3066\u306e\u30d8\u30c3\u30c0\u30fc\u3092 src\/FlameSteelCore \u304b\u3089 include\/FlameSteelFramework \u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059 (\u79c1\u306e\u5834\u5408)\u3053\u308c\u306f \/usr\/local\/include\/FlameSteelFramework)\u3001\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u3092 lib \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059(\/usr\/local\/lib)\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u3001LD \u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u66f4\u65b0\u304c\u5fc5\u8981\u306b\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002 sudo ldconfig\u3002Ubuntu \u3067\u30d3\u30eb\u30c9\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306b\u306f (\u6b63\u3057\u3044\u30d3\u30eb\u30c9 \u30c4\u30fc\u30eb\u30c1\u30a7\u30fc\u30f3\u304c\u3042\u308b\u5834\u5408)\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\u3059\u3002 cmake . &#038;&#038; make &#038;&#038;<a class=\"more-link\" href=\"https:\/\/demensdeum.com\/blog\/ja\/2019\/10\/01\/shared-library-cmake-c\/\">Continue reading <span class=\"screen-reader-text\">&#8220;\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea CMake C++&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[61,52],"tags":[124,122,123],"class_list":["post-2255","post","type-post","status-publish","format-standard","hentry","category-techie","category-tutorials","tag-c","tag-cmake","tag-shared-lib","entry"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"ja","enabled_languages":["en","ru","zh","de","fr","ja","pt","hi"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"ru":{"title":true,"content":true,"excerpt":false},"zh":{"title":true,"content":true,"excerpt":false},"de":{"title":true,"content":true,"excerpt":false},"fr":{"title":true,"content":true,"excerpt":false},"ja":{"title":true,"content":true,"excerpt":false},"pt":{"title":true,"content":true,"excerpt":false},"hi":{"title":false,"content":false,"excerpt":false}}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts\/2255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/comments?post=2255"}],"version-history":[{"count":12,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts\/2255\/revisions"}],"predecessor-version":[{"id":3940,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/posts\/2255\/revisions\/3940"}],"wp:attachment":[{"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/media?parent=2255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/categories?post=2255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/ja\/wp-json\/wp\/v2\/tags?post=2255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}