AOC2023: update buildsystem

This commit is contained in:
Bananymous 2023-12-01 12:37:09 +02:00
parent c140dd2a65
commit 3aaa755c51
3 changed files with 25 additions and 18 deletions

View File

@ -13,6 +13,7 @@ set(BANAN_BASE_SYSROOT ${CMAKE_SOURCE_DIR}/base-sysroot.tar.gz)
set(BANAN_INCLUDE ${BANAN_SYSROOT}/usr/include)
set(BANAN_LIB ${BANAN_SYSROOT}/usr/lib)
set(BANAN_BIN ${BANAN_SYSROOT}/usr/bin)
set(BANAN_SHARE ${BANAN_SYSROOT}/usr/share)
set(BANAN_BOOT ${BANAN_SYSROOT}/boot)
add_subdirectory(kernel)

View File

@ -6,19 +6,20 @@ set(AOC2023_PROJECTS
day1
)
set(BANAN_AOC2023_BIN ${BANAN_BIN}/aoc2023)
set(BANAN_AOC2023_INPUT ${BANAN_SHARE}/aoc2023)
add_custom_target(aoc2023)
add_custom_target(aoc2023_always
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_AOC2023_BIN}
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_AOC2023_INPUT}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/input/* ${BANAN_AOC2023_INPUT}/
)
add_custom_target(aoc2023-install DEPENDS aoc2023 aoc2023_always)
foreach(AOC2023_PROJECT ${AOC2023_PROJECTS})
add_subdirectory(${AOC2023_PROJECT})
endforeach()
add_custom_target(aoc2023)
add_custom_target(aoc2023-install DEPENDS aoc2023)
foreach(AOC2023_PROJECT ${AOC2023_PROJECTS})
target_compile_options(${AOC2023_PROJECT} PRIVATE -g)
add_dependencies(${AOC2023_PROJECT} libc-install ban-install )
add_dependencies(aoc2023 ${AOC2023_PROJECT})
add_dependencies(aoc2023-install ${AOC2023_PROJECT}-install)
endforeach()
add_dependencies(userspace aoc2023)
add_dependencies(userspace-install aoc2023-install)

View File

@ -1,17 +1,22 @@
cmake_minimum_required(VERSION 3.26)
project(day1 CXX)
project(aoc2023_day1 CXX)
set(SOURCES
main.cpp
)
add_executable(day1 ${SOURCES})
target_compile_options(day1 PUBLIC -O2 -g)
target_link_libraries(day1 PUBLIC libc)
add_executable(aoc2023_day1 ${SOURCES})
target_compile_options(aoc2023_day1 PUBLIC -O2 -g)
target_link_libraries(aoc2023_day1 PUBLIC libc)
add_custom_target(day1-install
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_BIN}/aoc2023
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/day1 ${BANAN_BIN}/aoc2023/
DEPENDS day1
add_dependencies(aoc2023_day1 libc-install ban-install)
add_custom_target(aoc2023_day1-install
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day1 ${BANAN_AOC2023_BIN}/day1
DEPENDS aoc2023_day1
DEPENDS aoc2023_always
)
add_dependencies(aoc2023 aoc2023_day1)
add_dependencies(aoc2023-install aoc2023_day1-install)