Skip to content

Commit

Permalink
Updated cmake, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
deathkiller committed Dec 8, 2024
1 parent d25eed6 commit ee2ec88
Show file tree
Hide file tree
Showing 34 changed files with 845 additions and 204 deletions.
36 changes: 7 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ project(Jazz2

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
get_filename_component(PARENT_SOURCE_DIR ${CMAKE_SOURCE_DIR} DIRECTORY)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

if(NOT CMAKE_GENERATOR_PLATFORM OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "${CMAKE_SYSTEM_PROCESSOR}")
if(EMSCRIPTEN)
Expand Down Expand Up @@ -62,17 +63,16 @@ else()
endif()

include(ncine_options)
include(ncine_get_version)
include(ncine_imported_targets)
include(ncine_imgui)
include(ncine_tracy)

if(NOT IS_DIRECTORY ${NCINE_DATA_DIR})
message(WARNING "Content directory not found at: ${NCINE_DATA_DIR}")
else()
message(STATUS "Content directory: ${NCINE_DATA_DIR}")
endif()

include(ncine_get_version)
include(ncine_imported_targets)
include(ncine_imgui)
include(ncine_tracy)

if(NCINE_BUILD_ANDROID)
include(ncine_generated_sources)
Expand All @@ -81,6 +81,7 @@ if(NCINE_BUILD_ANDROID)
endif()

add_executable(${NCINE_APP})

if(WINDOWS_PHONE OR WINDOWS_STORE)
message(STATUS "Compiling for Windows RT")
else()
Expand Down Expand Up @@ -109,30 +110,7 @@ include(ncine_extra_sources)
include(ncine_generated_sources)

# Organize main project files into folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(PATH_PREFIX ${NCINE_SOURCE_DIR})
foreach(FILE ${HEADERS} ${SOURCES})
get_filename_component(PARENT_DIR "${FILE}" DIRECTORY)
string(LENGTH "${PATH_PREFIX}" PATH_PREFIX_LENGTH)
string(SUBSTRING "${PARENT_DIR}" 0 ${PATH_PREFIX_LENGTH} PATH_START)
if(PATH_START STREQUAL "${PATH_PREFIX}")
string(SUBSTRING "${PARENT_DIR}" ${PATH_PREFIX_LENGTH} -1 GROUP)
string(REPLACE "/" "\\" GROUP "${GROUP}")

# Group into "Source Files" and "Header Files"
if("${FILE}" MATCHES ".*\\.cpp")
set(GROUP "Source Files${GROUP}")
elseif("${FILE}" MATCHES ".*\\.h")
set(GROUP "Header Files${GROUP}")
endif()
else()
# Path doesn't have common prefix, put it into "Dependencies"
set(GROUP "Dependencies")
endif()

source_group("${GROUP}" FILES "${FILE}")
endforeach()

ncine_assign_source_group(PATH_PREFIX ${NCINE_SOURCE_DIR} FILES ${HEADERS} ${SOURCES})
foreach(SOURCE_FILE IN LISTS SHADER_FILES)
source_group("Shaders" FILES ${SOURCE_FILE})
endforeach()
Expand Down
10 changes: 6 additions & 4 deletions Sources/Jazz2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@
<ClInclude Include="$(ExtensionLibraryPath)\Threading\Spinlock.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Containers\Function.h" />
<ClInclude Include="$(ExtensionLibraryPath)\IO\EmscriptenFileStream.h" />
<ClInclude Include="$(ExtensionLibraryPath)\IO\Lz4Stream.h" />
<ClInclude Include="$(ExtensionLibraryPath)\IO\Compression\DeflateStream.h" />
<ClInclude Include="$(ExtensionLibraryPath)\IO\Compression\Lz4Stream.h" />
<ClInclude Include="$(ExtensionLibraryPath)\IO\Compression\ZstdStream.h" />
<ClInclude Include="Common.h" />
<ClInclude Include="Jazz2\Actors\ActorBase.h" />
<ClInclude Include="Jazz2\Actors\Collectibles\CarrotCollectible.h" />
Expand Down Expand Up @@ -702,7 +704,6 @@
<ClInclude Include="$(ExtensionLibraryPath)\Containers\StaticArray.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Containers\Tags.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Containers\DateTime.h" />
<ClInclude Include="$(ExtensionLibraryPath)\IO\DeflateStream.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Containers\SequenceHelpers.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Containers\StringUtils.h" />
<ClInclude Include="$(ExtensionLibraryPath)\Containers\StringConcatenable.h" />
Expand All @@ -729,7 +730,9 @@
<ClCompile Include="$(ExtensionLibraryPath)\Threading\Implementation\WaitOnAddress.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\Core\Logger.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\EmscriptenFileStream.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\Lz4Stream.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\Compression\DeflateStream.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\Compression\Lz4Stream.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\Compression\ZstdStream.cpp" />
<ClCompile Include="Jazz2\Actors\ActorBase.cpp" />
<ClCompile Include="Jazz2\Actors\Collectibles\CarrotCollectible.cpp" />
<ClCompile Include="Jazz2\Actors\Collectibles\CarrotFlyCollectible.cpp" />
Expand Down Expand Up @@ -1039,7 +1042,6 @@
<ClCompile Include="Jazz2\Tiles\TileSet.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\Containers\DateTime.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\DeflateStream.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\Containers\StringUtils.cpp" />
<ClCompile Include="$(ExtensionLibraryPath)\IO\BoundedFileStream.cpp" />
<ClCompile Include="simdjson\simdjson.cpp" />
Expand Down
32 changes: 22 additions & 10 deletions Sources/Jazz2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@
<Filter Include="Source Files\Shared\Core">
<UniqueIdentifier>{7de2dc9b-0c39-47b3-991e-9a71db70648a}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Shared\IO\Compression">
<UniqueIdentifier>{e87f0049-c3b9-47e3-98f4-c5a7f7817396}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Shared\IO\Compression">
<UniqueIdentifier>{fbd151b2-7efb-45b9-a98b-582cf95d2a3b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Resources.h">
Expand Down Expand Up @@ -1413,9 +1419,6 @@
<ClInclude Include="Jazz2\UI\LoadingHandler.h">
<Filter>Header Files\Jazz2\UI</Filter>
</ClInclude>
<ClInclude Include="$(ExtensionLibraryPath)\IO\DeflateStream.h">
<Filter>Header Files\Shared\IO</Filter>
</ClInclude>
<ClInclude Include="$(ExtensionLibraryPath)\Containers\SequenceHelpers.h">
<Filter>Header Files\Shared\Containers</Filter>
</ClInclude>
Expand Down Expand Up @@ -1533,8 +1536,14 @@
<ClInclude Include="$(ExtensionLibraryPath)\IO\EmscriptenFileStream.h">
<Filter>Header Files\Shared\IO</Filter>
</ClInclude>
<ClInclude Include="$(ExtensionLibraryPath)\IO\Lz4Stream.h">
<Filter>Header Files\Shared\IO</Filter>
<ClInclude Include="$(ExtensionLibraryPath)\IO\Compression\ZstdStream.h">
<Filter>Header Files\Shared\IO\Compression</Filter>
</ClInclude>
<ClInclude Include="$(ExtensionLibraryPath)\IO\Compression\DeflateStream.h">
<Filter>Header Files\Shared\IO\Compression</Filter>
</ClInclude>
<ClInclude Include="$(ExtensionLibraryPath)\IO\Compression\Lz4Stream.h">
<Filter>Header Files\Shared\IO\Compression</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -2456,9 +2465,6 @@
<ClCompile Include="Jazz2\UI\LoadingHandler.cpp">
<Filter>Source Files\Jazz2\UI</Filter>
</ClCompile>
<ClCompile Include="$(ExtensionLibraryPath)\IO\DeflateStream.cpp">
<Filter>Source Files\Shared\IO</Filter>
</ClCompile>
<ClCompile Include="$(ExtensionLibraryPath)\Containers\StringUtils.cpp">
<Filter>Source Files\Shared\Containers</Filter>
</ClCompile>
Expand Down Expand Up @@ -2522,8 +2528,14 @@
<ClCompile Include="$(ExtensionLibraryPath)\IO\EmscriptenFileStream.cpp">
<Filter>Source Files\Shared\IO</Filter>
</ClCompile>
<ClCompile Include="$(ExtensionLibraryPath)\IO\Lz4Stream.cpp">
<Filter>Source Files\Shared\IO</Filter>
<ClCompile Include="$(ExtensionLibraryPath)\IO\Compression\ZstdStream.cpp">
<Filter>Source Files\Shared\IO\Compression</Filter>
</ClCompile>
<ClCompile Include="$(ExtensionLibraryPath)\IO\Compression\DeflateStream.cpp">
<Filter>Source Files\Shared\IO\Compression</Filter>
</ClCompile>
<ClCompile Include="$(ExtensionLibraryPath)\IO\Compression\Lz4Stream.cpp">
<Filter>Source Files\Shared\IO\Compression</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion Sources/Jazz2/Compatibility/JJ2Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

#include <cstring>

#include <IO/DeflateStream.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death::IO::Compression;

namespace Jazz2::Compatibility
{
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/Compatibility/JJ2Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

#include <Containers/StringConcatenable.h>
#include <IO/FileSystem.h>
#include <IO/DeflateStream.h>
#include <IO/MemoryStream.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death;
using namespace Death::Containers::Literals;
using namespace Death::IO::Compression;
using namespace nCine;

namespace Jazz2::Compatibility
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/Compatibility/JJ2Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

#include <Containers/StringConcatenable.h>
#include <Containers/StringUtils.h>
#include <IO/DeflateStream.h>
#include <IO/FileSystem.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death::IO;
using namespace Death::IO::Compression;

namespace Jazz2::Compatibility
{
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/Compatibility/JJ2Tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
#include "JJ2Anims.h"
#include "JJ2Block.h"

#include <IO/DeflateStream.h>
#include <IO/FileSystem.h>
#include <IO/MemoryStream.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death::IO;
using namespace Death::IO::Compression;

namespace Jazz2::Compatibility
{
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/ContentResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@

#include <Containers/StringConcatenable.h>
#include <Containers/StringStlView.h>
#include <IO/DeflateStream.h>
#include <IO/MemoryStream.h>
#include <IO/Compression/DeflateStream.h>

#define SIMDJSON_EXCEPTIONS 0
#include "../simdjson/simdjson.h"

using namespace Death::IO::Compression;
using namespace simdjson;

template<class T>
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/Multiplayer/MultiLevelHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
#include <Utf8.h>
#include <Containers/StaticArray.h>
#include <IO/MemoryStream.h>
#include <IO/DeflateStream.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death::IO::Compression;
using namespace nCine;

namespace Jazz2::Multiplayer
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/PreferencesCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

#include <Containers/StringConcatenable.h>
#include <Environment.h>
#include <IO/DeflateStream.h>
#include <IO/FileSystem.h>
#include <IO/MemoryStream.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death::Containers::Literals;
using namespace Death::IO;
using namespace Death::IO::Compression;
using namespace nCine;

namespace Jazz2
Expand Down
2 changes: 1 addition & 1 deletion Sources/Jazz2/UI/Cinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "../../nCine/Base/FrameTimer.h"

#include <Containers/StringConcatenable.h>
#include <IO/DeflateStream.h>
#include <IO/Compression/DeflateStream.h>

namespace Jazz2::UI
{
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/UI/Cinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
#include "../../nCine/Audio/AudioStreamPlayer.h"
#include "../../nCine/Input/InputEvents.h"

#include <IO/DeflateStream.h>
#include <IO/MemoryStream.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death::IO;
using namespace Death::IO::Compression;

namespace Jazz2::UI
{
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/UI/Menu/CustomLevelSelectSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
# include "CreateServerOptionsSection.h"
#endif

#include <IO/DeflateStream.h>
#include <IO/MemoryStream.h>
#include <IO/Compression/DeflateStream.h>

using namespace Death::IO;
using namespace Death::IO::Compression;
using namespace Jazz2::UI::Menu::Resources;

namespace Jazz2::UI::Menu
Expand Down
3 changes: 2 additions & 1 deletion Sources/Jazz2/UI/Menu/HighscoresSection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <Utf8.h>
#include <Containers/StringConcatenable.h>
#include <IO/DeflateStream.h>
#include <IO/Compression/DeflateStream.h>

#if defined(DEATH_TARGET_ANDROID)
# include "../../../nCine/Backends/Android/AndroidApplication.h"
Expand All @@ -16,6 +16,7 @@
# include <pwd.h>
#endif

using namespace Death::IO::Compression;
using namespace Jazz2::UI::Menu::Resources;

namespace Jazz2::UI::Menu
Expand Down
2 changes: 1 addition & 1 deletion Sources/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ using namespace Jazz2::Multiplayer;
#include <Containers/StringConcatenable.h>
#include <Cpu.h>
#include <Environment.h>
#include <IO/DeflateStream.h>
#include <IO/FileSystem.h>
#include <IO/PakFile.h>
#include <IO/Compression/DeflateStream.h>

#if !defined(DEATH_DEBUG)
# include <IO/HttpRequest.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "DeflateStream.h"
#include "../Asserts.h"
#include "../../Asserts.h"

#if !defined(WITH_ZLIB) && !defined(WITH_MINIZ)
# pragma message("Death::IO::DeflateStream requires `zlib` or `miniz` library")
Expand All @@ -18,7 +18,7 @@
#include <algorithm>
#include <cstring>

namespace Death { namespace IO {
namespace Death { namespace IO { namespace Compression {
//###==##====#=====--==~--~=~- --- -- - - - -

DeflateStream::DeflateStream()
Expand Down Expand Up @@ -397,6 +397,6 @@ namespace Death { namespace IO {
return uncompressedSize + (5 * maxBlocks) + 1 + 8;
}

}}
}}}

#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "../Common.h"
#include "Stream.h"
#include "../../Common.h"
#include "../Stream.h"

#if defined(WITH_ZLIB) || defined(WITH_MINIZ)

Expand Down Expand Up @@ -29,7 +29,7 @@
# endif
#endif

namespace Death { namespace IO {
namespace Death { namespace IO { namespace Compression {
//###==##====#=====--==~--~=~- --- -- - - - -

/**
Expand Down Expand Up @@ -131,6 +131,7 @@ namespace Death { namespace IO {

std::int32_t WriteInternal(const void* buffer, std::int32_t bytesToWrite, bool finish);
};
}}

}}}

#endif
Loading

0 comments on commit ee2ec88

Please sign in to comment.