Skip to content

Commit

Permalink
added nolibc flags, and additional
Browse files Browse the repository at this point in the history
  • Loading branch information
jdarge committed Nov 29, 2023
1 parent 121a77d commit 7bfb510
Show file tree
Hide file tree
Showing 53 changed files with 3,882 additions and 207 deletions.
27 changes: 22 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ set(PROJECT_NAME ${REPO})
# Set the C standard to C99
set(CMAKE_C_STANDARD 99)

# Compiler flags
set(CPP_FLAGS "-Wall -Wextra -pedantic")

# Compiler pre-processing flags
set(CPP_FLAGS
"-Wall"
"-Wextra"
"-pedantic"
"-Wno-builtin-declaration-mismatch"
)
# Set anti-lib flags
set(NOLIB
-static-libgcc
-static-libstdc++
-static-libasan
-nostartfiles
-nostdlib
)

# Add the src directory to the include path
include_directories(${PROJECT_SOURCE_DIR}/include)
Expand All @@ -20,14 +32,14 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.c)

# Create the executable from the source files
add_executable(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/driver.c ${SOURCES} include/string.h src/string.c)
add_executable(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/driver.c ${SOURCES})


# Set the output directory to the build/bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/build/bin)
set_target_properties(${PROJECT_NAME}
PROPERTIES
COMPILE_FLAGS ${CPP_FLAGS}
COMPILE_FLAGS ${CPP_FLAGS} ${NOLIB}
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/build/bin
)

Expand All @@ -38,6 +50,10 @@ set_property(
CMAKE_OBJECT_PATH_PREFIX ${PROJECT_SOURCE_DIR}/build/obj/
)

# Set link options
target_link_options(${PROJECT_NAME} PRIVATE ${CPP_FLAGS} ${NOLIB} -g)
# Set compiler flags for the target
target_compile_options(${PROJECT_NAME} PRIVATE ${CPP_FLAGS} ${NOLIB} -g)

# Set the cmake binary directory to the build/cmake directory
set(CMAKE_BINARY_DIR ${PROJECT_SOURCE_DIR}/build/cmake)
Expand All @@ -48,3 +64,4 @@ include_directories(${PROJECT_SOURCE_DIR}/build/cmake)

# Add any other dependencies here, such as libraries or additional build options

#13/44
Binary file added build/bin/lle
Binary file not shown.
Loading

0 comments on commit 7bfb510

Please sign in to comment.