Skip to content

Commit

Permalink
chore: Update Makefile to use correct directory for cmake command
Browse files Browse the repository at this point in the history
  • Loading branch information
janjurca committed Jun 25, 2024
1 parent d33d8bc commit cb2a654
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
41 changes: 24 additions & 17 deletions .copr/Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
CMAKELISTS_FILE := CMakeLists.txt

# Determine if we are in the specific subdirectory
ROOT_DIR := $(shell git rev-parse --show-toplevel)
CURRENT_DIR := $(shell pwd)
SUBDIR := specific-makefiles/build-in-libs

# Path to the build directory should always be in the root
BUILD_DIR := $(ROOT_DIR)/build
CMAKELISTS_FILE := $(ROOT_DIR)/CMakeLists.txt

# Command to use for cmake based on current directory
CMAKE_COMMAND := cmake -S $(ROOT_DIR) -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release
ifneq ($(findstring $(SUBDIR), $(CURRENT_DIR)),)
CMAKE_COMMAND := $(CMAKE_COMMAND) -DUSE_CPM=1
endif

srpm:
dnf -y install cmake gcc-c++ make spdlog-devel fmt-devel cxxopts-devel json-devel git
mkdir -p build
pwd
make
@VERSION_STRING=$$(cat build/.version); \
mkdir -p $(BUILD_DIR)
cd $(ROOT_DIR); make
@VERSION_STRING=$$(cat $(BUILD_DIR)/.version); \
sed -i 's/\$${PROJECT_VERSION}/'$$VERSION_STRING'/g' $(CMAKELISTS_FILE); \
sed -i '/include(cmake\/DynamicVersion\.cmake)/d' $(CMAKELISTS_FILE); \
sed -i '/dynamic_version(PROJECT_PREFIX filestorm_)/d' $(CMAKELISTS_FILE); \
sed -i 's/cmake_minimum_required(VERSION 3.25)/cmake_minimum_required(VERSION 3.20)/g' $(CMAKELISTS_FILE)
make clean
mkdir -p build
ifeq ($(wildcard USE_CPM),)
echo RUNNING without CPM; \
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
else
echo RUNNING with CPM; \
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DUSE_CPM=1
endif
cpack -G RPM --config build/CPackSourceConfig.cmake
echo `ls`
for rpmfile in `ls filestorm-*.src.rpm`; do \
cd $(ROOT_DIR); make clean
mkdir -p $(BUILD_DIR)
$(CMAKE_COMMAND)
cpack -G RPM --config $(BUILD_DIR)/CPackSourceConfig.cmake
echo `ls $(BUILD_DIR)`
for rpmfile in `ls $(CURRENT_DIR)/filestorm-*.src.rpm`; do \
echo $$rpmfile; \
cp $$rpmfile $(outdir); \
done
14 changes: 0 additions & 14 deletions specific-makefiles/build-in-libs/Makefile

This file was deleted.

0 comments on commit cb2a654

Please sign in to comment.