diff --git a/00-build-cache-debug-x64 b/00-build-cache-debug-x64 index f708f79..14d7ec1 100755 --- a/00-build-cache-debug-x64 +++ b/00-build-cache-debug-x64 @@ -2,10 +2,10 @@ cmake \ -DCMAKE_SIZEOF_VOID_P=8 \ - -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_MAKE_PROGRAM=ninja \ -DCMAKE_C_COMPILER=cc \ -DCMAKE_C_FLAGS=-m64 \ -G Ninja \ -S . \ - -B ./build/Debug + -B ./build/$BUILD_TYPE diff --git a/01-build-executable b/01-build-executable new file mode 100755 index 0000000..de52b3c --- /dev/null +++ b/01-build-executable @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +if [ "$BUILD_TYPE" = "" ] +then + echo "No build type specified. Try Debug or Release." + exit +fi + +if [ "$EXECUTABLE" = "" ] +then + echo "No executable specified. Refer to CMakeLists.txt for available executables to build." + exit +fi + +cmake --build "./build/$BUILD_TYPE" -t "$EXECUTABLE" diff --git a/01-build-game b/01-build-game deleted file mode 100755 index e995a64..0000000 --- a/01-build-game +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -cmake --build build/Debug -t game diff --git a/02-build-server b/02-build-server deleted file mode 100755 index 0be2f80..0000000 --- a/02-build-server +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -cmake --build build/Debug -t server diff --git a/03-run-tests b/03-run-tests new file mode 100644 index 0000000..b8c2b5b --- /dev/null +++ b/03-run-tests @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +if [ "$BUILD_TYPE" = "" ] +then + return 1 +fi +cmake --build "./build/$BUILD_TYPE" -t server diff --git a/CMakeLists.txt b/CMakeLists.txt index 44dcf1e..6391978 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ target_link_libraries( ) add_executable( - game-test-geometry + test-game-geometry subprojects/bdd-for-c/bdd-for-c.h subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h @@ -229,7 +229,7 @@ add_executable( ) add_executable( - game-test-input + test-game-input subprojects/bdd-for-c/bdd-for-c.h subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h @@ -265,13 +265,13 @@ add_executable( ) target_link_libraries( - game-test-input + test-game-input SDL2main SDL2 ) add_executable( - game-test-output + test-game-output subprojects/bdd-for-c/bdd-for-c.h subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h @@ -286,7 +286,7 @@ add_executable( ) add_executable( - game-test-memory + test-game-memory subprojects/bdd-for-c/bdd-for-c.h subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h @@ -310,13 +310,13 @@ add_executable( ) target_link_libraries( - game-test-memory + test-game-memory SDL2main SDL2 ) add_executable( - game-test-data + test-game-data subprojects/bdd-for-c/bdd-for-c.h subprojects/bdd-for-c-mocks/bdd-for-c-mocks.h @@ -329,7 +329,7 @@ add_executable( ) target_link_libraries( - game-test-data + test-game-data SDL2main SDL2 ) @@ -443,10 +443,10 @@ if (IZ_PLATFORM STREQUAL "WINDOWS") "${CMAKE_HOME_DIRECTORY}/dependencies/openssl/${IZ_PROJECT_ARCH}/bin/libcrypto-1_1-${IZ_SDL_ARCH}.dll" $) - add_custom_command(TARGET game-test-input POST_BUILD + add_custom_command(TARGET test-game-input POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_HOME_DIRECTORY}/subprojects/SDL/VisualC/${IZ_SDL_ARCH}/${CMAKE_BUILD_TYPE}/SDL2.dll" - $) + $) endif () add_custom_command(TARGET game POST_BUILD diff --git a/README.md b/README.md index ced349e..0ebd6e4 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The following are required for building on all platforms: 5. Generate the CMake cache. - ```shell + ```batch cmake^ -DCMAKE_SIZEOF_VOID_P=8^ "-DCMAKE_MT=%CMAKE_MT%"^ @@ -48,6 +48,12 @@ The following are required for building on all platforms: 6. Build the specific executables you want to build, which are defined in `CMakeLists.txt`. + ```batch + cmake^ + --build "./build/%BUILD_TYPE%"^ + -t "%EXECUTABLE%" + ``` + ### macOS/*NIX 1. Ensure additional tools are present in the system: @@ -64,15 +70,21 @@ The following are required for building on all platforms: ```shell cmake \ -DCMAKE_SIZEOF_VOID_P=8 \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \ -DCMAKE_MAKE_PROGRAM=ninja \ -DCMAKE_C_COMPILER=cc \ -DCMAKE_C_FLAGS=-m64 \ -G Ninja \ -S . \ - -B ./build/$BUILD_TYPE + -B "./build/$BUILD_TYPE" ``` > **Important:** Create the directories under `/build` per each `BUILD_TYPE` you are generating. 5. Build the specific executables you want to build, which are defined in `CMakeLists.txt`. + + ```shell + cmake \ + --build "./build/$BUILD_TYPE" \ + -t "$EXECUTABLE" + ``` diff --git a/TODO.md b/TODO.md index d111c48..33eb192 100644 --- a/TODO.md +++ b/TODO.md @@ -2,6 +2,8 @@ - [X] Unify memset/memcpy/free/malloc functions (remove SDL/lws dependency) - [ ] Revisit unit tests - [ ] Implement character sprites + animations + - [ ] Finalize initial character sprite for rendering + - [ ] Acquire Affinity Designer (so we can move on from Corel) - [ ] Implement memory pool - [ ] Fix gamepad mapping - [ ] Provide default mapping diff --git a/src/packages/log/IZ_log.c b/src/packages/log/IZ_log.c index dae993d..70a81d1 100644 --- a/src/packages/log/IZ_log.c +++ b/src/packages/log/IZ_log.c @@ -48,16 +48,17 @@ void IZ_LogInitialize(const char* context, bool force_output) { stderr_dest = stderr; #else const char* log_dir = "logs"; - if (!IZ_isdir(log_dir)) { - IZ_mkdir(log_dir); + char base_log_dir[128]; + sprintf(base_log_dir, "%s/%s", SDL_GetBasePath(), log_dir); + if (!IZ_isdir(base_log_dir)) { + IZ_mkdir(base_log_dir); } char stdout_filename[128] = ""; char stderr_filename[128] = ""; char* now = IZ_TimerNowPathSafe(); - // fixme - sprintf(stdout_filename, "%s/%s-out-%s.log", log_dir, context, now); - sprintf(stderr_filename, "%s/%s-err-%s.log", log_dir, context, now); + sprintf(stdout_filename, "%s/%s-out-%s.log", base_log_dir, context, now); + sprintf(stderr_filename, "%s/%s-err-%s.log", base_log_dir, context, now); IZ_fopen(&stdout_dest, stdout_filename, "a"); IZ_fopen(&stderr_dest, stderr_filename, "a"); #endif diff --git a/src/packages/log/IZ_log.h b/src/packages/log/IZ_log.h index ee628d4..ebacf70 100644 --- a/src/packages/log/IZ_log.h +++ b/src/packages/log/IZ_log.h @@ -16,6 +16,7 @@ #define IZ_LOG_LEVEL_FLAG_WARN #define IZ_LOG_LEVEL_FLAG_ERROR +#include #if defined IZ_WINDOWS #include #include diff --git a/src/packages/stdinc/IZ_string.c b/src/packages/stdinc/IZ_string.c index a53ebe1..9f15923 100644 --- a/src/packages/stdinc/IZ_string.c +++ b/src/packages/stdinc/IZ_string.c @@ -26,7 +26,7 @@ errno_t IZ_strlwr(char* dest, const char* str, rsize_t str_size) { } return _strlwr_s(dest, str_size); #else - memcpy(dest, str, str_size -1); + memcpy(dest, str, str_size - 1); for (unsigned int i = 0; i < str_size; i += 1) { if ('A' <= dest[i] && dest[i] <= 'Z') { dest[i] += 0x20; diff --git a/subprojects/midi-utils b/subprojects/midi-utils index dc3396c..04b34ae 160000 --- a/subprojects/midi-utils +++ b/subprojects/midi-utils @@ -1 +1 @@ -Subproject commit dc3396c806d500802cb8a8dad15d3e46a9621954 +Subproject commit 04b34ae8ffd6527c0d9f87a09e96e09d0fc59f7f