BuildSystem: Rework the whole cmake build system
Now files are installed using the install() command instead of manually copying files to their destinations. This allows automatic recompilation of headers that did not work previously
This commit is contained in:
parent
318ce5dec8
commit
ad6d95ba52
|
@ -1,7 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(BAN CXX)
|
||||
|
||||
set(BAN_SOURCES
|
||||
BAN/Assert.cpp
|
||||
BAN/New.cpp
|
||||
|
@ -9,16 +5,8 @@ set(BAN_SOURCES
|
|||
BAN/Time.cpp
|
||||
)
|
||||
|
||||
add_custom_target(ban-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
)
|
||||
|
||||
add_library(ban ${BAN_SOURCES})
|
||||
add_dependencies(ban headers libc-install)
|
||||
banan_link_library(ban libc)
|
||||
|
||||
add_custom_target(ban-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/libban.a ${BANAN_LIB}/
|
||||
DEPENDS ban
|
||||
BYPRODUCTS ${BANAN_LIB}/libban.a
|
||||
)
|
||||
banan_install_headers(ban)
|
||||
install(TARGETS ban)
|
||||
|
|
|
@ -10,12 +10,42 @@ add_compile_definitions(__enable_sse=1)
|
|||
project(banan-os CXX C ASM)
|
||||
|
||||
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_ETC ${BANAN_SYSROOT}/usr/etc)
|
||||
set(BANAN_SHARE ${BANAN_SYSROOT}/usr/share)
|
||||
set(BANAN_BOOT ${BANAN_SYSROOT}/boot)
|
||||
|
||||
set(CMAKE_INSTALL_BINDIR ${BANAN_BIN})
|
||||
set(CMAKE_INSTALL_SBINDIR ${BANAN_BIN})
|
||||
set(CMAKE_INSTALL_LIBDIR ${BANAN_LIB})
|
||||
set(CMAKE_INSTALL_INCLUDEDIR ${BANAN_INCLUDE})
|
||||
set(CMAKE_INSTALL_SYSCONF ${BANAN_ETC})
|
||||
set(CMAKE_INSTALL_MESSAGE NEVER)
|
||||
|
||||
# include headers of ${library} to ${target}
|
||||
function(banan_include_headers target library)
|
||||
target_include_directories(${target} PRIVATE $<TARGET_PROPERTY:${library},SOURCE_DIR>/include)
|
||||
endfunction()
|
||||
|
||||
# include headers and link ${library} to ${target}
|
||||
function(banan_link_library target library)
|
||||
target_link_libraries(${target} PRIVATE ${library})
|
||||
banan_include_headers(${target} ${library})
|
||||
endfunction()
|
||||
|
||||
# add install step for all header files of target
|
||||
function(banan_install_headers target)
|
||||
file(GLOB_RECURSE headers RELATIVE $<TARGET_PROPERTY:${target},SOURCE_DIR>/include "*.h")
|
||||
foreach(header ${headers})
|
||||
get_filename_component(subdirectory ${header} DIRECTORY)
|
||||
install(FILES include/${header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${subdirectory} OPTIONAL)
|
||||
endforeach()
|
||||
target_include_directories(${target} PRIVATE $<TARGET_PROPERTY:${target},SOURCE_DIR>/include)
|
||||
endfunction()
|
||||
|
||||
add_subdirectory(kernel)
|
||||
add_subdirectory(bootloader)
|
||||
add_subdirectory(BAN)
|
||||
|
@ -25,20 +55,3 @@ add_custom_target(sysroot
|
|||
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_SYSROOT}
|
||||
COMMAND cd ${BANAN_SYSROOT} && tar xf ${BANAN_BASE_SYSROOT}
|
||||
)
|
||||
|
||||
add_custom_target(headers
|
||||
DEPENDS kernel-headers
|
||||
DEPENDS ban-headers
|
||||
DEPENDS userspace-headers
|
||||
)
|
||||
|
||||
add_custom_target(install-sysroot
|
||||
DEPENDS kernel-install
|
||||
DEPENDS ban-install
|
||||
DEPENDS userspace-install
|
||||
)
|
||||
|
||||
add_custom_target(package-sysroot
|
||||
COMMAND cd ${BANAN_SYSROOT} && tar cf ${BANAN_SYSROOT_TAR} *
|
||||
DEPENDS install-sysroot
|
||||
)
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(kernel CXX C ASM)
|
||||
|
||||
if("${BANAN_ARCH}" STREQUAL "x86_64")
|
||||
set(ELF_FORMAT elf64-x86-64)
|
||||
elseif("${BANAN_ARCH}" STREQUAL "i686")
|
||||
set(ELF_FORMAT elf32-i386)
|
||||
endif()
|
||||
|
||||
set(KERNEL_SOURCES
|
||||
font/prefs.psf.o
|
||||
kernel/ACPI/ACPI.cpp
|
||||
|
@ -106,7 +96,7 @@ set(KERNEL_SOURCES
|
|||
icxxabi.cpp
|
||||
)
|
||||
|
||||
#set(ENABLE_KERNEL_UBSAN True)
|
||||
set(ENABLE_KERNEL_UBSAN False)
|
||||
|
||||
if(ENABLE_KERNEL_UBSAN)
|
||||
set(KERNEL_SOURCES ${KERNEL_SOURCES} ubsan.cpp)
|
||||
|
@ -172,7 +162,6 @@ set(KERNEL_SOURCES
|
|||
)
|
||||
|
||||
add_executable(kernel ${KERNEL_SOURCES})
|
||||
add_dependencies(kernel headers)
|
||||
|
||||
target_compile_definitions(kernel PUBLIC __is_kernel)
|
||||
target_compile_definitions(kernel PUBLIC __arch=${BANAN_ARCH})
|
||||
|
@ -199,16 +188,6 @@ endif()
|
|||
|
||||
target_link_options(kernel PUBLIC -ffreestanding -nostdlib)
|
||||
|
||||
add_custom_target(kernel-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
)
|
||||
|
||||
add_custom_target(kernel-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/kernel ${BANAN_BOOT}/banan-os.kernel
|
||||
DEPENDS kernel
|
||||
)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtbegin.o OUTPUT_VARIABLE CRTBEGIN OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtend.o OUTPUT_VARIABLE CRTEND OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
|
@ -225,6 +204,22 @@ add_custom_command(
|
|||
# COMMAND x86_64-banan_os-strip ${CMAKE_CURRENT_BINARY_DIR}/kernel
|
||||
#)
|
||||
|
||||
banan_include_headers(kernel ban)
|
||||
banan_include_headers(kernel libc)
|
||||
banan_include_headers(kernel libfont)
|
||||
banan_include_headers(kernel libelf)
|
||||
banan_include_headers(kernel libinput)
|
||||
|
||||
banan_install_headers(kernel)
|
||||
set_target_properties(kernel PROPERTIES OUTPUT_NAME banan-os.kernel)
|
||||
install(TARGETS kernel DESTINATION ${BANAN_BOOT})
|
||||
|
||||
if("${BANAN_ARCH}" STREQUAL "x86_64")
|
||||
set(ELF_FORMAT elf64-x86-64)
|
||||
elseif("${BANAN_ARCH}" STREQUAL "i686")
|
||||
set(ELF_FORMAT elf32-i386)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT font/prefs.psf.o
|
||||
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && objcopy -O ${ELF_FORMAT} -B i386 -I binary font/prefs.psf ${CMAKE_CURRENT_BINARY_DIR}/font/prefs.psf.o
|
||||
|
|
|
@ -7,6 +7,9 @@ source $BANAN_SCRIPT_DIR/config.sh
|
|||
FAKEROOT_FILE="$BANAN_BUILD_DIR/fakeroot-context"
|
||||
|
||||
run_fakeroot() {
|
||||
if [ ! -f $FAKEROOT_FILE ]; then
|
||||
touch $FAKEROOT_FILE
|
||||
fi
|
||||
fakeroot -i $FAKEROOT_FILE -s $FAKEROOT_FILE -- /bin/bash -c '$@' bash $@
|
||||
}
|
||||
|
||||
|
@ -44,9 +47,14 @@ build_toolchain () {
|
|||
|
||||
create_image () {
|
||||
build_target bootloader
|
||||
build_target install-sysroot
|
||||
build_target install
|
||||
|
||||
$BANAN_ROOT_DIR/ports/build.sh
|
||||
build_target package-sysroot
|
||||
|
||||
pushd $BANAN_SYSROOT >/dev/null
|
||||
run_fakeroot tar cf ${BANAN_SYSROOT_TAR} *
|
||||
popd >/dev/null
|
||||
|
||||
$BANAN_SCRIPT_DIR/image.sh "$1"
|
||||
}
|
||||
|
||||
|
@ -106,8 +114,12 @@ case $1 in
|
|||
build_target clean
|
||||
rm -f $FAKEROOT_FILE
|
||||
rm -rf $BANAN_SYSROOT
|
||||
rm -f $BANAN_SYSROOT.tar
|
||||
rm -f $BANAN_DISK_IMAGE_PATH
|
||||
;;
|
||||
distclean)
|
||||
rm -rf $BANAN_BUILD_DIR
|
||||
;;
|
||||
*)
|
||||
build_target $1
|
||||
;;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(userspace CXX)
|
||||
|
||||
set(USERSPACE_PROJECTS
|
||||
cat
|
||||
cat-mmap
|
||||
|
@ -18,7 +14,6 @@ set(USERSPACE_PROJECTS
|
|||
ls
|
||||
meminfo
|
||||
mkdir
|
||||
mmap-shared-test
|
||||
nslookup
|
||||
poweroff
|
||||
resolver
|
||||
|
@ -34,6 +29,7 @@ set(USERSPACE_PROJECTS
|
|||
test
|
||||
test-framebuffer
|
||||
test-globals
|
||||
test-mmap-shared
|
||||
test-mouse
|
||||
test-popen
|
||||
test-sort
|
||||
|
@ -50,20 +46,16 @@ set(USERSPACE_PROJECTS
|
|||
|
||||
add_subdirectory(libraries)
|
||||
|
||||
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
||||
add_subdirectory(${USERSPACE_PROJECT})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(userspace DEPENDS libraries)
|
||||
add_custom_target(userspace-headers DEPENDS libraries-headers)
|
||||
add_custom_target(userspace-install DEPENDS userspace libraries-install)
|
||||
|
||||
add_subdirectory(aoc2023)
|
||||
|
||||
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
||||
target_compile_options(${USERSPACE_PROJECT} PRIVATE -g)
|
||||
add_dependencies(userspace ${USERSPACE_PROJECT})
|
||||
add_dependencies(userspace-install ${USERSPACE_PROJECT}-install)
|
||||
|
||||
target_link_options(${USERSPACE_PROJECT} PRIVATE -nolibc)
|
||||
add_custom_target(userspace)
|
||||
|
||||
#add_subdirectory(aoc2023)
|
||||
|
||||
foreach(project ${USERSPACE_PROJECTS})
|
||||
add_subdirectory(${project})
|
||||
add_dependencies(${project} crtx-install)
|
||||
add_dependencies(userspace ${project})
|
||||
# This is to allow cmake to link when libc updates
|
||||
target_link_options(${project} PRIVATE -nolibc)
|
||||
# Default compile options
|
||||
target_compile_options(${project} PRIVATE -g -O2)
|
||||
endforeach()
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(Shell CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(Shell ${SOURCES})
|
||||
target_compile_options(Shell PUBLIC -O2 -g)
|
||||
target_link_libraries(Shell PUBLIC libc ban)
|
||||
banan_link_library(Shell ban)
|
||||
banan_link_library(Shell libc)
|
||||
|
||||
add_custom_target(Shell-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/Shell ${BANAN_BIN}/
|
||||
DEPENDS Shell
|
||||
)
|
||||
install(TARGETS Shell)
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(Terminal CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
Terminal.cpp
|
||||
)
|
||||
|
||||
add_executable(Terminal ${SOURCES})
|
||||
target_compile_options(Terminal PUBLIC -O2 -g)
|
||||
target_link_libraries(Terminal PUBLIC libc ban libfont libgui libinput)
|
||||
banan_include_headers(Terminal ban)
|
||||
banan_link_library(Terminal libc)
|
||||
banan_link_library(Terminal libfont)
|
||||
banan_link_library(Terminal libgui)
|
||||
banan_link_library(Terminal libinput)
|
||||
|
||||
add_custom_target(Terminal-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/Terminal ${BANAN_BIN}/
|
||||
DEPENDS Terminal
|
||||
)
|
||||
install(TARGETS Terminal)
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(WindowServer CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
Framebuffer.cpp
|
||||
|
@ -10,10 +6,11 @@ set(SOURCES
|
|||
)
|
||||
|
||||
add_executable(WindowServer ${SOURCES})
|
||||
target_compile_options(WindowServer PUBLIC -O2 -g)
|
||||
target_link_libraries(WindowServer PUBLIC libc ban libfont libgui libimage libinput)
|
||||
banan_include_headers(WindowServer ban)
|
||||
banan_include_headers(WindowServer libgui)
|
||||
banan_link_library(WindowServer libc)
|
||||
banan_link_library(WindowServer libfont)
|
||||
banan_link_library(WindowServer libimage)
|
||||
banan_link_library(WindowServer libinput)
|
||||
|
||||
add_custom_target(WindowServer-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/WindowServer ${BANAN_BIN}/
|
||||
DEPENDS WindowServer
|
||||
)
|
||||
install(TARGETS WindowServer)
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023 CXX)
|
||||
|
||||
set(AOC2023_PROJECTS
|
||||
day1
|
||||
day2
|
||||
|
@ -30,20 +26,21 @@ set(AOC2023_PROJECTS
|
|||
full
|
||||
)
|
||||
|
||||
set(BANAN_AOC2023_BIN ${BANAN_BIN}/aoc2023)
|
||||
set(BANAN_AOC2023_BIN ${CMAKE_INSTALL_BINDIR}/aoc2023)
|
||||
set(BANAN_AOC2023_INPUT ${BANAN_SHARE}/aoc2023)
|
||||
|
||||
set(CMAKE_INSTALL_BINDIR ${BANAN_AOC2023_BIN})
|
||||
|
||||
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)
|
||||
|
||||
file(GLOB_RECURSE input_files "input/*")
|
||||
foreach(file ${input_files})
|
||||
install(FILES ${file} DESTINATION ${BANAN_AOC2023_INPUT})
|
||||
endforeach()
|
||||
|
||||
foreach(AOC2023_PROJECT ${AOC2023_PROJECTS})
|
||||
add_subdirectory(${AOC2023_PROJECT})
|
||||
add_dependencies(aoc2023 aoc2023_${AOC2023_PROJECT})
|
||||
endforeach()
|
||||
|
||||
add_dependencies(userspace aoc2023)
|
||||
add_dependencies(userspace-install aoc2023-install)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day-template CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day-template ${SOURCES})
|
||||
target_compile_options(aoc2023_day-template PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day-template PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day-template ban)
|
||||
banan_link_library(aoc2023_day-template libc)
|
||||
|
||||
add_dependencies(aoc2023_day-template libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day-template-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day-template ${BANAN_AOC2023_BIN}/day-template
|
||||
DEPENDS aoc2023_day-template
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day-template)
|
||||
add_dependencies(aoc2023-install aoc2023_day-template-install)
|
||||
install(TARGETS aoc2023_day-template)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day1 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day1 ${SOURCES})
|
||||
target_compile_options(aoc2023_day1 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day1 PUBLIC libc)
|
||||
banan_include_headers(aoc2023_day1 ban)
|
||||
banan_link_library(aoc2023_day1 libc)
|
||||
|
||||
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)
|
||||
install(TARGETS aoc2023_day1)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day10 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day10 ${SOURCES})
|
||||
target_compile_options(aoc2023_day10 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day10 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day10 ban)
|
||||
banan_link_library(aoc2023_day10 libc)
|
||||
|
||||
add_dependencies(aoc2023_day10 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day10-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day10 ${BANAN_AOC2023_BIN}/day10
|
||||
DEPENDS aoc2023_day10
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day10)
|
||||
add_dependencies(aoc2023-install aoc2023_day10-install)
|
||||
install(TARGETS aoc2023_day10)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day11 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day11 ${SOURCES})
|
||||
target_compile_options(aoc2023_day11 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day11 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day11 ban)
|
||||
banan_link_library(aoc2023_day11 libc)
|
||||
|
||||
add_dependencies(aoc2023_day11 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day11-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day11 ${BANAN_AOC2023_BIN}/day11
|
||||
DEPENDS aoc2023_day11
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day11)
|
||||
add_dependencies(aoc2023-install aoc2023_day11-install)
|
||||
install(TARGETS aoc2023_day11)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day12 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day12 ${SOURCES})
|
||||
target_compile_options(aoc2023_day12 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day12 PUBLIC libc ban)
|
||||
banan_link_library(aoc2023_day12 ban)
|
||||
banan_link_library(aoc2023_day12 libc)
|
||||
|
||||
add_dependencies(aoc2023_day12 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day12-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day12 ${BANAN_AOC2023_BIN}/day12
|
||||
DEPENDS aoc2023_day12
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day12)
|
||||
add_dependencies(aoc2023-install aoc2023_day12-install)
|
||||
install(TARGETS aoc2023_day12)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day13 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day13 ${SOURCES})
|
||||
target_compile_options(aoc2023_day13 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day13 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day13 ban)
|
||||
banan_link_library(aoc2023_day13 libc)
|
||||
|
||||
add_dependencies(aoc2023_day13 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day13-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day13 ${BANAN_AOC2023_BIN}/day13
|
||||
DEPENDS aoc2023_day13
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day13)
|
||||
add_dependencies(aoc2023-install aoc2023_day13-install)
|
||||
install(TARGETS aoc2023_day13)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day14 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day14 ${SOURCES})
|
||||
target_compile_options(aoc2023_day14 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day14 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day14 ban)
|
||||
banan_link_library(aoc2023_day14 libc)
|
||||
|
||||
add_dependencies(aoc2023_day14 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day14-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day14 ${BANAN_AOC2023_BIN}/day14
|
||||
DEPENDS aoc2023_day14
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day14)
|
||||
add_dependencies(aoc2023-install aoc2023_day14-install)
|
||||
install(TARGETS aoc2023_day14)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day15 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day15 ${SOURCES})
|
||||
target_compile_options(aoc2023_day15 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day15 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day15 ban)
|
||||
banan_link_library(aoc2023_day15 libc)
|
||||
|
||||
add_dependencies(aoc2023_day15 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day15-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day15 ${BANAN_AOC2023_BIN}/day15
|
||||
DEPENDS aoc2023_day15
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day15)
|
||||
add_dependencies(aoc2023-install aoc2023_day15-install)
|
||||
install(TARGETS aoc2023_day15)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day16 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day16 ${SOURCES})
|
||||
target_compile_options(aoc2023_day16 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day16 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day16 ban)
|
||||
banan_link_library(aoc2023_day16 libc)
|
||||
|
||||
add_dependencies(aoc2023_day16 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day16-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day16 ${BANAN_AOC2023_BIN}/day16
|
||||
DEPENDS aoc2023_day16
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day16)
|
||||
add_dependencies(aoc2023-install aoc2023_day16-install)
|
||||
install(TARGETS aoc2023_day16)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day17 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day17 ${SOURCES})
|
||||
target_compile_options(aoc2023_day17 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day17 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day17 ban)
|
||||
banan_link_library(aoc2023_day17 libc)
|
||||
|
||||
add_dependencies(aoc2023_day17 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day17-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day17 ${BANAN_AOC2023_BIN}/day17
|
||||
DEPENDS aoc2023_day17
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day17)
|
||||
add_dependencies(aoc2023-install aoc2023_day17-install)
|
||||
install(TARGETS aoc2023_day17)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day18 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day18 ${SOURCES})
|
||||
target_compile_options(aoc2023_day18 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day18 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day18 ban)
|
||||
banan_link_library(aoc2023_day18 libc)
|
||||
|
||||
add_dependencies(aoc2023_day18 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day18-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day18 ${BANAN_AOC2023_BIN}/day18
|
||||
DEPENDS aoc2023_day18
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day18)
|
||||
add_dependencies(aoc2023-install aoc2023_day18-install)
|
||||
install(TARGETS aoc2023_day18)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day19 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day19 ${SOURCES})
|
||||
target_compile_options(aoc2023_day19 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day19 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day19 ban)
|
||||
banan_link_library(aoc2023_day19 libc)
|
||||
|
||||
add_dependencies(aoc2023_day19 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day19-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day19 ${BANAN_AOC2023_BIN}/day19
|
||||
DEPENDS aoc2023_day19
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day19)
|
||||
add_dependencies(aoc2023-install aoc2023_day19-install)
|
||||
install(TARGETS aoc2023_day19)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day2 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day2 ${SOURCES})
|
||||
target_compile_options(aoc2023_day2 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day2 PUBLIC libc)
|
||||
banan_include_headers(aoc2023_day2 ban)
|
||||
banan_link_library(aoc2023_day2 libc)
|
||||
|
||||
add_dependencies(aoc2023_day2 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day2-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day2 ${BANAN_AOC2023_BIN}/day2
|
||||
DEPENDS aoc2023_day2
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day2)
|
||||
add_dependencies(aoc2023-install aoc2023_day2-install)
|
||||
install(TARGETS aoc2023_day2)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day20 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day20 ${SOURCES})
|
||||
target_compile_options(aoc2023_day20 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day20 PUBLIC libc ban)
|
||||
banan_link_library(aoc2023_day20 ban)
|
||||
banan_link_library(aoc2023_day20 libc)
|
||||
|
||||
add_dependencies(aoc2023_day20 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day20-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day20 ${BANAN_AOC2023_BIN}/day20
|
||||
DEPENDS aoc2023_day20
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day20)
|
||||
add_dependencies(aoc2023-install aoc2023_day20-install)
|
||||
install(TARGETS aoc2023_day20)
|
||||
|
|
|
@ -30,6 +30,8 @@ struct Module
|
|||
BAN::String name;
|
||||
BAN::Vector<BAN::String> targets;
|
||||
|
||||
virtual ~Module() {}
|
||||
|
||||
virtual void handle_signal(const Signal& signal, BAN::Queue<Signal>& signal_queue) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day21 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day21 ${SOURCES})
|
||||
target_compile_options(aoc2023_day21 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day21 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day21 ban)
|
||||
banan_link_library(aoc2023_day21 libc)
|
||||
|
||||
add_dependencies(aoc2023_day21 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day21-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day21 ${BANAN_AOC2023_BIN}/day21
|
||||
DEPENDS aoc2023_day21
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day21)
|
||||
add_dependencies(aoc2023-install aoc2023_day21-install)
|
||||
install(TARGETS aoc2023_day21)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day22 ${SOURCES})
|
||||
banan_include_headers(aoc2023_day22 ban)
|
||||
banan_link_library(aoc2023_day22 libc)
|
||||
|
||||
install(TARGETS aoc2023_day22)
|
|
@ -0,0 +1,191 @@
|
|||
#include <BAN/HashSet.h>
|
||||
#include <BAN/Sort.h>
|
||||
#include <BAN/Vector.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
using i8 = int8_t;
|
||||
using i16 = int16_t;
|
||||
using i32 = int32_t;
|
||||
using i64 = int64_t;
|
||||
|
||||
using u8 = uint8_t;
|
||||
using u16 = uint16_t;
|
||||
using u32 = uint32_t;
|
||||
using u64 = uint64_t;
|
||||
|
||||
struct Position
|
||||
{
|
||||
i64 x, y, z;
|
||||
|
||||
bool operator==(const Position& other) const
|
||||
{
|
||||
return x == other.x && y == other.y && z == other.z;
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr bool rectangle_contains(const Position& c1, const Position& c2, const Position& p)
|
||||
{
|
||||
ASSERT(c1.x <= c2.x);
|
||||
ASSERT(c1.y <= c2.y);
|
||||
return (c1.x <= p.x && p.x <= c2.x) && (c1.y <= p.y && p.y <= c2.y);
|
||||
}
|
||||
|
||||
struct Brick
|
||||
{
|
||||
Position corners[2];
|
||||
BAN::HashSet<Brick*> supporting;
|
||||
BAN::HashSet<Brick*> supported_by;
|
||||
|
||||
bool supports(const Brick& other) const
|
||||
{
|
||||
if (corners[1].z + 1 != other.corners[0].z)
|
||||
return false;
|
||||
|
||||
for (i32 i = 0; i < 4; i++)
|
||||
if (rectangle_contains(corners[0], corners[1], { other.corners[i / 2].x, other.corners[i % 2].y, 0 }))
|
||||
return true;
|
||||
|
||||
for (i32 i = 0; i < 4; i++)
|
||||
if (rectangle_contains(other.corners[0], other.corners[1], { corners[i / 2].x, corners[i % 2].y, 0 }))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
i64 parse_i64(BAN::StringView str)
|
||||
{
|
||||
i64 result = 0;
|
||||
for (char c : str)
|
||||
{
|
||||
ASSERT(isdigit(c));
|
||||
result = (result * 10) + (c - '0');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
BAN::Vector<Brick> parse_bricks(FILE* fp)
|
||||
{
|
||||
BAN::Vector<Brick> bricks;
|
||||
|
||||
char buffer[64];
|
||||
while (fgets(buffer, sizeof(buffer), fp))
|
||||
{
|
||||
BAN::StringView line(buffer);
|
||||
ASSERT(line.back() == '\n');
|
||||
line = line.substring(0, line.size() - 1);
|
||||
if (line.empty())
|
||||
break;
|
||||
|
||||
auto corner_strs = MUST(line.split('~'));
|
||||
ASSERT(corner_strs.size() == 2);
|
||||
|
||||
Brick brick;
|
||||
for (i32 i = 0; i < 2; i++)
|
||||
{
|
||||
auto coords = MUST(corner_strs[i].split(','));
|
||||
ASSERT(coords.size() == 3);
|
||||
brick.corners[i].x = parse_i64(coords[0]);
|
||||
brick.corners[i].y = parse_i64(coords[1]);
|
||||
brick.corners[i].z = parse_i64(coords[2]);
|
||||
}
|
||||
ASSERT(brick.corners[0].x <= brick.corners[1].x);
|
||||
ASSERT(brick.corners[0].y <= brick.corners[1].y);
|
||||
ASSERT(brick.corners[0].z <= brick.corners[1].z);
|
||||
MUST(bricks.push_back(brick));
|
||||
}
|
||||
|
||||
return bricks;
|
||||
}
|
||||
|
||||
i64 puzzle1(FILE* fp)
|
||||
{
|
||||
auto brick_comp = [](const Brick& b1, const Brick& b2) { return b1.corners[0].z < b2.corners[0].z; };
|
||||
|
||||
auto bricks = parse_bricks(fp);
|
||||
BAN::sort::sort(bricks.begin(), bricks.end(), brick_comp);
|
||||
|
||||
// Simulate brick falling
|
||||
for (size_t i = 0; i < bricks.size();)
|
||||
{
|
||||
bool can_fall = bricks[i].corners[0].z > 1;
|
||||
for (size_t j = 0; j < i && can_fall; j++)
|
||||
if (bricks[j].supports(bricks[i]))
|
||||
can_fall = false;
|
||||
|
||||
if (!can_fall)
|
||||
i++;
|
||||
else
|
||||
{
|
||||
bricks[i].corners[0].z--;
|
||||
bricks[i].corners[1].z--;
|
||||
for (; i > 0; i--)
|
||||
{
|
||||
if (brick_comp(bricks[i - 1], bricks[i]))
|
||||
break;
|
||||
BAN::swap(bricks[i - 1], bricks[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store brick supporting structures
|
||||
for (size_t i = 0; i < bricks.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < bricks.size(); j++)
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
if (bricks[i].supports(bricks[j]))
|
||||
{
|
||||
MUST(bricks[i].supporting.insert(&bricks[j]));
|
||||
MUST(bricks[j].supported_by.insert(&bricks[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i64 result = 0;
|
||||
for (const auto& brick : bricks)
|
||||
{
|
||||
bool disintegratable = true;
|
||||
for (const auto* support : brick.supporting)
|
||||
if (support->supported_by.size() <= 1)
|
||||
disintegratable = false;
|
||||
result += disintegratable;
|
||||
}
|
||||
|
||||
// OFF BY 7
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
i64 puzzle2(FILE* fp)
|
||||
{
|
||||
(void)fp;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const char* file_path = "/usr/share/aoc2023/day22_input.txt";
|
||||
|
||||
if (argc >= 2)
|
||||
file_path = argv[1];
|
||||
|
||||
FILE* fp = fopen(file_path, "r");
|
||||
if (fp == nullptr)
|
||||
{
|
||||
perror("fopen");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("puzzle1: %" PRId64 "\n", puzzle1(fp));
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
printf("puzzle2: %" PRId64 "\n", puzzle2(fp));
|
||||
|
||||
fclose(fp);
|
||||
}
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day23 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day23 ${SOURCES})
|
||||
target_compile_options(aoc2023_day23 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day23 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day23 ban)
|
||||
banan_link_library(aoc2023_day23 libc)
|
||||
|
||||
add_dependencies(aoc2023_day23 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day23-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day23 ${BANAN_AOC2023_BIN}/day23
|
||||
DEPENDS aoc2023_day23
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day23)
|
||||
add_dependencies(aoc2023-install aoc2023_day23-install)
|
||||
install(TARGETS aoc2023_day23)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day24 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day24 ${SOURCES})
|
||||
target_compile_options(aoc2023_day24 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day24 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day24 ban)
|
||||
banan_link_library(aoc2023_day24 libc)
|
||||
|
||||
add_dependencies(aoc2023_day24 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day24-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day24 ${BANAN_AOC2023_BIN}/day24
|
||||
DEPENDS aoc2023_day24
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day24)
|
||||
add_dependencies(aoc2023-install aoc2023_day24-install)
|
||||
install(TARGETS aoc2023_day24)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day25 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day25 ${SOURCES})
|
||||
target_compile_options(aoc2023_day25 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day25 PUBLIC libc ban)
|
||||
banan_link_library(aoc2023_day25 ban)
|
||||
banan_link_library(aoc2023_day25 libc)
|
||||
|
||||
add_dependencies(aoc2023_day25 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day25-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day25 ${BANAN_AOC2023_BIN}/day25
|
||||
DEPENDS aoc2023_day25
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day25)
|
||||
add_dependencies(aoc2023-install aoc2023_day25-install)
|
||||
install(TARGETS aoc2023_day25)
|
||||
|
|
|
@ -21,6 +21,9 @@ using u64 = uint64_t;
|
|||
|
||||
struct Component
|
||||
{
|
||||
Component(BAN::String name)
|
||||
: name(BAN::move(name))
|
||||
{}
|
||||
BAN::String name;
|
||||
BAN::Vector<BAN::String> connections;
|
||||
};
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day3 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day3 ${SOURCES})
|
||||
target_compile_options(aoc2023_day3 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day3 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day3 ban)
|
||||
banan_link_library(aoc2023_day3 libc)
|
||||
|
||||
add_dependencies(aoc2023_day3 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day3-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day3 ${BANAN_AOC2023_BIN}/day3
|
||||
DEPENDS aoc2023_day3
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day3)
|
||||
add_dependencies(aoc2023-install aoc2023_day3-install)
|
||||
install(TARGETS aoc2023_day3)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day4 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day4 ${SOURCES})
|
||||
target_compile_options(aoc2023_day4 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day4 PUBLIC libc ban)
|
||||
banan_link_library(aoc2023_day4 ban)
|
||||
banan_link_library(aoc2023_day4 libc)
|
||||
|
||||
add_dependencies(aoc2023_day4 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day4-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day4 ${BANAN_AOC2023_BIN}/day4
|
||||
DEPENDS aoc2023_day4
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day4)
|
||||
add_dependencies(aoc2023-install aoc2023_day4-install)
|
||||
install(TARGETS aoc2023_day4)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day5 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day5 ${SOURCES})
|
||||
target_compile_options(aoc2023_day5 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day5 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day5 ban)
|
||||
banan_link_library(aoc2023_day5 libc)
|
||||
|
||||
add_dependencies(aoc2023_day5 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day5-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day5 ${BANAN_AOC2023_BIN}/day5
|
||||
DEPENDS aoc2023_day5
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day5)
|
||||
add_dependencies(aoc2023-install aoc2023_day5-install)
|
||||
install(TARGETS aoc2023_day5)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day6 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day6 ${SOURCES})
|
||||
target_compile_options(aoc2023_day6 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day6 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day6 ban)
|
||||
banan_link_library(aoc2023_day6 libc)
|
||||
|
||||
add_dependencies(aoc2023_day6 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day6-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day6 ${BANAN_AOC2023_BIN}/day6
|
||||
DEPENDS aoc2023_day6
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day6)
|
||||
add_dependencies(aoc2023-install aoc2023_day6-install)
|
||||
install(TARGETS aoc2023_day6)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day7 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day7 ${SOURCES})
|
||||
target_compile_options(aoc2023_day7 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day7 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day7 ban)
|
||||
banan_link_library(aoc2023_day7 libc)
|
||||
|
||||
add_dependencies(aoc2023_day7 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day7-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day7 ${BANAN_AOC2023_BIN}/day7
|
||||
DEPENDS aoc2023_day7
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day7)
|
||||
add_dependencies(aoc2023-install aoc2023_day7-install)
|
||||
install(TARGETS aoc2023_day7)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day8 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day8 ${SOURCES})
|
||||
target_compile_options(aoc2023_day8 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day8 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day8 ban)
|
||||
banan_link_library(aoc2023_day8 libc)
|
||||
|
||||
add_dependencies(aoc2023_day8 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day8-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day8 ${BANAN_AOC2023_BIN}/day8
|
||||
DEPENDS aoc2023_day8
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day8)
|
||||
add_dependencies(aoc2023-install aoc2023_day8-install)
|
||||
install(TARGETS aoc2023_day8)
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023_day9 CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023_day9 ${SOURCES})
|
||||
target_compile_options(aoc2023_day9 PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023_day9 PUBLIC libc ban)
|
||||
banan_include_headers(aoc2023_day9 ban)
|
||||
banan_link_library(aoc2023_day9 libc)
|
||||
|
||||
add_dependencies(aoc2023_day9 libc-install ban-install)
|
||||
|
||||
add_custom_target(aoc2023_day9-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023_day9 ${BANAN_AOC2023_BIN}/day9
|
||||
DEPENDS aoc2023_day9
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023_day9)
|
||||
add_dependencies(aoc2023-install aoc2023_day9-install)
|
||||
install(TARGETS aoc2023_day9)
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(aoc2023-full CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2023-full ${SOURCES})
|
||||
target_compile_options(aoc2023-full PUBLIC -O2 -g)
|
||||
target_link_libraries(aoc2023-full PUBLIC libc)
|
||||
add_executable(aoc2023_full ${SOURCES})
|
||||
banan_include_headers(aoc2023_full ban)
|
||||
banan_link_library(aoc2023_full libc)
|
||||
|
||||
add_custom_target(aoc2023-full-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/aoc2023-full ${BANAN_AOC2023_BIN}/full
|
||||
DEPENDS aoc2023-full
|
||||
DEPENDS aoc2023_always
|
||||
)
|
||||
|
||||
add_dependencies(aoc2023 aoc2023-full)
|
||||
add_dependencies(aoc2023-install aoc2023-full-install)
|
||||
install(TARGETS aoc2023_full)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(cat-mmap CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(cat-mmap ${SOURCES})
|
||||
target_compile_options(cat-mmap PUBLIC -O2 -g)
|
||||
target_link_libraries(cat-mmap PUBLIC libc)
|
||||
banan_link_library(cat-mmap libc)
|
||||
|
||||
add_custom_target(cat-mmap-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/cat-mmap ${BANAN_BIN}/
|
||||
DEPENDS cat-mmap
|
||||
)
|
||||
install(TARGETS cat-mmap)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(cat CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(cat ${SOURCES})
|
||||
target_compile_options(cat PUBLIC -O2 -g)
|
||||
target_link_libraries(cat PUBLIC libc)
|
||||
banan_link_library(cat libc)
|
||||
|
||||
add_custom_target(cat-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/cat ${BANAN_BIN}/
|
||||
DEPENDS cat
|
||||
)
|
||||
install(TARGETS cat)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(chmod CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(chmod ${SOURCES})
|
||||
target_compile_options(chmod PUBLIC -O2 -g)
|
||||
target_link_libraries(chmod PUBLIC libc)
|
||||
banan_link_library(chmod libc)
|
||||
|
||||
add_custom_target(chmod-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/chmod ${BANAN_BIN}/
|
||||
DEPENDS chmod
|
||||
)
|
||||
install(TARGETS chmod)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(cp CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(cp ${SOURCES})
|
||||
target_compile_options(cp PUBLIC -O2 -g)
|
||||
target_link_libraries(cp PUBLIC libc ban)
|
||||
banan_include_headers(cp ban)
|
||||
banan_link_library(cp libc)
|
||||
|
||||
add_custom_target(cp-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/cp ${BANAN_BIN}/
|
||||
DEPENDS cp
|
||||
)
|
||||
install(TARGETS cp)
|
||||
|
|
|
@ -7,27 +7,22 @@ PROGRAM_NAME=$1
|
|||
mkdir $PROGRAM_NAME
|
||||
|
||||
cat > $PROGRAM_NAME/CMakeLists.txt << EOF
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project($PROGRAM_NAME CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable($PROGRAM_NAME \${SOURCES})
|
||||
target_compile_options($PROGRAM_NAME PUBLIC -O2 -g)
|
||||
target_link_libraries($PROGRAM_NAME PUBLIC libc)
|
||||
banan_link_library($PROGRAM_NAME ban)
|
||||
banan_link_library($PROGRAM_NAME libc)
|
||||
|
||||
add_custom_target($PROGRAM_NAME-install
|
||||
COMMAND \${CMAKE_COMMAND} -E copy \${CMAKE_CURRENT_BINARY_DIR}/$PROGRAM_NAME \${BANAN_BIN}/
|
||||
DEPENDS $PROGRAM_NAME
|
||||
)
|
||||
install(TARGETS $PROGRAM_NAME)
|
||||
EOF
|
||||
|
||||
cat > $PROGRAM_NAME/main.cpp << EOF
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
printf("Hello World\n");
|
||||
}
|
||||
EOF
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(dd CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(dd ${SOURCES})
|
||||
target_compile_options(dd PUBLIC -O2 -g)
|
||||
target_link_libraries(dd PUBLIC libc)
|
||||
banan_link_library(dd libc)
|
||||
|
||||
add_custom_target(dd-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/dd ${BANAN_BIN}/
|
||||
DEPENDS dd
|
||||
)
|
||||
install(TARGETS dd)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(dhcp-client CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(dhcp-client ${SOURCES})
|
||||
target_compile_options(dhcp-client PUBLIC -O2 -g)
|
||||
target_link_libraries(dhcp-client PUBLIC libc)
|
||||
banan_include_headers(dhcp-client ban)
|
||||
banan_link_library(dhcp-client libc)
|
||||
|
||||
add_custom_target(dhcp-client-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/dhcp-client ${BANAN_BIN}/
|
||||
DEPENDS dhcp-client
|
||||
)
|
||||
install(TARGETS dhcp-client)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(echo CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(echo ${SOURCES})
|
||||
target_compile_options(echo PUBLIC -O2 -g)
|
||||
target_link_libraries(echo PUBLIC libc)
|
||||
banan_link_library(echo libc)
|
||||
|
||||
add_custom_target(echo-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/echo ${BANAN_BIN}/
|
||||
DEPENDS echo
|
||||
)
|
||||
install(TARGETS echo)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(getopt CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(getopt ${SOURCES})
|
||||
target_compile_options(getopt PUBLIC -O2 -g)
|
||||
target_link_libraries(getopt PUBLIC libc ban)
|
||||
banan_include_headers(getopt ban)
|
||||
banan_link_library(getopt libc)
|
||||
|
||||
add_custom_target(getopt-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/getopt ${BANAN_BIN}/
|
||||
DEPENDS getopt
|
||||
)
|
||||
install(TARGETS getopt)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(id CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(id ${SOURCES})
|
||||
target_compile_options(id PUBLIC -O2 -g)
|
||||
target_link_libraries(id PUBLIC libc ban)
|
||||
banan_include_headers(id ban)
|
||||
banan_link_library(id libc)
|
||||
|
||||
add_custom_target(id-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/id ${BANAN_BIN}/
|
||||
DEPENDS id
|
||||
)
|
||||
install(TARGETS id)
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(image CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(image ${SOURCES})
|
||||
target_compile_options(image PUBLIC -O2 -g)
|
||||
target_link_libraries(image PUBLIC libc ban libimage)
|
||||
banan_include_headers(image ban)
|
||||
banan_link_library(image libc)
|
||||
banan_link_library(image libimage)
|
||||
|
||||
add_custom_target(image-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/image ${BANAN_BIN}/
|
||||
DEPENDS image
|
||||
)
|
||||
install(TARGETS image)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(init CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(init ${SOURCES})
|
||||
target_compile_options(init PUBLIC -O2 -g)
|
||||
target_link_libraries(init PUBLIC libc ban)
|
||||
banan_include_headers(init ban)
|
||||
banan_link_library(init libc)
|
||||
|
||||
add_custom_target(init-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/init ${BANAN_BIN}/
|
||||
DEPENDS init
|
||||
)
|
||||
install(TARGETS init)
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(libraries CXX)
|
||||
|
||||
set(USERSPACE_LIBRARIES
|
||||
LibC
|
||||
LibELF
|
||||
|
@ -11,23 +7,17 @@ set(USERSPACE_LIBRARIES
|
|||
LibInput
|
||||
)
|
||||
|
||||
foreach(LIBRARY ${USERSPACE_LIBRARIES})
|
||||
add_subdirectory(${LIBRARY})
|
||||
foreach(library ${USERSPACE_LIBRARIES})
|
||||
add_subdirectory(${library})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(libraries)
|
||||
add_custom_target(libraries-headers)
|
||||
add_custom_target(libraries-install)
|
||||
|
||||
foreach(LIBRARY ${USERSPACE_LIBRARIES})
|
||||
string(TOLOWER ${LIBRARY} LIBRARY_LOWER)
|
||||
|
||||
if (TARGET ${LIBRARY_LOWER})
|
||||
add_dependencies(libraries ${LIBRARY_LOWER})
|
||||
foreach(library ${USERSPACE_LIBRARIES})
|
||||
string(TOLOWER ${library} library_lower)
|
||||
if (TARGET ${library_lower})
|
||||
add_dependencies(libraries ${library_lower})
|
||||
# This is to allow cmake to link when libc updates
|
||||
target_link_options(${LIBRARY_LOWER} PRIVATE -nolibc)
|
||||
target_link_options(${library_lower} PRIVATE -nolibc)
|
||||
endif()
|
||||
|
||||
add_dependencies(libraries-headers ${LIBRARY_LOWER}-headers)
|
||||
add_dependencies(libraries-install ${LIBRARY_LOWER}-install)
|
||||
endforeach()
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(libc CXX ASM)
|
||||
|
||||
set(LIBC_SOURCES
|
||||
arpa/inet.cpp
|
||||
assert.cpp
|
||||
|
@ -35,34 +31,24 @@ set(LIBC_SOURCES
|
|||
../../../BAN/BAN/Assert.cpp
|
||||
)
|
||||
|
||||
add_custom_target(libc-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
)
|
||||
|
||||
add_custom_target(crtx
|
||||
COMMAND ${CMAKE_C_COMPILER} -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crt0.S -o crt0.o
|
||||
COMMAND ${CMAKE_C_COMPILER} -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crti.S -o crti.o
|
||||
COMMAND ${CMAKE_C_COMPILER} -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crtn.S -o crtn.o
|
||||
)
|
||||
|
||||
add_custom_target(crtx-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy crt0.o ${BANAN_LIB}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy crti.o ${BANAN_LIB}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy crtn.o ${BANAN_LIB}/
|
||||
DEPENDS crtx
|
||||
)
|
||||
|
||||
add_library(libc ${LIBC_SOURCES})
|
||||
add_dependencies(libc headers crtx-install)
|
||||
|
||||
target_compile_options(libc PRIVATE -O2 -g -Wstack-usage=512 -fno-tree-loop-distribute-patterns)
|
||||
target_compile_options(libc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usage=)
|
||||
|
||||
add_custom_target(libc-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/libc.a ${BANAN_LIB}/
|
||||
DEPENDS libc
|
||||
BYPRODUCTS ${BANAN_LIB}/libc.a
|
||||
add_library(crt0 OBJECT arch/${BANAN_ARCH}/crt0.S)
|
||||
add_library(crti OBJECT arch/${BANAN_ARCH}/crti.S)
|
||||
add_library(crtn OBJECT arch/${BANAN_ARCH}/crtn.S)
|
||||
add_custom_target(crtx-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_LIBDIR}/crt0.o
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_OBJECTS:crti> ${CMAKE_INSTALL_LIBDIR}/crti.o
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_OBJECTS:crtn> ${CMAKE_INSTALL_LIBDIR}/crtn.o
|
||||
DEPENDS crt0 crti crtn sysroot
|
||||
)
|
||||
|
||||
banan_include_headers(libc ban)
|
||||
banan_include_headers(libc kernel)
|
||||
|
||||
banan_install_headers(libc)
|
||||
install(TARGETS libc)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(LibELF CXX)
|
||||
|
||||
add_custom_target(libelf-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
set(SOURCES
|
||||
dummy.cpp
|
||||
)
|
||||
|
||||
add_custom_target(libelf-install
|
||||
DEPENDS libelf-headers
|
||||
)
|
||||
add_library(libelf ${SOURCES})
|
||||
|
||||
banan_install_headers(libelf)
|
||||
install(TARGETS libelf)
|
||||
|
|
|
@ -1,25 +1,13 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(libfont CXX)
|
||||
|
||||
set(LIBGUI_SOURCES
|
||||
Font.cpp
|
||||
PSF.cpp
|
||||
)
|
||||
|
||||
add_custom_target(libfont-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
)
|
||||
|
||||
add_library(libfont ${LIBGUI_SOURCES})
|
||||
add_dependencies(libfont headers libc-install)
|
||||
target_link_libraries(libfont PUBLIC libc)
|
||||
banan_link_library(libfont libc)
|
||||
banan_link_library(libfont ban)
|
||||
|
||||
add_custom_target(libfont-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/libfont.a ${BANAN_LIB}/
|
||||
DEPENDS libfont
|
||||
BYPRODUCTS ${BANAN_LIB}/libfont.a
|
||||
)
|
||||
banan_install_headers(libfont)
|
||||
install(TARGETS libfont)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(libgui CXX)
|
||||
|
||||
set(LIBGUI_SOURCES
|
||||
Window.cpp
|
||||
)
|
||||
|
||||
add_custom_target(libgui-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
)
|
||||
|
||||
add_library(libgui ${LIBGUI_SOURCES})
|
||||
add_dependencies(libgui headers libc-install)
|
||||
target_link_libraries(libgui PUBLIC libc libfont)
|
||||
banan_include_headers(libgui ban)
|
||||
banan_include_headers(libgui libfont)
|
||||
banan_include_headers(libgui libinput)
|
||||
banan_link_library(libgui libc)
|
||||
|
||||
add_custom_target(libgui-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/libgui.a ${BANAN_LIB}/
|
||||
DEPENDS libgui
|
||||
BYPRODUCTS ${BANAN_LIB}/libgui.a
|
||||
)
|
||||
banan_install_headers(libgui)
|
||||
install(TARGETS libgui)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
|
|
|
@ -1,27 +1,15 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(libimage CXX)
|
||||
|
||||
set(LIBIMAGE_SOURCES
|
||||
Image.cpp
|
||||
Netbpm.cpp
|
||||
PNG.cpp
|
||||
)
|
||||
|
||||
add_custom_target(libimage-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
)
|
||||
|
||||
add_library(libimage ${LIBIMAGE_SOURCES})
|
||||
add_dependencies(libimage headers libc-install)
|
||||
target_link_libraries(libimage PUBLIC libc)
|
||||
target_compile_options(libimage PRIVATE -O3)
|
||||
banan_link_library(libimage libc)
|
||||
banan_link_library(libimage ban)
|
||||
|
||||
add_custom_target(libimage-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/libimage.a ${BANAN_LIB}/
|
||||
DEPENDS libimage
|
||||
BYPRODUCTS ${BANAN_LIB}/libimage.a
|
||||
)
|
||||
banan_install_headers(libimage)
|
||||
install(TARGETS libimage)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
|
|
|
@ -1,24 +1,13 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(libinput CXX)
|
||||
|
||||
set(LIBINPUT_SOURCES
|
||||
KeyEvent.cpp
|
||||
KeyboardLayout.cpp
|
||||
)
|
||||
|
||||
add_custom_target(libinput-headers
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||
DEPENDS sysroot
|
||||
)
|
||||
|
||||
add_library(libinput ${LIBINPUT_SOURCES})
|
||||
target_link_libraries(libinput PUBLIC libc ban)
|
||||
banan_include_headers(libinput ban)
|
||||
banan_link_library(libinput libc)
|
||||
|
||||
add_custom_target(libinput-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/libinput.a ${BANAN_LIB}/
|
||||
DEPENDS libinput
|
||||
BYPRODUCTS ${BANAN_LIB}/libinput.a
|
||||
)
|
||||
banan_install_headers(libinput)
|
||||
install(TARGETS libinput)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(loadkeys CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(loadkeys ${SOURCES})
|
||||
target_compile_options(loadkeys PUBLIC -O2 -g)
|
||||
target_link_libraries(loadkeys PUBLIC libc)
|
||||
banan_link_library(loadkeys libc)
|
||||
|
||||
add_custom_target(loadkeys-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/loadkeys ${BANAN_BIN}/
|
||||
DEPENDS loadkeys
|
||||
)
|
||||
install(TARGETS loadkeys)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(ls CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(ls ${SOURCES})
|
||||
target_compile_options(ls PUBLIC -O2 -g)
|
||||
target_link_libraries(ls PUBLIC libc ban)
|
||||
banan_link_library(ls ban)
|
||||
banan_link_library(ls libc)
|
||||
|
||||
add_custom_target(ls-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/ls ${BANAN_BIN}/
|
||||
DEPENDS ls
|
||||
)
|
||||
install(TARGETS ls)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(meminfo CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(meminfo ${SOURCES})
|
||||
target_compile_options(meminfo PUBLIC -O2 -g)
|
||||
target_link_libraries(meminfo PUBLIC libc)
|
||||
banan_link_library(meminfo libc)
|
||||
|
||||
add_custom_target(meminfo-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/meminfo ${BANAN_BIN}/
|
||||
DEPENDS meminfo
|
||||
)
|
||||
install(TARGETS meminfo)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(mkdir CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(mkdir ${SOURCES})
|
||||
target_compile_options(mkdir PUBLIC -O2 -g)
|
||||
target_link_libraries(mkdir PUBLIC libc)
|
||||
banan_link_library(mkdir libc)
|
||||
|
||||
add_custom_target(mkdir-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/mkdir ${BANAN_BIN}/
|
||||
DEPENDS mkdir
|
||||
)
|
||||
install(TARGETS mkdir)
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(mmap-shared-test CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(mmap-shared-test ${SOURCES})
|
||||
target_compile_options(mmap-shared-test PUBLIC -O2 -g)
|
||||
target_link_libraries(mmap-shared-test PUBLIC libc)
|
||||
|
||||
add_custom_target(mmap-shared-test-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/mmap-shared-test ${BANAN_BIN}/
|
||||
DEPENDS mmap-shared-test
|
||||
)
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(nslookup CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(nslookup ${SOURCES})
|
||||
target_compile_options(nslookup PUBLIC -O2 -g)
|
||||
target_link_libraries(nslookup PUBLIC libc)
|
||||
banan_link_library(nslookup libc)
|
||||
|
||||
add_custom_target(nslookup-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/nslookup ${BANAN_BIN}/
|
||||
DEPENDS nslookup
|
||||
)
|
||||
install(TARGETS nslookup)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(poweroff CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(poweroff ${SOURCES})
|
||||
target_compile_options(poweroff PUBLIC -O2 -g)
|
||||
target_link_libraries(poweroff PUBLIC libc)
|
||||
banan_link_library(poweroff libc)
|
||||
|
||||
add_custom_target(poweroff-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/poweroff ${BANAN_BIN}/
|
||||
DEPENDS poweroff
|
||||
)
|
||||
install(TARGETS poweroff)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(resolver CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(resolver ${SOURCES})
|
||||
target_compile_options(resolver PUBLIC -O2 -g)
|
||||
target_link_libraries(resolver PUBLIC libc ban)
|
||||
banan_link_library(resolver ban)
|
||||
banan_link_library(resolver libc)
|
||||
|
||||
add_custom_target(resolver-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resolver ${BANAN_BIN}/
|
||||
DEPENDS resolver
|
||||
)
|
||||
install(TARGETS resolver)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(rm CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(rm ${SOURCES})
|
||||
target_compile_options(rm PUBLIC -O2 -g)
|
||||
target_link_libraries(rm PUBLIC libc ban)
|
||||
banan_include_headers(rm ban)
|
||||
banan_link_library(rm libc)
|
||||
|
||||
add_custom_target(rm-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/rm ${BANAN_BIN}/
|
||||
DEPENDS rm
|
||||
)
|
||||
install(TARGETS rm)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(sleep CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(sleep ${SOURCES})
|
||||
target_compile_options(sleep PUBLIC -O2 -g)
|
||||
target_link_libraries(sleep PUBLIC libc)
|
||||
banan_link_library(sleep libc)
|
||||
|
||||
add_custom_target(sleep-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/sleep ${BANAN_BIN}/
|
||||
DEPENDS sleep
|
||||
)
|
||||
install(TARGETS sleep)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(snake CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(snake ${SOURCES})
|
||||
target_compile_options(snake PUBLIC -O2 -g)
|
||||
target_link_libraries(snake PUBLIC libc)
|
||||
banan_include_headers(snake ban)
|
||||
banan_link_library(snake libc)
|
||||
|
||||
add_custom_target(snake-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/snake ${BANAN_BIN}/
|
||||
DEPENDS snake
|
||||
)
|
||||
install(TARGETS snake)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(stat CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(stat ${SOURCES})
|
||||
target_compile_options(stat PUBLIC -O2 -g)
|
||||
target_link_libraries(stat PUBLIC libc ban)
|
||||
banan_link_library(stat ban)
|
||||
banan_link_library(stat libc)
|
||||
|
||||
add_custom_target(stat-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/stat ${BANAN_BIN}/
|
||||
DEPENDS stat
|
||||
)
|
||||
install(TARGETS stat)
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(sudo CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(sudo ${SOURCES})
|
||||
target_compile_options(sudo PUBLIC -O2 -g)
|
||||
target_link_libraries(sudo PUBLIC libc)
|
||||
banan_link_library(sudo libc)
|
||||
|
||||
add_custom_target(sudo-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/sudo ${BANAN_BIN}/
|
||||
COMMAND /bin/chmod u+s ${BANAN_BIN}/sudo
|
||||
DEPENDS sudo
|
||||
)
|
||||
install(TARGETS sudo)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(sync CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(sync ${SOURCES})
|
||||
target_compile_options(sync PUBLIC -O2 -g)
|
||||
target_link_libraries(sync PUBLIC libc)
|
||||
banan_link_library(sync libc)
|
||||
|
||||
add_custom_target(sync-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/sync ${BANAN_BIN}/
|
||||
DEPENDS sync
|
||||
)
|
||||
install(TARGETS sync)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(tee CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(tee ${SOURCES})
|
||||
target_compile_options(tee PUBLIC -O2 -g)
|
||||
target_link_libraries(tee PUBLIC libc)
|
||||
banan_link_library(tee libc)
|
||||
|
||||
add_custom_target(tee-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/tee ${BANAN_BIN}/
|
||||
DEPENDS tee
|
||||
)
|
||||
install(TARGETS tee)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-framebuffer CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-framebuffer ${SOURCES})
|
||||
target_compile_options(test-framebuffer PUBLIC -O2 -g)
|
||||
target_link_libraries(test-framebuffer PUBLIC libc)
|
||||
banan_link_library(test-framebuffer libc)
|
||||
|
||||
add_custom_target(test-framebuffer-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-framebuffer ${BANAN_BIN}/
|
||||
DEPENDS test-framebuffer
|
||||
)
|
||||
install(TARGETS test-framebuffer)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-globals CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-globals ${SOURCES})
|
||||
target_compile_options(test-globals PUBLIC -O2 -g)
|
||||
target_link_libraries(test-globals PUBLIC libc)
|
||||
banan_link_library(test-globals libc)
|
||||
|
||||
add_custom_target(test-globals-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-globals ${BANAN_BIN}/
|
||||
DEPENDS test-globals
|
||||
)
|
||||
install(TARGETS test-globals)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-mmap-shared ${SOURCES})
|
||||
banan_link_library(test-mmap-shared libc)
|
||||
|
||||
install(TARGETS test-mmap-shared)
|
|
@ -1,16 +1,10 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-mouse CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-mouse ${SOURCES})
|
||||
target_compile_options(test-mouse PUBLIC -O2 -g)
|
||||
target_link_libraries(test-mouse PUBLIC libc)
|
||||
banan_include_headers(test-mouse ban)
|
||||
banan_include_headers(test-mouse libinput)
|
||||
banan_link_library(test-mouse libc)
|
||||
|
||||
add_custom_target(test-mouse-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-mouse ${BANAN_BIN}/
|
||||
DEPENDS test-mouse
|
||||
)
|
||||
install(TARGETS test-mouse)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-popen CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-popen ${SOURCES})
|
||||
target_compile_options(test-popen PUBLIC -O2 -g)
|
||||
target_link_libraries(test-popen PUBLIC libc)
|
||||
banan_link_library(test-popen libc)
|
||||
|
||||
add_custom_target(test-popen-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-popen ${BANAN_BIN}/
|
||||
DEPENDS test-popen
|
||||
)
|
||||
install(TARGETS test-popen)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-sort CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-sort ${SOURCES})
|
||||
target_compile_options(test-sort PUBLIC -O2 -g)
|
||||
target_link_libraries(test-sort PUBLIC libc)
|
||||
banan_include_headers(test-sort ban)
|
||||
banan_link_library(test-sort libc)
|
||||
|
||||
add_custom_target(test-sort-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-sort ${BANAN_BIN}/
|
||||
DEPENDS test-sort
|
||||
)
|
||||
install(TARGETS test-sort)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-tcp CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-tcp ${SOURCES})
|
||||
target_compile_options(test-tcp PUBLIC -O2 -g)
|
||||
target_link_libraries(test-tcp PUBLIC libc)
|
||||
banan_link_library(test-tcp libc)
|
||||
|
||||
add_custom_target(test-tcp-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-tcp ${BANAN_BIN}/
|
||||
DEPENDS test-tcp
|
||||
)
|
||||
install(TARGETS test-tcp)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-udp CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-udp ${SOURCES})
|
||||
target_compile_options(test-udp PUBLIC -O2 -g)
|
||||
target_link_libraries(test-udp PUBLIC libc)
|
||||
banan_link_library(test-udp libc)
|
||||
|
||||
add_custom_target(test-udp-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-udp ${BANAN_BIN}/
|
||||
DEPENDS test-udp
|
||||
)
|
||||
install(TARGETS test-udp)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-unix-socket CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-unix-socket ${SOURCES})
|
||||
target_compile_options(test-unix-socket PUBLIC -O2 -g)
|
||||
target_link_libraries(test-unix-socket PUBLIC libc)
|
||||
banan_link_library(test-unix-socket libc)
|
||||
|
||||
add_custom_target(test-unix-socket-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-unix-socket ${BANAN_BIN}/
|
||||
DEPENDS test-unix-socket
|
||||
)
|
||||
install(TARGETS test-unix-socket)
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test-window CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(test-window ${SOURCES})
|
||||
target_compile_options(test-window PUBLIC -O2 -g)
|
||||
target_link_libraries(test-window PUBLIC libc ban libgui)
|
||||
banan_include_headers(test-window ban)
|
||||
banan_include_headers(test-window libinput)
|
||||
banan_link_library(test-window libc)
|
||||
banan_link_library(test-window libgui)
|
||||
|
||||
add_custom_target(test-window-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test-window ${BANAN_BIN}/
|
||||
DEPENDS test-window
|
||||
)
|
||||
install(TARGETS test-window)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(test CXX)
|
||||
|
||||
set(TEST_SOURCES
|
||||
test.cpp
|
||||
)
|
||||
|
||||
add_executable(test ${TEST_SOURCES})
|
||||
target_compile_options(test PUBLIC -O2 -g)
|
||||
target_link_libraries(test PUBLIC libc)
|
||||
banan_link_library(test libc)
|
||||
|
||||
add_custom_target(test-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/test ${BANAN_BIN}/
|
||||
DEPENDS test
|
||||
)
|
||||
install(TARGETS test)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(touch CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(touch ${SOURCES})
|
||||
target_compile_options(touch PUBLIC -O2 -g)
|
||||
target_link_libraries(touch PUBLIC libc)
|
||||
banan_link_library(touch libc)
|
||||
|
||||
add_custom_target(touch-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/touch ${BANAN_BIN}/
|
||||
DEPENDS touch
|
||||
)
|
||||
install(TARGETS touch)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(u8sum CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(u8sum ${SOURCES})
|
||||
target_compile_options(u8sum PUBLIC -O2 -g)
|
||||
target_link_libraries(u8sum PUBLIC libc)
|
||||
banan_link_library(u8sum libc)
|
||||
|
||||
add_custom_target(u8sum-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/u8sum ${BANAN_BIN}/
|
||||
DEPENDS u8sum
|
||||
)
|
||||
install(TARGETS u8sum)
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(whoami CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(whoami ${SOURCES})
|
||||
target_compile_options(whoami PUBLIC -O2 -g)
|
||||
target_link_libraries(whoami PUBLIC libc ban)
|
||||
banan_include_headers(whoami ban)
|
||||
banan_link_library(whoami libc)
|
||||
|
||||
add_custom_target(whoami-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/whoami ${BANAN_BIN}/
|
||||
DEPENDS whoami
|
||||
)
|
||||
install(TARGETS whoami)
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(yes CXX)
|
||||
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(yes ${SOURCES})
|
||||
target_compile_options(yes PUBLIC -O2 -g)
|
||||
target_link_libraries(yes PUBLIC libc)
|
||||
banan_link_library(yes libc)
|
||||
|
||||
add_custom_target(yes-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/yes ${BANAN_BIN}/
|
||||
DEPENDS yes
|
||||
)
|
||||
install(TARGETS yes)
|
||||
|
|
Loading…
Reference in New Issue