1
1
##########################################################################
2
- # File: dktool /__dk.cmake #
2
+ # File: dkcoder /__dk.cmake #
3
3
# #
4
4
# Copyright 2023 Diskuv, Inc. #
5
5
# #
12
12
##########################################################################
13
13
14
14
# Recommendation: Place this file in source control.
15
- # Auto-generated by `./dk dkml.wrapper.upgrade` of dktool .
15
+ # Auto-generated by `./dk dkml.wrapper.upgrade` of dkcoder .
16
16
17
17
include (FetchContent)
18
18
@@ -621,7 +621,7 @@ function(__dkcoder_delegate)
621
621
cmake_path(NATIVE_PATH CMAKE_COMMAND CMAKE_COMMAND_NATIVE)
622
622
cmake_path(NATIVE_PATH DKCODER_OCAMLRUN DKCODER_OCAMLRUN_NATIVE)
623
623
cmake_path(NATIVE_PATH entryExec entryExec_NATIVE)
624
- file (CONFIGURE OUTPUT "${DKTOOL_POST_SCRIPT } " CONTENT [[REM @ECHO OFF
624
+ file (CONFIGURE OUTPUT "${DKCODER_POST_SCRIPT } " CONTENT [[REM @ECHO OFF
625
625
REM Clear "SET" variables from dk.cmd. They are not part of DkCoder API.
626
626
SET DK_7Z_MAJVER=
627
627
SET DK_7Z_MINVER=
@@ -651,7 +651,7 @@ SET DKRUN_ENV_URL_BASE=
651
651
@ONLY NEWLINE_STYLE DOS)
652
652
else ()
653
653
# + Clear "export" variables from dk
654
- file (CONFIGURE OUTPUT "${DKTOOL_POST_SCRIPT } " CONTENT [[#!/bin/sh
654
+ file (CONFIGURE OUTPUT "${DKCODER_POST_SCRIPT } " CONTENT [[#!/bin/sh
655
655
set -euf
656
656
# Clear "export" variables from ./dk. They are not part of DkCoder API.
657
657
unset DKMLSYS_MV DKMLSYS_CHMOD DKMLSYS_UNAME DKMLSYS_ENV DKMLSYS_AWK DKMLSYS_SED DKMLSYS_COMM DKMLSYS_INSTALL
@@ -694,7 +694,7 @@ function(__parse_if_ocaml_command)
694
694
set (${ARG_SUCCESS_VARIABLE} OFF PARENT_SCOPE)
695
695
endfunction ()
696
696
697
- function (__parse_dktool_command_line )
697
+ function (__parse_dkcoder_command_line )
698
698
# The first argument is <command>. All dots will be replaced with a
699
699
# triple underscore as a convenience and to be pretty for the user.
700
700
# However, we do not error if no <command> is given ... we'll do
@@ -708,7 +708,7 @@ function(__parse_dktool_command_line)
708
708
./dk <command> [args]
709
709
710
710
Environment variables:
711
- DKTOOL_TTL_MINUTES =<n>. How many minutes before updates are fetched.
711
+ DKCODER_TTL_MINUTES =<n>. How many minutes before updates are fetched.
712
712
Defaults to 60 minutes. Set to 0 to disable caching.
713
713
]])
714
714
else ()
@@ -736,18 +736,18 @@ Environment variables:
736
736
endif ()
737
737
738
738
# Setup the binary directory
739
- if (NOT DKTOOL_WORKDIR )
740
- message (FATAL_ERROR "Problem: Your `dk` and/or `dk.cmd` are corrupted. Solution: Follow the instructions at https://gitlab .com/diskuv/dktool #installing" )
739
+ if (NOT DKCODER_WORKDIR )
740
+ message (FATAL_ERROR "Problem: Your `dk` and/or `dk.cmd` are corrupted. Solution: Follow the instructions at https://github .com/diskuv/dkcoder.git #installing" )
741
741
endif ()
742
- set (CMAKE_BINARY_DIR "${DKTOOL_WORKDIR } " )
742
+ set (CMAKE_BINARY_DIR "${DKCODER_WORKDIR } " )
743
743
set (CMAKE_CURRENT_BINARY_DIR "${CMAKE_BINARY_DIR} " )
744
744
745
745
# Set a log level used for essentially informational messages
746
- set (__dktool_log_level STATUS )
747
- if (DEFINED ENV{DKTOOL_LOGLEVEL } AND (
748
- "$ENV{DKTOOL_LOGLEVEL_OVERRIDE } " STREQUAL DEBUG OR
749
- "$ENV{DKTOOL_LOGLEVEL_OVERRIDE } " STREQUAL STATUS ))
750
- set (__dktool_log_level "$ENV{DKTOOL_LOGLEVEL_OVERRIDE } " )
746
+ set (__dkcoder_log_level STATUS )
747
+ if (DEFINED ENV{DKCODER_LOGLEVEL } AND (
748
+ "$ENV{DKCODER_LOGLEVEL_OVERRIDE } " STREQUAL DEBUG OR
749
+ "$ENV{DKCODER_LOGLEVEL_OVERRIDE } " STREQUAL STATUS ))
750
+ set (__dkcoder_log_level "$ENV{DKCODER_LOGLEVEL_OVERRIDE } " )
751
751
endif ()
752
752
753
753
# Determine if the <command> is a legacy CMake command or a modern OCaml command
@@ -790,7 +790,7 @@ Environment variables:
790
790
# Set log level if DkRun_*.RunQuiet. And then rename module from RunQuiet to Run.
791
791
set (quiet OFF )
792
792
if (package_namespace STREQUAL "Dk" AND package_qualifier STREQUAL "Run" AND module STREQUAL "RunQuiet" )
793
- set (__dktool_log_level DEBUG)
793
+ set (__dkcoder_log_level DEBUG)
794
794
set (module Run)
795
795
set (quiet ON )
796
796
endif ()
@@ -801,7 +801,7 @@ Environment variables:
801
801
# Do DkCoder install
802
802
__dkcoder_install(
803
803
ABI "${abi} "
804
- LOGLEVEL "${__dktool_log_level } "
804
+ LOGLEVEL "${__dkcoder_log_level } "
805
805
VERSION "${__dkrun_compile_version} "
806
806
QUIET "${quiet} " )
807
807
@@ -887,36 +887,36 @@ endfunction()
887
887
# hooks or redefine CMake built-in functions. Regardless, the user
888
888
# scripts are namespaced with `user__` prefix
889
889
if (NOT IS_DIRECTORY cmake/scripts/dksdk)
890
- # If this project (ex. dktool ) has the system scripts, it must
890
+ # If this project (ex. dkcoder ) has the system scripts, it must
891
891
# have all of them. Otherwise we download the system scripts.
892
892
# But we don't want to download every time we run the script.
893
893
#
894
894
# The default, but explicit so we know where it is.
895
- set (dktool_subbuild_dir "${CMAKE_CURRENT_BINARY_DIR} /dktool -subbuild" )
895
+ set (dkcoder_subbuild_dir "${CMAKE_CURRENT_BINARY_DIR} /dkcoder -subbuild" )
896
896
# Also the default, but explicit since we don't always call FetchContent_Populate().
897
- set (dktool_src_dir "${CMAKE_CURRENT_BINARY_DIR} /dktool -src" )
897
+ set (dkcoder_src_dir "${CMAKE_CURRENT_BINARY_DIR} /dkcoder -src" )
898
898
# Prior downloads are fine if done within the last one hour.
899
899
set (ttl_MINUTES 60)
900
- if (DEFINED ENV{DKTOOL_TTL_MINUTES })
901
- set (ttl_MINUTES "$ENV{DKTOOL_TTL_MINUTES } " )
900
+ if (DEFINED ENV{DKCODER_TTL_MINUTES })
901
+ set (ttl_MINUTES "$ENV{DKCODER_TTL_MINUTES } " )
902
902
endif ()
903
903
string (TIMESTAMP now_EPOCHSECS "%s" )
904
904
math (EXPR min_valid_EPOCHSECS "${now_EPOCHSECS} - 60*${ttl_MINUTES} " )
905
905
set (tstamp_EPOCHSECS 0)
906
- if (EXISTS "${dktool_subbuild_dir } /build.ninja" )
907
- file (TIMESTAMP "${dktool_subbuild_dir } /build.ninja" tstamp_EPOCHSECS "%s" )
906
+ if (EXISTS "${dkcoder_subbuild_dir } /build.ninja" )
907
+ file (TIMESTAMP "${dkcoder_subbuild_dir } /build.ninja" tstamp_EPOCHSECS "%s" )
908
908
endif ()
909
909
if (NOT tstamp_EPOCHSECS OR tstamp_EPOCHSECS LESS_EQUAL min_valid_EPOCHSECS)
910
- # Cache miss. Time to update dktool .
911
- FetchContent_Populate(dktool
910
+ # Cache miss. Time to update dkcoder .
911
+ FetchContent_Populate(dkcoder
912
912
QUIET
913
- SOURCE_DIR "${dktool_src_dir } "
914
- SUBBUILD_DIR "${dktool_subbuild_dir } "
915
- GIT_REPOSITORY https://gitlab .com/diskuv/dktool .git
913
+ SOURCE_DIR "${dkcoder_src_dir } "
914
+ SUBBUILD_DIR "${dkcoder_subbuild_dir } "
915
+ GIT_REPOSITORY https://github .com/diskuv/dkcoder .git
916
916
GIT_TAG 1.0
917
917
# As of 3.25.3 the bug https://gitlab.kitware.com/cmake/cmake/-/issues/24578
918
918
# has still not been fixed. That means empty strings get removed.
919
- # ExternalProject_Add(GIT_SUBMODULES) in dktool -subbuild/CMakeLists.txt
919
+ # ExternalProject_Add(GIT_SUBMODULES) in dkcoder -subbuild/CMakeLists.txt
920
920
# means fetch all submodules.
921
921
# https://gitlab.kitware.com/cmake/cmake/-/issues/20579#note_734045
922
922
# has a workaround.
@@ -925,9 +925,9 @@ endfunction()
925
925
endif ()
926
926
file (GLOB_RECURSE system_command_files
927
927
LIST_DIRECTORIES FALSE
928
- RELATIVE ${dktool_src_dir } /cmake/scripts
929
- ${dktool_src_dir } /cmake/scripts/dkml/*.cmake
930
- ${dktool_src_dir } /cmake/scripts/dksdk/*.cmake)
928
+ RELATIVE ${dkcoder_src_dir } /cmake/scripts
929
+ ${dkcoder_src_dir } /cmake/scripts/dkml/*.cmake
930
+ ${dkcoder_src_dir } /cmake/scripts/dksdk/*.cmake)
931
931
foreach (command_file IN LISTS system_command_files)
932
932
# Normalize and lowercase
933
933
cmake_path(NORMAL_PATH command_file)
@@ -947,11 +947,11 @@ endfunction()
947
947
message (VERBOSE "Shimming ${command_function_name} " )
948
948
cmake_language(EVAL CODE "
949
949
function(${command_function_name} )
950
- include(\" ${dktool_src_dir } /cmake/scripts/${command_file} \" )
950
+ include(\" ${dkcoder_src_dir } /cmake/scripts/${command_file} \" )
951
951
if(COMMAND run)
952
952
run(${quotedArgs} )
953
953
else()
954
- message(FATAL_ERROR [[The system script ${dktool_src_dir } /cmake/scripts/${command_file} was missing:
954
+ message(FATAL_ERROR [[The system script ${dkcoder_src_dir } /cmake/scripts/${command_file} was missing:
955
955
function(run)
956
956
# The system code
957
957
endfunction()
@@ -1007,14 +1007,14 @@ if(CMAKE_HOST_WIN32)
1007
1007
else ()
1008
1008
set (post_script_suffix .sh)
1009
1009
endif ()
1010
- cmake_path(APPEND DKTOOL_WORKDIR "${DKTOOL_NONCE }${post_script_suffix} " OUTPUT_VARIABLE DKTOOL_POST_SCRIPT )
1011
- cmake_path(NORMAL_PATH DKTOOL_POST_SCRIPT )
1010
+ cmake_path(APPEND DKCODER_WORKDIR "${DKCODER_NONCE }${post_script_suffix} " OUTPUT_VARIABLE DKCODER_POST_SCRIPT )
1011
+ cmake_path(NORMAL_PATH DKCODER_POST_SCRIPT )
1012
1012
1013
1013
# Escape any escape characters before EVAL CODE
1014
- string (REPLACE "\\ " "\\\\ " DKTOOL_CMDLINE "${DKTOOL_CMDLINE } " )
1014
+ string (REPLACE "\\ " "\\\\ " DKCODER_CMDLINE "${DKCODER_CMDLINE } " )
1015
1015
1016
1016
# Escape any hash symbols (#) characters before EVAL CODE
1017
- string (REPLACE "#" "\\ #" DKTOOL_CMDLINE "${DKTOOL_CMDLINE } " )
1017
+ string (REPLACE "#" "\\ #" DKCODER_CMDLINE "${DKCODER_CMDLINE } " )
1018
1018
1019
- # Splat DKTOOL_CMDLINE
1020
- cmake_language(EVAL CODE "__parse_dktool_command_line (${DKTOOL_CMDLINE } )" )
1019
+ # Splat DKCODER_CMDLINE
1020
+ cmake_language(EVAL CODE "__parse_dkcoder_command_line (${DKCODER_CMDLINE } )" )
0 commit comments