CMake Migration #3

Merged
wesley merged 1 commits from cmake-migration into main 2024-02-04 19:16:34 -05:00
6 changed files with 12 additions and 79 deletions
Showing only changes of commit cfe045acc3 - Show all commits

4
.gitignore vendored
View File

@@ -52,5 +52,5 @@ Module.symvers
Mkfile.old
dkms.conf
# Ignore /bin directory
/bin
# Ignore /build directory from cmake
build/

10
CMakeLists.txt Normal file
View File

@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.28.1)
project(quantum-utils)
add_library(quantum SHARED ./quantum/src/test.c)
add_executable(test_stuff ./test_stuff/src/main.c)
target_link_libraries(test_stuff quantum)
target_include_directories(test_stuff PUBLIC ./quantum/src/)

View File

@@ -1,29 +0,0 @@
#!/bin/bash
#
# Build script to build everything
set echo on
mkdir -p bin/
echo "Building all.."
pushd quantum
source build.sh
popd
ERRORLEVEL=$?
if [ $ERRORLEVEL -ne 0 ]; then
echo "Error:"$ERRORLEVEL && exit
fi
pushd test_stuff
source build.sh
popd
ERRORLEVEL=$?
if [ $ERRORLEVEL -ne 0 ]; then
echo "Error:"$ERRORLEVEL && exit
fi
echo "All assemblies built successfully!!!!"

View File

@@ -1,10 +0,0 @@
#!/bin/bash
# Clean up paths if they exist
if [[ -d "./build/" ]]; then
rm -rf ./build
fi
if [[ -d "./bin/" ]]; then
rm -rf ./bin
fi

View File

@@ -1,23 +0,0 @@
#!/bin/bash
#
# Build script for quantum
set echo on
mkdir -p ../build/
# Get a list of all the .c files.
cFilenames=$(find . -type f -name "*.c")
assembly="quantum"
objLocation="../build/libquantum.o"
compilerFlags="-g -c -fpic"
includeFlags="-Isrc"
echo "Building $assembly..."
# First we need to compile down to .o files
gcc $cFilenames $compilerFlags -o $objLocation $includeFlags
compilerFlags="-g -shared"
gcc $objLocation $compilerFlags -o ../bin/libquantum.so $includeFlags

View File

@@ -1,15 +0,0 @@
#!/bin/bash
#Build script for test_stuff
set echo on
# Get a list of all the .c files.
cFilenames=$(find . -type f -name "*.c")
assembly="test_stuff"
compilerFlags="-g -fpic"
includeFlags="-Isrc -I../quantum/src/"
linkerFlags="-L../bin/ -lquantum -Wl,-rpath,."
echo "Building $assembly..."
gcc $cFilenames $compilerFlags -o ../bin/$assembly $includeFlags $linkerFlags