Compare commits

...

10 Commits

11 changed files with 216 additions and 7 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Patrick Wuttke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3
README.txt Normal file
View File

@ -0,0 +1,3 @@
Recipe repository for SCons++ (https://git.mewin.de/mewin/scons-plus-plus).
Note that even though the branch is called "stable", it really isn't. Most of the scripts have only be tested on Linux, some on Windows and none any other OS.

View File

@ -10,7 +10,8 @@ def _git_cook(env: Environment, repo: dict) -> dict:
if os.path.exists(os.path.join(repo['checkout_root'], 'cmake', 'GetGitRevisionDescription.cmake')):
try:
repo['repo'].git.apply('--unsafe-paths', '--directory', repo['checkout_root'], os.path.join(env['SPP_DIR'], 'recipes', 'SDL', 'fix_sdl3_from_worktree.patch'))
recipe_folder = os.path.dirname(__file__)
repo['repo'].git.apply('--unsafe-paths', '--directory', repo['checkout_root'], os.path.join(recipe_folder, 'fix_sdl3_from_worktree.patch'))
except:
# either already applied or not applicable anymore
pass

View File

@ -0,0 +1,26 @@
import re
from SCons.Script import *
def _git_cook(env: Environment, repo: dict) -> dict:
vulkan_headers = env.Cook('VulkanHeaders')
checkout_root = repo['checkout_root']
return {
'CPPPATH': [f'{checkout_root}/include']
}
env.GitRecipe(
globals = globals(),
repo_name = 'SpirVHeaders',
repo_url = 'https://github.com/KhronosGroup/SPIRV-Headers.git',
tag_pattern = re.compile(r'^vulkan-sdk-([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$'),
tag_fn = lambda version: f'vulkan-sdk-{version[0]}.{version[1]}.{version[2]}.{version[3]}',
cook_fn = _git_cook,
dependencies = {
'VulkanHeaders': {}
}
)

View File

@ -0,0 +1,43 @@
import re
from SCons.Script import *
def _git_cook(env: Environment, repo: dict) -> dict:
checkout_root = repo['checkout_root']
source_files = [f'{checkout_root}/spirv_reflect.cpp']
additional_cxx_flags = []
additional_cppdefines = ['SPIRV_REFLECT_USE_SYSTEM_SPIRV_H']
if env['COMPILER_FAMILY'] == 'gcc':
additional_cxx_flags.append('-Wno-overflow')
lib_spirv_reflect = env.StaticLibrary(
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
CPPPATH = [repo['checkout_root']],
CPPDEFINES = list(env['CPPDEFINES']) + additional_cppdefines,
target = env['LIB_DIR'] + '/spirv_reflect',
source = source_files,
dependencies = {
'SpirVHeaders': {}
}
)
return {
'CPPPATH': [repo['checkout_root']],
'LIBS': [lib_spirv_reflect]
}
env.GitRecipe(
globals = globals(),
repo_name = 'SpirVReflect',
repo_url = 'https://github.com/KhronosGroup/SPIRV-Reflect.git',
tag_pattern = re.compile(r'^vulkan-sdk-([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$'),
tag_fn = lambda version: f'vulkan-sdk-{version[0]}.{version[1]}.{version[2]}.{version[3]}',
cook_fn = _git_cook,
dependencies = {
'SpirVHeaders': {}
}
)

View File

@ -40,6 +40,10 @@ def cook(env: Environment, version) -> dict:
git_ref = f'refs/tags/v{version[0]}.{version[1]}.{version[2]}'
repo = env.GitBranch(repo_name = _get_repo_name(env), remote_url = _get_repo_url(env), git_ref = git_ref)
checkout_root = repo['checkout_root']
include_dir = os.path.join(checkout_root, 'include')
return {
'CPPPATH': [os.path.join(checkout_root, 'include')]
'CPPPATH': [include_dir],
'CMAKE_VARS': {
'Vulkan_INCLUDE_DIR': include_dir
}
}

29
recipes/cppdap/recipe.py Normal file
View File

@ -0,0 +1,29 @@
import re
from SCons.Script import *
def _git_cook(env: Environment, repo: dict) -> dict:
lib_json = env.Cook('json')
checkout_root = repo['checkout_root']
build_result = env.CMakeProject(checkout_root, generate_args=['-DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON'], dependencies = [lib_json])
lib_name = 'cppdap'
return {
'CPPPATH': build_result['CPPPATH'],
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
}
env.GitRecipe(
globals = globals(),
repo_name = 'cppdap',
repo_url = 'https://github.com/google/cppdap.git',
tag_pattern = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)$'), # cppdap doesn't have any (recent) version tags, so this is kind of useless anyway'
tag_fn = lambda version: f'{version[0]}.{version[1]}.{version[2]}',
cook_fn = _git_cook,
dependencies = {
'json': {}
}
)

View File

@ -60,7 +60,7 @@ def _git_cook(env: Environment, repo, options: dict = {}) -> dict:
if enable_hlsl:
additional_cppdefines.append('ENABLE_HLSL=1')
env.StaticLibrary(
lib_glslang_full = env.StaticLibrary(
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
CPPPATH = repo['checkout_root'],
CPPDEFINES = list(env['CPPDEFINES']) + additional_cppdefines,
@ -84,7 +84,7 @@ def _git_cook(env: Environment, repo, options: dict = {}) -> dict:
return {
'CPPPATH': [include_dir],
'LIBS': [os.path.join(env['LIB_DIR'], env.LibFilename('glslang_full'))]
'LIBS': [lib_glslang_full]
}

View File

@ -23,7 +23,8 @@ def _git_cook(env: Environment, repo: dict, options: dict) -> dict:
os.path.join(repo['checkout_root'], 'imgui.cpp'),
os.path.join(repo['checkout_root'], 'imgui_draw.cpp'),
os.path.join(repo['checkout_root'], 'imgui_tables.cpp'),
os.path.join(repo['checkout_root'], 'imgui_widgets.cpp')
os.path.join(repo['checkout_root'], 'imgui_widgets.cpp'),
os.path.join(repo['checkout_root'], 'misc/cpp/imgui_stdlib.cpp')
]
for backend in chain(env.get('IMGUI_BACKENDS', []), options.get('backends', [])):

View File

@ -1,14 +1,16 @@
import os
import re
from SCons.Script import *
def _git_cook(env: Environment, repo: dict) -> dict:
checkout_root = repo['checkout_root']
build_result = env.CMakeProject(project_root=checkout_root)
build_result = env.CMakeProject(project_root=checkout_root, generate_args=['-DJSON_BuildTests=OFF'])
return {
'CPPPATH': build_result['CPPPATH']
'CPPPATH': build_result['CPPPATH'],
'CMAKE_PREFIX_PATH': [build_result['install_dir']]
}

View File

@ -0,0 +1,79 @@
import os
import re
from SCons.Script import *
_DEPENDENCIES = {
'zlib': {}
}
def _git_cook(env: Environment, repo: dict) -> dict:
checkout_root = repo['checkout_root']
magic_source_files = [
os.path.join(checkout_root, 'src/buffer.c'),
os.path.join(checkout_root, 'src/magic.c'),
os.path.join(checkout_root, 'src/apprentice.c'),
os.path.join(checkout_root, 'src/softmagic.c'),
os.path.join(checkout_root, 'src/ascmagic.c'),
os.path.join(checkout_root, 'src/encoding.c'),
os.path.join(checkout_root, 'src/compress.c'),
os.path.join(checkout_root, 'src/is_csv.c'),
os.path.join(checkout_root, 'src/is_json.c'),
os.path.join(checkout_root, 'src/is_simh.c'),
os.path.join(checkout_root, 'src/is_tar.c'),
os.path.join(checkout_root, 'src/readelf.c'),
os.path.join(checkout_root, 'src/print.c'),
os.path.join(checkout_root, 'src/fsmagic.c'),
os.path.join(checkout_root, 'src/funcs.c'),
os.path.join(checkout_root, 'src/apptype.c'),
os.path.join(checkout_root, 'src/der.c'),
os.path.join(checkout_root, 'src/cdf.c'),
os.path.join(checkout_root, 'src/cdf_time.c'),
os.path.join(checkout_root, 'src/readcdf.c'),
os.path.join(checkout_root, 'src/fmtcheck.c')
]
version_dict = {'X.YY': '5.46'}
env.Substfile(os.path.join(checkout_root, 'src/magic.h.in'), SUBST_DICT=version_dict)
additional_ccflags = []
if env['COMPILER_FAMILY'] == 'gcc':
additional_ccflags.extend(['-Wno-unused-parameter', '-Wno-unused-const-variable'])
lib_magic = env.StaticLibrary(
CPPDEFINES = list(env['CPPDEFINES']) + ['HAVE_BYTESWAP_H', 'HAVE_BZLIB_H', 'HAVE_ERR_H',
'HAVE_FREELOCALE', 'HAVE_GETOPT_H', 'HAVE_INTTYPES_H', 'HAVE_LIBSECCOMP',
'HAVE_LRZIP_H', 'HAVE_LZLIB_H', 'HAVE_LZMA_H', 'HAVE_MBRTOWC',
'HAVE_MEMMEM', 'HAVE_MMAP', 'HAVE_NEWLOCALE',
'HAVE_POSIX_SPAWNP', 'HAVE_SPAWN_H', 'HAVE_STDINT_H', 'HAVE_STRNDUP',
'HAVE_STRTOF', 'HAVE_STRUCT_OPTION', 'HAVE_STRUCT_STAT_ST_RDEV',
'HAVE_STRUCT_TM_TM_GMTOFF', 'HAVE_STRUCT_TM_TM_ZONE',
'HAVE_SYS_IOCTL_H', 'HAVE_SYS_MMAN_H', 'HAVE_SYS_SYSMACROS_H',
'HAVE_SYS_TIME_H', 'HAVE_SYS_UTIME_H', 'HAVE_SYS_WAIT_H',
'HAVE_UNISTD_H', 'HAVE_USELOCALE', 'HAVE_UTIME', 'HAVE_UTIMES',
'HAVE_UTIME_H', 'HAVE_WCHAR_H', 'HAVE_WCTYPE_H', 'HAVE_WCWIDTH',
'HAVE_ZLIB_H', 'HAVE_ZSTD_H', 'VERSION=\\"5.46\\"'],
CCFLAGS = list(env['CCFLAGS']) + additional_ccflags,
target = env['LIB_DIR'] + '/magic',
source = magic_source_files,
dependencies = _DEPENDENCIES
)
return {
'CPPPATH': [os.path.join(checkout_root, 'src')],
'LIBS': [lib_magic]
}
env.GitRecipe(
globals = globals(),
repo_name = 'libmagic',
repo_url = 'https://github.com/file/file.git',
tag_pattern = re.compile(r'^FILE([0-9]+)_([0-9]+)$'),
tag_fn = lambda version: f'FILE{version[0]}_{version[1]}',
cook_fn = _git_cook,
dependencies = _DEPENDENCIES
)