@@ -5,56 +5,28 @@ project(NinjaPythonDistributions)
5
5
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} )
6
6
7
7
# Options
8
- option (BUILD_VERBOSE "Display additional information while building (e.g download progress, ...)" OFF )
9
- option (RUN_NINJA_TEST "Run Ninja test suite" ON )
10
- set (ARCHIVE_DOWNLOAD_DIR "${CMAKE_BINARY_DIR} " CACHE PATH "Directory where to download archives" )
8
+ option (RUN_NINJA_TEST "Run Ninja test suite" OFF )
11
9
12
- include (NinjaUrls)
13
-
14
- function (check_archive_var archive_var)
15
- if (NOT DEFINED "${archive_var} _url" )
16
- message (FATAL_ERROR "Failed to determine which archive to download: '${archive_var} _url' variable is not defined" )
17
- endif ()
18
- if (NOT DEFINED "${archive_var} _sha256" )
19
- message (FATAL_ERROR "Could you make sure variable '${archive_var} _sha256' is defined ?" )
20
- endif ()
21
- endfunction ()
22
-
23
- set (src_archive "unix_source" )
24
- if (WIN32 )
25
- set (src_archive "windows_source" )
26
- endif ()
27
- check_archive_var("${src_archive} " )
28
-
29
- message (STATUS "*********************************************" )
10
+ message (STATUS "************************************" )
30
11
message (STATUS "Ninja Python Distribution" )
31
12
message (STATUS "" )
32
- message (STATUS " BUILD_VERBOSE : ${BUILD_VERBOSE} " )
33
- message (STATUS " RUN_NINJA_TEST : ${RUN_NINJA_TEST} " )
34
- message (STATUS "" )
35
- message (STATUS " ARCHIVE_DOWNLOAD_DIR : ${ARCHIVE_DOWNLOAD_DIR} " )
36
- message (STATUS "" )
37
- message (STATUS " src_archive : ${src_archive} " )
38
- message (STATUS " <src_archive>_url : ${${src_archive} _url}" )
39
- message (STATUS " <src_archive>_sha256 : ${${src_archive} _sha256}" )
40
- message (STATUS "*********************************************" )
41
-
42
- set (ep_download_no_progress_args)
43
- if (NOT BUILD_VERBOSE)
44
- set (ep_download_no_progress_args
45
- DOWNLOAD_NO_PROGRESS 1
46
- )
47
- endif ()
13
+ message (STATUS " RUN_NINJA_TEST : ${RUN_NINJA_TEST} " )
14
+ message (STATUS "************************************" )
48
15
49
16
include (FetchContent)
50
17
FetchContent_Declare(
51
18
ninja
52
- URL ${${src_archive} _url}
53
- URL_HASH SHA256=${${src_archive} _sha256}
54
- DOWNLOAD_DIR ${ARCHIVE_DOWNLOAD_DIR}
55
- ${ep_download_no_progress_args}
19
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} /ninja-upstream
56
20
)
57
21
FetchContent_MakeAvailable(ninja)
58
22
23
+ if (RUN_NINJA_TEST)
24
+ add_custom_target (
25
+ run_ninja_test ALL "$<TARGET_FILE:ninja_test>"
26
+ DEPENDS ninja_test
27
+ WORKING_DIRECTORY "$<TARGET_FILE_DIR:ninja_test>"
28
+ )
29
+ endif ()
30
+
59
31
install (TARGETS ninja COMPONENT python DESTINATION "${SKBUILD_SCRIPTS_DIR} " )
60
32
install (FILES "${ninja_SOURCE_DIR} /misc/ninja_syntax.py" COMPONENT python DESTINATION ninja)
0 commit comments