Kaynağa Gözat

Clean up the sys/init.h header

wip/deprecate
Sam Hocevar 2 yıl önce
ebeveyn
işleme
7f2eebe945
6 değiştirilmiş dosya ile 84 ekleme ve 65 silme
  1. +8
    -19
      src/Makefile.am
  2. +11
    -17
      src/include/lol/engine/private/sys/init.h
  3. +15
    -0
      src/include/lol/engine/sys
  4. +3
    -0
      src/lol-core.vcxproj
  5. +22
    -4
      src/lol-core.vcxproj.filters
  6. +25
    -25
      src/sys/init.cpp

+ 8
- 19
src/Makefile.am Dosyayı Görüntüle

@@ -19,27 +19,16 @@ liblol_core_la_SOURCES = \
liblol_core_la_CPPFLAGS = $(AM_CPPFLAGS)
liblol_core_la_LDFLAGS = $(AM_LDFLAGS)

liblol_core_headers =
liblol_core_headers = \
src/include/lol/engine/net \
src/include/lol/engine/sys \
\
src/include/lol/engine/private/net/http.h \
src/include/lol/engine/private/sys/init.h

liblol_core_sources = \
base/assert.cpp base/engine.cpp base/log.cpp \
\
audio/audio.cpp \
\
sys/init.cpp \
\
image/resource.cpp image/resource-private.h \
image/image.cpp image/image-private.h image/kernel.cpp image/pixel.cpp \
image/crop.cpp image/resample.cpp image/noise.cpp image/combine.cpp \
image/codec/gdiplus-image.cpp image/codec/imlib2-image.cpp \
image/codec/sdl-image.cpp image/codec/ios-image.cpp \
image/codec/oric-image.cpp image/codec/dummy-image.cpp \
image/dither/random.cpp image/dither/ediff.cpp image/dither/dbs.cpp \
image/dither/ostromoukhov.cpp image/dither/ordered.cpp \
image/filter/convolution.cpp image/filter/colors.cpp \
image/filter/dilate.cpp image/filter/median.cpp image/filter/yuv.cpp \
image/movie.cpp \
net/http.cpp \
\
net/http.cpp
sys/init.cpp

include 3rdparty/lol-imgui.am

src/legacy/lol/sys/init.h → src/include/lol/engine/private/sys/init.h Dosyayı Görüntüle

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010–2024 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -19,13 +19,10 @@

#include <string> // std::string

namespace lol
{

/*
* Module-specific macros. These can be overridden by the build process,
* typically with compiler command-line flags.
*/
//
// Module-specific macros. These can be overridden by the build process,
// typically with compiler command-line flags.
//

#if !defined LOL_CONFIG_PROJECTDIR
# define LOL_CONFIG_PROJECTDIR ""
@@ -39,12 +36,12 @@ namespace lol
# define LOL_CONFIG_SOURCESUBDIR ""
#endif

/*
* System namespace. The platform-specific stuff in there makes the API
* not as clean as the rest of the framework.
*/
//
// System namespace. The platform-specific stuff in there makes the API
// not as clean as the rest of the framework.
//

namespace sys
namespace lol::sys
{

extern void init(int argc, char *argv[],
@@ -55,7 +52,4 @@ extern void init(int argc, char *argv[],
extern void add_data_dir(std::string const &dir);
extern std::string get_data_path(std::string const &file);

} /* namespace sys */

} /* namespace lol */

} // namespace lol::sys

+ 15
- 0
src/include/lol/engine/sys Dosyayı Görüntüle

@@ -0,0 +1,15 @@
//
// Lol Engine
//
// Copyright © 2010–2024 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#pragma once

#include "private/sys/init.h"

+ 3
- 0
src/lol-core.vcxproj Dosyayı Görüntüle

@@ -96,10 +96,13 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="net\http.cpp" />
<ClCompile Include="sys\init.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\lol\engine\net" />
<ClInclude Include="include\lol\engine\private\net\http.h" />
<ClInclude Include="include\lol\engine\private\sys\init.h" />
<ClInclude Include="include\lol\engine\sys" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am">


+ 22
- 4
src/lol-core.vcxproj.filters Dosyayı Görüntüle

@@ -4,13 +4,22 @@
<ClCompile Include="net\http.cpp">
<Filter>net</Filter>
</ClCompile>
<ClCompile Include="sys\init.cpp">
<Filter>sys</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\lol\engine\private\net\http.h">
<Filter>lol\private\net</Filter>
<Filter>lol\engine\private\net</Filter>
</ClInclude>
<ClInclude Include="include\lol\engine\private\sys\init.h">
<Filter>lol\engine\private\sys</Filter>
</ClInclude>
<ClInclude Include="include\lol\engine\net">
<Filter>lol</Filter>
<Filter>lol\engine</Filter>
</ClInclude>
<ClInclude Include="include\lol\engine\sys">
<Filter>lol\engine</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
@@ -26,11 +35,20 @@
<Filter Include="net">
<UniqueIdentifier>{0db6de04-6778-43ed-81c6-0ac49c0481f4}</UniqueIdentifier>
</Filter>
<Filter Include="lol\private">
<Filter Include="lol\engine">
<UniqueIdentifier>{35a2d521-3163-4f70-9d89-7a126106747e}</UniqueIdentifier>
</Filter>
<Filter Include="lol\engine\private">
<UniqueIdentifier>{d6f32a69-7475-4270-9d5b-775cd2c43517}</UniqueIdentifier>
</Filter>
<Filter Include="lol\private\net">
<Filter Include="lol\engine\private\net">
<UniqueIdentifier>{59f31039-b311-4ebf-a900-e0f7567eb636}</UniqueIdentifier>
</Filter>
<Filter Include="lol\engine\private\sys">
<UniqueIdentifier>{9f7a0c33-3dd7-40d2-906a-0dfb34a472fe}</UniqueIdentifier>
</Filter>
<Filter Include="sys">
<UniqueIdentifier>{26a736fb-5b33-4b65-9991-01c0976d2206}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

+ 25
- 25
src/sys/init.cpp Dosyayı Görüntüle

@@ -10,7 +10,7 @@
// See http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>
#include <lol/engine/sys>
#include <lol/msg>

#include <vector> // std::vector
@@ -42,10 +42,10 @@ void init(int argc, char *argv[],
msg::debug("solution dir: “%s”\n", solutiondir.c_str());
msg::debug("source subdir: “%s”\n", sourcesubdir.c_str());

/*
* Retrieve binary directory, defaulting to no directory on Android
* and emscripten, and the current directory on other platforms.
*/
//
// Retrieve binary directory, defaulting to no directory on Android
// and emscripten, and the current directory on other platforms.
//

#if __ANDROID__ || __EMSCRIPTEN__ || __NX__
std::string binarydir = "";
@@ -62,14 +62,14 @@ void init(int argc, char *argv[],

bool got_rootdir = false;

/*
* If project dir and solution dir are set, add them to data; also
* add current directory in case we were launched from another place.
*/
//
// If project dir and solution dir are set, add them to data; also
// add current directory in case we were launched from another place.
//

if (!got_rootdir && projectdir.length() && solutiondir.length())
{
/* This data dir is for standalone executables */
// This data dir is for standalone executables
std::string rootdir = binarydir;
#if !__NX__
if (rootdir.length() && rootdir.back() != SEPARATOR)
@@ -77,21 +77,21 @@ void init(int argc, char *argv[],
add_data_dir(rootdir);
#endif

/* This data dir is for engine stuff */
// This data dir is for engine stuff
rootdir = solutiondir;
if (rootdir.length() && rootdir.back() != SEPARATOR)
rootdir += SEPARATOR;
rootdir += "../src/"; /* FIXME: use SEPARATOR? */
rootdir += "../src/"; // FIXME: use SEPARATOR?
add_data_dir(rootdir);

/* This data dir is for submodule support stuff */
// This data dir is for submodule support stuff
rootdir = solutiondir;
if (rootdir.length() && rootdir.back() != SEPARATOR)
rootdir += SEPARATOR;
rootdir += "./lol/src/"; /* FIXME: use SEPARATOR? */
rootdir += "./lol/src/"; // FIXME: use SEPARATOR?
add_data_dir(rootdir);

/* This data dir is for project-specific stuff */
// This data dir is for project-specific stuff
rootdir = projectdir;
if (rootdir.length() && rootdir.back() != SEPARATOR)
rootdir += SEPARATOR;
@@ -100,14 +100,14 @@ void init(int argc, char *argv[],
got_rootdir = true;
}

/*
* If no project dir, use the executable location as the starting point
* to guess the data dir.
*/
//
// If no project dir, use the executable location as the starting point
// to guess the data dir.
//
if (!got_rootdir)
{
/* First climb back the hierarchy to get to the engine root and
* add a data dir for engine stuff. */
// First climb back the hierarchy to get to the engine root and
// add a data dir for engine stuff.
std::string rootdir = binarydir;
if (rootdir.length() && rootdir.back() != SEPARATOR)
rootdir += SEPARATOR;
@@ -121,7 +121,7 @@ void init(int argc, char *argv[],
rootdir += "src/";
add_data_dir(rootdir);

/* This data dir is for project-specific stuff */
// This data dir is for project-specific stuff
rootdir = binarydir;
add_data_dir(rootdir);

@@ -134,9 +134,9 @@ void init(int argc, char *argv[],
data_dir[i].c_str());
}

/*
* Data directory handling
*/
//
// Data directory handling
//

void add_data_dir(std::string const &dir)
{


Yükleniyor…
İptal
Kaydet