Changed build files to meson
This commit is contained in:
parent
9d4436cc00
commit
0460ae1a50
17 changed files with 170 additions and 127 deletions
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"C_Cpp.default.compileCommands": "d:\\FluxEngine\\builddir/compile_commands.json",
|
||||
"C_Cpp.default.configurationProvider": "mesonbuild.mesonbuild",
|
||||
"cmake.ignoreCMakeListsMissing": true
|
||||
}
|
23
FluxEngine/meson.build
Normal file
23
FluxEngine/meson.build
Normal file
|
@ -0,0 +1,23 @@
|
|||
flux_inc = include_directories('src/public')
|
||||
|
||||
flux_sources = files(
|
||||
'src/private/Application.cpp',
|
||||
'src/private/Log.cpp',
|
||||
)
|
||||
|
||||
spd = subproject('spdlog')
|
||||
spdlog_dep = spd.get_variable('spdlog')
|
||||
|
||||
flux_lib = library(
|
||||
'fluxengine',
|
||||
flux_sources,
|
||||
include_directories: flux_inc,
|
||||
link_with : spdlog_dep,
|
||||
version : meson.project_version(),
|
||||
install : true,
|
||||
)
|
||||
|
||||
flux_dep = declare_dependency(
|
||||
include_directories: flux_inc,
|
||||
link_with : [ flux_lib, spdlog_dep ],
|
||||
)
|
|
@ -1,2 +1,71 @@
|
|||
call .\vendor\bin\premake\premake5.exe vs2022
|
||||
PAUSE
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
rem ──────────────────────────────────────────────────
|
||||
rem Defaults (override by passing [backend] [build])
|
||||
rem ──────────────────────────────────────────────────
|
||||
set BUILD_DIR=builddir
|
||||
set BACKEND=ninja
|
||||
set BUILD=debug
|
||||
|
||||
rem ──────────────────────────────────────────────────
|
||||
rem Recognize help flags
|
||||
rem ──────────────────────────────────────────────────
|
||||
if /I "%~1"=="-?" goto usage
|
||||
if /I "%~1"=="/?" goto usage
|
||||
if /I "%~1"=="-h" goto usage
|
||||
if /I "%~1"=="--help" goto usage
|
||||
|
||||
rem ──────────────────────────────────────────────────
|
||||
rem Parse positional arguments
|
||||
rem ──────────────────────────────────────────────────
|
||||
if not "%~1"=="" set BACKEND=%~1
|
||||
if not "%~2"=="" set BUILD=%~2
|
||||
|
||||
rem ──────────────────────────────────────────────────
|
||||
rem Bootstrap Visual Studio if requested
|
||||
rem ──────────────────────────────────────────────────
|
||||
if /I "%BACKEND:~0,2%"=="vs" (
|
||||
echo [INFO] Initializing Visual Studio environment for %BACKEND%...
|
||||
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Failed to initialize VS environment. Check the vcvarsall.bat path.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
rem ──────────────────────────────────────────────────
|
||||
rem Configure or reconfigure with Meson
|
||||
rem ──────────────────────────────────────────────────
|
||||
if not exist "%BUILD_DIR%" (
|
||||
echo [INFO] Creating build directory "%BUILD_DIR%" with backend "%BACKEND%" and build "%BUILD%"...
|
||||
meson setup "%BUILD_DIR%" --backend=%BACKEND% --buildtype=%BUILD%
|
||||
) else (
|
||||
echo [INFO] Reconfiguring "%BUILD_DIR%" with backend "%BACKEND%" and build "%BUILD%"...
|
||||
meson setup --reconfigure "%BUILD_DIR%" --backend=%BACKEND% --buildtype=%BUILD%
|
||||
)
|
||||
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Meson configuration failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
rem ──────────────────────────────────────────────────
|
||||
rem Compile
|
||||
rem ──────────────────────────────────────────────────
|
||||
echo [INFO] Configuration succeeded—starting build...
|
||||
meson compile -C "%BUILD_DIR%"
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Build failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [SUCCESS] Build completed successfully.
|
||||
exit /b 0
|
||||
|
||||
:usage
|
||||
echo Usage: %~nx0 [backend] [build]
|
||||
echo.
|
||||
echo backend ninja (default) ^| vs2022 ^| vs2019 ^| vs2017
|
||||
echo build debug (default) ^| debugoptimized ^| release ^| relwithdebinfo
|
||||
exit /b 0
|
||||
|
|
12
Sandbox/meson.build
Normal file
12
Sandbox/meson.build
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Point to the public headers of FluxEngine
|
||||
sandbox_inc = include_directories(
|
||||
'../FluxEngine/src/public'
|
||||
)
|
||||
|
||||
executable(
|
||||
'sandbox',
|
||||
'src/private/SandboxApp.cpp',
|
||||
include_directories: sandbox_inc,
|
||||
dependencies : flux_dep,
|
||||
install : true,
|
||||
)
|
54
meson.build
Normal file
54
meson.build
Normal file
|
@ -0,0 +1,54 @@
|
|||
project(
|
||||
'FluxEngine',
|
||||
'cpp',
|
||||
version : '0.1.0',
|
||||
meson_version : '>=0.60.0',
|
||||
default_options : [
|
||||
'cpp_std=c++20',
|
||||
'warning_level=3',
|
||||
'buildtype=debugoptimized',
|
||||
]
|
||||
)
|
||||
|
||||
# 1) Grab the active C++ compiler
|
||||
cpp = meson.get_compiler('cpp')
|
||||
ccid = cpp.get_id() # e.g. 'msvc', 'gcc', 'clang', 'intel', ...
|
||||
|
||||
# 2) Decide your D-flag prefix
|
||||
if ccid == 'msvc'
|
||||
dflag = '/D'
|
||||
else
|
||||
dflag = '-D'
|
||||
endif
|
||||
|
||||
# 3) Platform macro (all OSes)
|
||||
sys = host_machine.system()
|
||||
if sys == 'windows'
|
||||
plat = 'FLUX_PLATFORM_WINDOWS'
|
||||
elif sys == 'linux'
|
||||
plat = 'FLUX_PLATFORM_LINUX'
|
||||
elif sys == 'darwin'
|
||||
plat = 'FLUX_PLATFORM_MACOS'
|
||||
elif sys == 'freebsd'
|
||||
plat = 'FLUX_PLATFORM_FREEBSD'
|
||||
else
|
||||
plat = 'FLUX_PLATFORM_UNKNOWN'
|
||||
endif
|
||||
|
||||
add_global_arguments(dflag + plat, language : 'cpp')
|
||||
|
||||
# 4) Build-type macros
|
||||
bt = get_option('buildtype')
|
||||
if bt == 'debug'
|
||||
add_project_arguments(dflag + 'FLUX_DEBUG', language : 'cpp')
|
||||
elif bt == 'release'
|
||||
add_project_arguments(dflag + 'FLUX_RELEASE', language : 'cpp')
|
||||
elif bt == 'debugoptimized'
|
||||
add_project_arguments(dflag + 'FLUX_DIST', language : 'cpp')
|
||||
else
|
||||
warning('Unrecognized buildtype: ' + bt)
|
||||
endif
|
||||
|
||||
# Tell Meson to descend into these directories
|
||||
subdir('FluxEngine')
|
||||
subdir('Sandbox')
|
98
premake5.lua
98
premake5.lua
|
@ -1,98 +0,0 @@
|
|||
workspace "FluxEngine"
|
||||
architecture "x64"
|
||||
startproject "Sandbox"
|
||||
|
||||
configurations { "Debug", "Release", "Dist" }
|
||||
|
||||
outputdir = "%{cfg.buildcfg}-%{cfg.system}"
|
||||
|
||||
project "FluxEngine"
|
||||
location "FluxEngine"
|
||||
kind "SharedLib"
|
||||
language "C++"
|
||||
|
||||
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
|
||||
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
|
||||
|
||||
files
|
||||
{
|
||||
"%{prj.name}/src/**.h",
|
||||
"%{prj.name}/src/**.cpp",
|
||||
}
|
||||
|
||||
includedirs
|
||||
{
|
||||
"%{prj.name}/vendor/spdlog/include",
|
||||
}
|
||||
|
||||
filter "system:windows"
|
||||
cppdialect "C++20"
|
||||
staticruntime "on"
|
||||
systemversion "latest"
|
||||
defines
|
||||
{
|
||||
"FLUX_PLATFORM_WINDOWS",
|
||||
"FLUX_BUILD_DLL"
|
||||
}
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
("{COPY} %{cfg.buildtarget.relpath} ../bin/".. outputdir .. "/Sandbox")
|
||||
}
|
||||
filter "configurations:Debug"
|
||||
defines "FLUX_DEBUG"
|
||||
symbols "On"
|
||||
|
||||
filter "configurations:Release"
|
||||
defines "FLUX_RELEASE"
|
||||
optimize "On"
|
||||
|
||||
filter "configurations:Dist"
|
||||
defines "FLUX_DIST"
|
||||
optimize "On"
|
||||
|
||||
project "Sandbox"
|
||||
location "Sandbox"
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
|
||||
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
|
||||
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
|
||||
|
||||
files
|
||||
{
|
||||
"%{prj.name}/src/**.h",
|
||||
"%{prj.name}/src/**.cpp",
|
||||
}
|
||||
|
||||
includedirs
|
||||
{
|
||||
"FluxEngine/vendor/spdlog/include",
|
||||
"FluxEngine/src"
|
||||
}
|
||||
|
||||
links
|
||||
{
|
||||
"FluxEngine"
|
||||
}
|
||||
|
||||
filter "system:windows"
|
||||
cppdialect "C++20"
|
||||
staticruntime "on"
|
||||
systemversion "latest"
|
||||
defines
|
||||
{
|
||||
"FLUX_PLATFORM_WINDOWS"
|
||||
}
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines "FLUX_DEBUG"
|
||||
symbols "On"
|
||||
|
||||
filter "configurations:Release"
|
||||
defines "FLUX_RELEASE"
|
||||
optimize "On"
|
||||
|
||||
filter "configurations:Dist"
|
||||
defines "FLUX_DIST"
|
||||
optimize "On"
|
5
subprojects/spdlog.wrap
Normal file
5
subprojects/spdlog.wrap
Normal file
|
@ -0,0 +1,5 @@
|
|||
[wrap-git]
|
||||
url = https://github.com/gabime/spdlog.git
|
||||
revision = v1.15.2
|
||||
depth = 1
|
||||
method = cmake
|
27
vendor/bin/premake/LICENSE.txt
vendored
27
vendor/bin/premake/LICENSE.txt
vendored
|
@ -1,27 +0,0 @@
|
|||
Copyright (c) 2003-2022 Jason Perkins and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Premake nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
BIN
vendor/bin/premake/premake5.exe
vendored
BIN
vendor/bin/premake/premake5.exe
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue