diff --git a/.gitignore b/.gitignore index c795b05..850ad16 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -build \ No newline at end of file +build +*.o +*.so \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ff1354..5e3e19c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,10 +8,10 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) # Add source files -file(GLOB SOURCES "src/*.cpp") +file(GLOB SOURCES "src/utils/*.cpp" "src/nbt/*.cpp") -# Add an executable target -add_executable(ac ${SOURCES}) +# Add an shared library target +add_library(ac SHARED ${SOURCES}) # Optionally, if you have any additional include directories or libraries, add them here: # target_include_directories(ac PRIVATE ${CMAKE_SOURCE_DIR}/include) diff --git a/Makefile b/Makefile index b9e8d4c..98810c4 100644 --- a/Makefile +++ b/Makefile @@ -3,22 +3,16 @@ CXX = g++ CXXFLAGS = -std=c++17 -Wall -Wextra # Source files and target executable -SRCS = $(wildcard src/*.cpp) -OBJS = $(SRCS:.cpp=.o) -TARGET = ac # Build target -all: $(TARGET) +all: clean build -$(TARGET): $(OBJS) - $(CXX) $(CXXFLAGS) -o $@ $(OBJS) - -# Build object files -%.o: %.cpp - $(CXX) $(CXXFLAGS) -c $< -o $@ +build: + mkdir build + cd build && cmake .. && make && mv libac.so .. # Clean up build artifacts clean: - rm -f $(TARGET) $(OBJS) + rm -rf build .PHONY: all clean diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 9949342..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(ac SHARED Progress.cpp Progress.h) \ No newline at end of file diff --git a/src/Progress.cpp b/src/utils/Progress.cpp similarity index 100% rename from src/Progress.cpp rename to src/utils/Progress.cpp diff --git a/src/Progress.h b/src/utils/Progress.h similarity index 100% rename from src/Progress.h rename to src/utils/Progress.h