add tests.
This commit is contained in:
@@ -9,6 +9,10 @@ set(CMAKE_C_STANDARD 11)
|
|||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
|
||||||
|
|
||||||
|
option(ENABLE_TESTS "Enable tests" ON)
|
||||||
|
|
||||||
|
|
||||||
|
# Set target system
|
||||||
if(NOT DEFINED DUSK_TARGET_SYSTEM)
|
if(NOT DEFINED DUSK_TARGET_SYSTEM)
|
||||||
set(DUSK_TARGET_SYSTEM "linux")
|
set(DUSK_TARGET_SYSTEM "linux")
|
||||||
# set(DUSK_TARGET_SYSTEM "psp")
|
# set(DUSK_TARGET_SYSTEM "psp")
|
||||||
@@ -27,9 +31,10 @@ set(DUSK_DATA_DIR "${DUSK_ROOT_DIR}/data")
|
|||||||
set(DUSK_ASSETS_DIR "${DUSK_ROOT_DIR}/assets")
|
set(DUSK_ASSETS_DIR "${DUSK_ROOT_DIR}/assets")
|
||||||
set(DUSK_BUILT_ASSETS_DIR "${DUSK_BUILD_DIR}/built_assets" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
set(DUSK_BUILT_ASSETS_DIR "${DUSK_BUILD_DIR}/built_assets" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
set(DUSK_GENERATED_HEADERS_DIR "${DUSK_BUILD_DIR}/generated")
|
set(DUSK_GENERATED_HEADERS_DIR "${DUSK_BUILD_DIR}/generated")
|
||||||
set(DUSK_TARGET_NAME "Dusk" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
|
||||||
set(DUSK_BUILD_BINARY ${DUSK_BUILD_DIR}/Dusk CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
set(DUSK_BUILD_BINARY ${DUSK_BUILD_DIR}/Dusk CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
set(DUSK_ASSETS "" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
set(DUSK_ASSETS "" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
set(DUSK_LIBRARY_TARGET_NAME "DuskCore" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
set(DUSK_BINARY_TARGET_NAME "Dusk" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
||||||
|
|
||||||
# Create directories
|
# Create directories
|
||||||
file(MAKE_DIRECTORY ${DUSK_GENERATED_HEADERS_DIR})
|
file(MAKE_DIRECTORY ${DUSK_GENERATED_HEADERS_DIR})
|
||||||
@@ -42,14 +47,23 @@ if(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
|||||||
find_package(pspsdk REQUIRED)
|
find_package(pspsdk REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Init Project
|
# Init Project.
|
||||||
project(${DUSK_TARGET_NAME}
|
project(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
VERSION 1.0.0
|
VERSION 1.0.0
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
)
|
)
|
||||||
|
|
||||||
# Executable
|
# MainLibrary
|
||||||
add_executable(${DUSK_TARGET_NAME})
|
add_library(${DUSK_LIBRARY_TARGET_NAME})
|
||||||
|
|
||||||
|
# Binary Executable
|
||||||
|
add_executable(${DUSK_BINARY_TARGET_NAME})
|
||||||
|
|
||||||
|
# Link library to binary and test
|
||||||
|
target_link_libraries(${DUSK_BINARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
# Add tools
|
# Add tools
|
||||||
add_subdirectory(tools)
|
add_subdirectory(tools)
|
||||||
@@ -61,7 +75,7 @@ add_subdirectory(assets)
|
|||||||
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
target_link_libraries(${DUSK_TARGET_NAME} PRIVATE
|
target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PRIVATE
|
||||||
SDL2
|
SDL2
|
||||||
OpenGL::GL
|
OpenGL::GL
|
||||||
GL
|
GL
|
||||||
@@ -70,7 +84,7 @@ if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
|||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
target_link_libraries(${DUSK_TARGET_NAME} PUBLIC
|
target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
||||||
${SDL2_LIBRARIES}
|
${SDL2_LIBRARIES}
|
||||||
SDL2
|
SDL2
|
||||||
OpenGL::GL
|
OpenGL::GL
|
||||||
@@ -81,7 +95,7 @@ elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
|||||||
mbedcrypto
|
mbedcrypto
|
||||||
lzma
|
lzma
|
||||||
)
|
)
|
||||||
target_include_directories(${DUSK_TARGET_NAME} PRIVATE
|
target_include_directories(${DUSK_LIBRARY_TARGET_NAME} PRIVATE
|
||||||
${SDL2_INCLUDE_DIRS}
|
${SDL2_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@@ -89,6 +103,12 @@ endif()
|
|||||||
# Add code
|
# Add code
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
# Handle tests
|
||||||
|
if(ENABLE_TESTS)
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Build assets
|
# Build assets
|
||||||
add_custom_target(DUSK_ASSETS_BUILT ALL
|
add_custom_target(DUSK_ASSETS_BUILT ALL
|
||||||
COMMAND
|
COMMAND
|
||||||
@@ -99,21 +119,21 @@ add_custom_target(DUSK_ASSETS_BUILT ALL
|
|||||||
--headers-dir ${DUSK_GENERATED_HEADERS_DIR}
|
--headers-dir ${DUSK_GENERATED_HEADERS_DIR}
|
||||||
--input ${DUSK_ASSETS}
|
--input ${DUSK_ASSETS}
|
||||||
)
|
)
|
||||||
add_dependencies(${DUSK_TARGET_NAME} DUSK_ASSETS_BUILT)
|
add_dependencies(${DUSK_LIBRARY_TARGET_NAME} DUSK_ASSETS_BUILT)
|
||||||
|
|
||||||
# Include generated headers
|
# Include generated headers
|
||||||
target_include_directories(${DUSK_TARGET_NAME} PUBLIC
|
target_include_directories(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
||||||
${DUSK_GENERATED_HEADERS_DIR}
|
${DUSK_GENERATED_HEADERS_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Postbuild
|
# Postbuild
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
if(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
||||||
create_pbp_file(
|
create_pbp_file(
|
||||||
TARGET "${DUSK_TARGET_NAME}"
|
TARGET "${DUSK_LIBRARY_TARGET_NAME}"
|
||||||
ICON_PATH NULL
|
ICON_PATH NULL
|
||||||
BACKGROUND_PATH NULL
|
BACKGROUND_PATH NULL
|
||||||
PREVIEW_PATH NULL
|
PREVIEW_PATH NULL
|
||||||
TITLE "${DUSK_TARGET_NAME}"
|
TITLE "${DUSK_LIBRARY_TARGET_NAME}"
|
||||||
PSAR_PATH ${DUSK_BUILD_DIR}/dusk.dsk
|
PSAR_PATH ${DUSK_BUILD_DIR}/dusk.dsk
|
||||||
VERSION 01.00
|
VERSION 01.00
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# This software is released under the MIT License.
|
# This software is released under the MIT License.
|
||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
set(DUSK_GAME_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL ${DUSK_CACHE_TARGET})
|
set(DUSK_GAME_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Game assets directory")
|
||||||
|
|
||||||
# Palette asset needs to be added before any images.
|
# Palette asset needs to be added before any images.
|
||||||
add_subdirectory(palette)
|
add_subdirectory(palette)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ if(Lua_FOUND AND NOT TARGET Lua::Lua)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Libs
|
# Libs
|
||||||
target_link_libraries(${DUSK_TARGET_NAME}
|
target_link_libraries(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
m
|
m
|
||||||
cglm
|
cglm
|
||||||
@@ -28,21 +28,23 @@ target_link_libraries(${DUSK_TARGET_NAME}
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
target_include_directories(${DUSK_TARGET_NAME}
|
target_include_directories(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
${CMAKE_CURRENT_LIST_DIR}
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
|
||||||
PRIVATE
|
# Main Binary Source
|
||||||
|
target_sources(${DUSK_BINARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
main.c
|
main.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# Defs
|
# Defs
|
||||||
add_defs(duskdefs.env duskdefs.h)
|
add_defs(duskdefs.env duskdefs.h)
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
DUSK_TARGET_SYSTEM="${DUSK_TARGET_SYSTEM}"
|
DUSK_TARGET_SYSTEM="${DUSK_TARGET_SYSTEM}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
assert.c
|
assert.c
|
||||||
)
|
)
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
asset.c
|
asset.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
assetalphaimage.c
|
assetalphaimage.c
|
||||||
assetpaletteimage.c
|
assetpaletteimage.c
|
||||||
assetlanguage.c
|
assetlanguage.c
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
debug.c
|
debug.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
display.c
|
display.c
|
||||||
framebuffer.c
|
framebuffer.c
|
||||||
camera.c
|
camera.c
|
||||||
@@ -20,16 +20,16 @@ add_subdirectory(palette)
|
|||||||
add_subdirectory(tileset)
|
add_subdirectory(tileset)
|
||||||
|
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
DISPLAY_SDL2=1
|
DISPLAY_SDL2=1
|
||||||
DISPLAY_WINDOW_WIDTH_DEFAULT=1080
|
DISPLAY_WINDOW_WIDTH_DEFAULT=1080
|
||||||
DISPLAY_WINDOW_HEIGHT_DEFAULT=810
|
DISPLAY_WINDOW_HEIGHT_DEFAULT=810
|
||||||
DISPLAY_SCREEN_HEIGHT_DEFAULT=270
|
DISPLAY_SCREEN_HEIGHT_DEFAULT=270
|
||||||
)
|
)
|
||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
DISPLAY_SDL2=1
|
DISPLAY_SDL2=1
|
||||||
DISPLAY_WINDOW_WIDTH_DEFAULT=480
|
DISPLAY_WINDOW_WIDTH_DEFAULT=480
|
||||||
DISPLAY_WINDOW_HEIGHT_DEFAULT=272
|
DISPLAY_WINDOW_HEIGHT_DEFAULT=272
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
mesh.c
|
mesh.c
|
||||||
quad.c
|
quad.c
|
||||||
)
|
)
|
||||||
@@ -4,6 +4,6 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
)
|
)
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
tileset.c
|
tileset.c
|
||||||
)
|
)
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
engine.c
|
engine.c
|
||||||
)
|
)
|
||||||
@@ -6,7 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "display/display.h"// Important to be included first.
|
|
||||||
|
// Important to be included first:
|
||||||
|
#include "display/display.h"
|
||||||
#include "error/error.h"
|
#include "error/error.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
error.c
|
error.c
|
||||||
)
|
)
|
||||||
@@ -4,24 +4,24 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
input.c
|
input.c
|
||||||
inputbutton.c
|
inputbutton.c
|
||||||
inputaction.c
|
inputaction.c
|
||||||
)
|
)
|
||||||
|
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
INPUT_SDL2=1
|
INPUT_SDL2=1
|
||||||
INPUT_KEYBOARD=1
|
INPUT_KEYBOARD=1
|
||||||
INPUT_MOUSE=1
|
INPUT_MOUSE=1
|
||||||
INPUT_GAMEPAD=1
|
INPUT_GAMEPAD=1
|
||||||
)
|
)
|
||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
INPUT_SDL2=1
|
INPUT_SDL2=1
|
||||||
INPUT_GAMEPAD=1
|
INPUT_GAMEPAD=1
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
localemanager.c
|
localemanager.c
|
||||||
)
|
)
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
rpg.c
|
rpg.c
|
||||||
rpgcamera.c
|
rpgcamera.c
|
||||||
rpgtextbox.c
|
rpgtextbox.c
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
cutscenesystem.c
|
cutscenesystem.c
|
||||||
cutscenemode.c
|
cutscenemode.c
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
cutsceneitem.c
|
cutsceneitem.c
|
||||||
)
|
)
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
entity.c
|
entity.c
|
||||||
entityanim.c
|
entityanim.c
|
||||||
npc.c
|
npc.c
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
chunk.c
|
chunk.c
|
||||||
map.c
|
map.c
|
||||||
worldpos.c
|
worldpos.c
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
scenemanager.c
|
scenemanager.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
scenetest.c
|
scenetest.c
|
||||||
scenemap.c
|
scenemap.c
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
scriptmanager.c
|
scriptmanager.c
|
||||||
scriptcontext.c
|
scriptcontext.c
|
||||||
scriptmodule.c
|
scriptmodule.c
|
||||||
|
|||||||
@@ -4,21 +4,21 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
thread.c
|
thread.c
|
||||||
threadmutex.c
|
threadmutex.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# Compiler flags.
|
# Compiler flags.
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
THREAD_PTHREAD=1
|
THREAD_PTHREAD=1
|
||||||
)
|
)
|
||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
THREAD_PTHREAD=1
|
THREAD_PTHREAD=1
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@@ -4,21 +4,21 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
time.c
|
time.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# Compiler defs
|
# Compiler defs
|
||||||
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
TIME_SDL2=1
|
TIME_SDL2=1
|
||||||
TIME_FIXED=0
|
TIME_FIXED=0
|
||||||
)
|
)
|
||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
|
||||||
target_compile_definitions(${DUSK_TARGET_NAME}
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
TIME_FIXED=1
|
TIME_FIXED=1
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
ui.c
|
ui.c
|
||||||
uitext.c
|
uitext.c
|
||||||
uidebug.c
|
uidebug.c
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
)
|
)
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
# Sources
|
# Sources
|
||||||
target_sources(${DUSK_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PRIVATE
|
PUBLIC
|
||||||
memory.c
|
memory.c
|
||||||
string.c
|
string.c
|
||||||
math.c
|
math.c
|
||||||
|
|||||||
10
test/CMakeLists.txt
Normal file
10
test/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Copyright (c) 2025 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
add_executable(test_main test_main.c)
|
||||||
|
target_include_directories(test_main PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
target_link_libraries(test_main PUBLIC ${DUSK_LIBRARY_TARGET_NAME})
|
||||||
|
add_test( NAME tests1 COMMAND test_main)
|
||||||
11
test/test_main.c
Normal file
11
test/test_main.c
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
// return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -27,5 +27,5 @@ function(add_defs INPUT_PATH OUTPUT_NAME_RELATIVE)
|
|||||||
COMMENT "Generating ${OUTPUT_NAME_RELATIVE}"
|
COMMENT "Generating ${OUTPUT_NAME_RELATIVE}"
|
||||||
)
|
)
|
||||||
add_custom_target(${OUTPUT_NAME_RELATIVE}_header DEPENDS ${OUTPUT_FULL_PATH})
|
add_custom_target(${OUTPUT_NAME_RELATIVE}_header DEPENDS ${OUTPUT_FULL_PATH})
|
||||||
add_dependencies(${DUSK_TARGET_NAME} ${OUTPUT_NAME_RELATIVE}_header)
|
add_dependencies(${DUSK_LIBRARY_TARGET_NAME} ${OUTPUT_NAME_RELATIVE}_header)
|
||||||
endfunction()
|
endfunction()
|
||||||
Reference in New Issue
Block a user