@@ -5,56 +5,28 @@ project(NinjaPythonDistributions)
55set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} )
66
77# 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 )
119
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 "************************************" )
3011message (STATUS "Ninja Python Distribution" )
3112message (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 "************************************" )
4815
4916include (FetchContent)
5017FetchContent_Declare(
5118 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
5620)
5721FetchContent_MakeAvailable(ninja)
5822
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+
5931install (TARGETS ninja COMPONENT python DESTINATION "${SKBUILD_SCRIPTS_DIR} " )
6032install (FILES "${ninja_SOURCE_DIR} /misc/ninja_syntax.py" COMPONENT python DESTINATION ninja)
0 commit comments