diff --git a/CMakeLists.txt b/CMakeLists.txt index e0e1dd2fef..897767e4c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/userspace/aoc2023/CMakeLists.txt b/userspace/aoc2023/CMakeLists.txt index da6ee4ff09..f3ab04d23c 100644 --- a/userspace/aoc2023/CMakeLists.txt +++ b/userspace/aoc2023/CMakeLists.txt @@ -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) diff --git a/userspace/aoc2023/day1/CMakeLists.txt b/userspace/aoc2023/day1/CMakeLists.txt index 6290e90a20..6b8138c826 100644 --- a/userspace/aoc2023/day1/CMakeLists.txt +++ b/userspace/aoc2023/day1/CMakeLists.txt @@ -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)