-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
46 lines (40 loc) · 1.9 KB
/
CMakeLists.txt
File metadata and controls
46 lines (40 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright (c) PyPTO Contributors.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# -----------------------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.15)
# Support both scikit-build and native CMake builds
if(DEFINED SKBUILD_PROJECT_NAME)
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})
set(SKBUILD_MODE ON)
else()
project(simpler VERSION 0.1.0)
set(SKBUILD_MODE OFF)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Find Python and nanobind
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
find_package(nanobind CONFIG REQUIRED)
# Include Python bindings
add_subdirectory(python/bindings)
# Pre-build runtime binaries (persistent build dirs for incremental compilation)
add_custom_target(build_runtimes ALL
COMMAND ${Python_EXECUTABLE}
${CMAKE_SOURCE_DIR}/simpler_setup/build_runtimes.py
--lib-dir ${CMAKE_SOURCE_DIR}/build/lib
--cache-dir ${CMAKE_SOURCE_DIR}/build/cache
COMMENT "Building runtime binaries (incremental)..."
)
if(SKBUILD_MODE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/
DESTINATION simpler_setup/_assets/src)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/build/lib/
DESTINATION simpler_setup/_assets/build/lib
OPTIONAL)
endif()