diff --git a/CMakeLists.txt b/CMakeLists.txt index 440cdb4..1a24512 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,7 @@ option(BARK_CLBLAST "bark: use CLBlast" option(BARK_METAL "bark: use Metal" OFF) option(BARK_BUILD_TESTS "bark: build tests" ${BARK_STANDALONE}) +option(BARK_BUILD_EXAMPLES "bark: build examples" ${BARK_STANDALONE}) # # Build info header @@ -520,6 +521,10 @@ install( # programs, examples and tests # +if (BARK_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + if (BARK_BUILD_TESTS AND NOT CMAKE_JS_VERSION) include(CTest) add_subdirectory(tests) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..01ae6f7 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,9 @@ +set(TARGET main) +add_executable(${TARGET} main.cpp) +install(TARGETS ${TARGET} RUNTIME) +target_link_libraries(${TARGET} PRIVATE bark ${CMAKE_THREAD_LIBS_INIT}) +target_compile_features(${TARGET} PRIVATE cxx_std_11) +if(TARGET BUILD_INFO) + add_dependencies(${TARGET} BUILD_INFO) +endif() +