Skip to content

Instantly share code, notes, and snippets.

@andrewssobral
Forked from awni/CMakeLists.txt
Created October 23, 2024 22:00
Show Gist options
  • Save andrewssobral/c7dd6f739106f3d575b45842377644f6 to your computer and use it in GitHub Desktop.
Save andrewssobral/c7dd6f739106f3d575b45842377644f6 to your computer and use it in GitHub Desktop.
Minimal MLX CMake
cmake_minimum_required(VERSION 3.27)
project(_ext LANGUAGES CXX)
# ----------------------------- Setup -----------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(BUILD_SHARED_LIBS "Build as a shared library" ON)
# ----------------------------- Dependencies -----------------------------
find_package(MLX CONFIG REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PUBLIC mlx)
#include <iostream>
#include <mlx/mlx.h>
using namespace mlx::core;
int main () {
auto a = array({1,2,3});
std::cout << a << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment