mirror of
				https://github.com/ml-explore/mlx.git
				synced 2025-11-04 10:38:10 +08:00 
			
		
		
		
	Testing C++ 20
This commit is contained in:
		@@ -123,6 +123,9 @@ jobs:
 | 
				
			|||||||
      xcode_version:
 | 
					      xcode_version:
 | 
				
			||||||
        type: string
 | 
					        type: string
 | 
				
			||||||
        default: "15.2.0"
 | 
					        default: "15.2.0"
 | 
				
			||||||
 | 
					      deployment_target:
 | 
				
			||||||
 | 
					        type: string
 | 
				
			||||||
 | 
					        default: ""
 | 
				
			||||||
    macos:
 | 
					    macos:
 | 
				
			||||||
      xcode: << parameters.xcode_version >>
 | 
					      xcode: << parameters.xcode_version >>
 | 
				
			||||||
    resource_class: macos.m1.medium.gen1
 | 
					    resource_class: macos.m1.medium.gen1
 | 
				
			||||||
@@ -209,6 +212,9 @@ jobs:
 | 
				
			|||||||
      xcode_version:
 | 
					      xcode_version:
 | 
				
			||||||
        type: string
 | 
					        type: string
 | 
				
			||||||
        default: "15.2.0"
 | 
					        default: "15.2.0"
 | 
				
			||||||
 | 
					      deployment_target:
 | 
				
			||||||
 | 
					        type: string
 | 
				
			||||||
 | 
					        default: ""
 | 
				
			||||||
      build_env:
 | 
					      build_env:
 | 
				
			||||||
        type: string
 | 
					        type: string
 | 
				
			||||||
        default: ""
 | 
					        default: ""
 | 
				
			||||||
@@ -237,6 +243,7 @@ jobs:
 | 
				
			|||||||
            source env/bin/activate
 | 
					            source env/bin/activate
 | 
				
			||||||
            DEV_RELEASE=1 \
 | 
					            DEV_RELEASE=1 \
 | 
				
			||||||
              CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` \
 | 
					              CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` \
 | 
				
			||||||
 | 
					              CMAKE_ARGS=-DCMAKE_OSX_DEPLOYMENT_TARGET=<< parameters.deployment_target >> \
 | 
				
			||||||
              pip install . -v
 | 
					              pip install . -v
 | 
				
			||||||
      - run:
 | 
					      - run:
 | 
				
			||||||
          name: Generate package stubs
 | 
					          name: Generate package stubs
 | 
				
			||||||
@@ -250,6 +257,7 @@ jobs:
 | 
				
			|||||||
            source env/bin/activate
 | 
					            source env/bin/activate
 | 
				
			||||||
            << parameters.build_env >> \
 | 
					            << parameters.build_env >> \
 | 
				
			||||||
              CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` \
 | 
					              CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.ncpu` \
 | 
				
			||||||
 | 
					              CMAKE_ARGS=-DCMAKE_OSX_DEPLOYMENT_TARGET=<< parameters.deployment_target >> \
 | 
				
			||||||
              python -m build -w
 | 
					              python -m build -w
 | 
				
			||||||
      - when:
 | 
					      - when:
 | 
				
			||||||
          condition: << parameters.build_env >>
 | 
					          condition: << parameters.build_env >>
 | 
				
			||||||
@@ -332,7 +340,13 @@ workflows:
 | 
				
			|||||||
            parameters:
 | 
					            parameters:
 | 
				
			||||||
              xcode_version: ["15.0.0", "15.2.0", "16.0.0"]
 | 
					              xcode_version: ["15.0.0", "15.2.0", "16.0.0"]
 | 
				
			||||||
      - linux_build_and_test
 | 
					      - linux_build_and_test
 | 
				
			||||||
      - build_documentation 
 | 
					      - build_documentation
 | 
				
			||||||
 | 
					      - build_release:
 | 
				
			||||||
 | 
					          matrix:
 | 
				
			||||||
 | 
					            parameters:
 | 
				
			||||||
 | 
					              python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
 | 
				
			||||||
 | 
					              xcode_version: ["15.2.0"]
 | 
				
			||||||
 | 
					              deployment_target: ["", "14.0"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  build_pypi_release:
 | 
					  build_pypi_release:
 | 
				
			||||||
    when:
 | 
					    when:
 | 
				
			||||||
@@ -387,7 +401,8 @@ workflows:
 | 
				
			|||||||
          matrix:
 | 
					          matrix:
 | 
				
			||||||
            parameters:
 | 
					            parameters:
 | 
				
			||||||
              python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
 | 
					              python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
 | 
				
			||||||
              xcode_version: ["15.0.0", "15.2.0"]
 | 
					              xcode_version: ["15.2.0"]
 | 
				
			||||||
 | 
					              deployment_target: ["", "14.0"]
 | 
				
			||||||
  weekly_build:
 | 
					  weekly_build:
 | 
				
			||||||
    when:
 | 
					    when:
 | 
				
			||||||
      and:
 | 
					      and:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ project(mlx LANGUAGES C CXX)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# ----------------------------- Setup -----------------------------
 | 
					# ----------------------------- Setup -----------------------------
 | 
				
			||||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
 | 
					set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
 | 
				
			||||||
set(CMAKE_CXX_STANDARD 17)
 | 
					set(CMAKE_CXX_STANDARD 20)
 | 
				
			||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
 | 
					set(CMAKE_CXX_STANDARD_REQUIRED ON)
 | 
				
			||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 | 
					set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 | 
				
			||||||
set(CMAKE_INSTALL_MESSAGE NEVER)
 | 
					set(CMAKE_INSTALL_MESSAGE NEVER)
 | 
				
			||||||
@@ -223,13 +223,9 @@ target_include_directories(
 | 
				
			|||||||
  mlx PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
 | 
					  mlx PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
 | 
				
			||||||
             $<INSTALL_INTERFACE:include>)
 | 
					             $<INSTALL_INTERFACE:include>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FetchContent_Declare(
 | 
					# FetchContent_Declare( fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git
 | 
				
			||||||
  fmt
 | 
					# GIT_TAG 10.2.1 EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(fmt)
 | 
				
			||||||
  GIT_REPOSITORY https://github.com/fmtlib/fmt.git
 | 
					# target_link_libraries(mlx PRIVATE $<BUILD_INTERFACE:fmt::fmt-header-only>)
 | 
				
			||||||
  GIT_TAG 10.2.1
 | 
					 | 
				
			||||||
  EXCLUDE_FROM_ALL)
 | 
					 | 
				
			||||||
FetchContent_MakeAvailable(fmt)
 | 
					 | 
				
			||||||
target_link_libraries(mlx PRIVATE $<BUILD_INTERFACE:fmt::fmt-header-only>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(MLX_BUILD_PYTHON_BINDINGS)
 | 
					if(MLX_BUILD_PYTHON_BINDINGS)
 | 
				
			||||||
  message(STATUS "Building Python bindings.")
 | 
					  message(STATUS "Building Python bindings.")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user