2022-01-18 22:35:33 +01:00
|
|
|
cmake_minimum_required(VERSION 3.22)
|
2021-12-23 22:23:39 +01:00
|
|
|
|
|
|
|
# Setup project
|
2021-12-24 18:57:03 +01:00
|
|
|
project(LwLibPROJECT)
|
2021-12-13 09:40:04 +01:00
|
|
|
|
2022-09-30 08:13:14 +02:00
|
|
|
if(NOT PROJECT_IS_TOP_LEVEL)
|
|
|
|
add_subdirectory(lwmem)
|
|
|
|
else()
|
|
|
|
add_executable(${PROJECT_NAME})
|
|
|
|
target_sources(${PROJECT_NAME} PUBLIC
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/dev/main.cpp
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/tests/lwmem_test.c
|
2024-10-09 05:27:10 +02:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/tests/lwmem_test_simple.c
|
2024-12-27 19:55:32 +01:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/tests/lwmem_test_region.c
|
2025-01-04 23:05:09 +01:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/tests/lwmem_test_available_mem.c
|
2022-09-30 08:13:14 +02:00
|
|
|
|
|
|
|
# win32 port
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/lwmem/src/system/lwmem_sys_win32.c
|
|
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/dev
|
|
|
|
)
|
|
|
|
|
|
|
|
# Add subdir with lwmem and link to the project
|
2024-03-19 21:34:24 +01:00
|
|
|
set(LWMEM_OPTS_FILE ${CMAKE_CURRENT_LIST_DIR}/dev/lwmem_opts.h)
|
2022-09-30 08:13:14 +02:00
|
|
|
add_subdirectory(lwmem)
|
2024-09-04 21:13:29 +02:00
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC lwmem_cpp)
|
|
|
|
|
|
|
|
# Add compile options to the library, which will propagate options to executable through public link
|
|
|
|
target_compile_definitions(lwmem PUBLIC WIN32 _DEBUG CONSOLE LWMEM_DEV)
|
|
|
|
target_compile_options(lwmem PUBLIC -Wall -Wextra -Wpedantic)
|
2021-12-24 15:19:24 +01:00
|
|
|
endif()
|