Build improvements (#2832) · AdaWorldAPI/RedisGraph@e05946e · GitHub
Skip to content

Commit e05946e

Browse files
authored
Build improvements (RedisGraph#2832)
* Build improvements * fixes 1 * fixes 2 * fixes 3 * fixes 4 * fixes 5 * fixes 6 * fixes 7 * fixes 8 * fixes 1 * fixes 2 * fixes 3 * fixes 4 * fixes 5 * fixes 6 * fixes 7 * fixes 8 * fixes 9 * fixes 10
1 parent 307dad6 commit e05946e

13 files changed

Lines changed: 188 additions & 96 deletions

File tree

.circleci/config.yml

Lines changed: 10 additions & 1 deletion

.github/workflows/build-macos.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build on macOS
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-macos:
9+
runs-on: macos-11
10+
defaults:
11+
run:
12+
shell: bash -l -eo pipefail {0}
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
submodules: true
17+
- name: Setup
18+
run: |
19+
./sbin/setup
20+
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
21+
./deps/readies/bin/getredis --with-github-token
22+
- name: Build
23+
run: |
24+
make
25+
make pack
26+
- name: Unit tests
27+
run: |
28+
make unit-tests CLEAR_LOGS=0
29+
- name: Flow tests
30+
run: |
31+
make flow-tests CLEAR_LOGS=0
32+
- name: TCK tests
33+
run: |
34+
make tck-tests CLEAR_LOGS=0
35+
- name: Fuzzer tests
36+
run: |
37+
make fuzz

CMakeLists.txt

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ endif()
99

1010
project(redisgraph)
1111

12-
file(GLOB_RECURSE SOURCES "src/*.c")
12+
setup_cc_options()
1313

14-
if (NOT APPLE)
15-
add_library(redisgraph SHARED ${SOURCES})
16-
else()
17-
add_library(redisgraph MODULE ${SOURCES})
18-
endif()
14+
file(GLOB_RECURSE SOURCES "src/*.c")
1915

20-
set_property(TARGET redisgraph PROPERTY C_STANDARD 11)
16+
add_library(redisgraph SHARED ${SOURCES})
2117

2218
include_directories(
2319
${root}/src
@@ -41,17 +37,11 @@ if (DEBUG)
4137
add_compile_definitions(RG_DEBUG)
4238
endif()
4339

44-
add_compile_options(${CMAKE_CC_FLAGS} ${CMAKE_CC_C_FLAGS})
45-
target_compile_options(redisgraph PRIVATE -fPIC ${CMAKE_CC_FLAGS} ${CMAKE_CC_C_FLAGS})
4640
if (MEMCHECK)
4741
add_compile_definitions(MEMCHECK)
4842
endif()
4943

50-
lists_from_env(LIBOMP)
51-
target_link_options(redisgraph PRIVATE ${CMAKE_LD_FLAGS} ${CMAKE_SO_LD_FLAGS} ${LIBOMP})
52-
53-
set_target_properties(redisgraph PROPERTIES PREFIX "")
54-
set_target_properties(redisgraph PROPERTIES SUFFIX ".so")
44+
setup_shared_object_target(redisgraph "")
5545

5646
set_target_properties(redisgraph PROPERTIES LINKER_LANGUAGE CXX)
5747

@@ -60,17 +50,16 @@ set(REDISGRAPH_OBJECTS $<TARGET_OBJECTS:redisgraph>)
6050
lists_from_env(GRAPHBLAS LIBXXHASH RAX LIBCYPHER_PARSER REDISEARCH_LIBS UTF8PROC)
6151
set(REDISGRAPH_LIBS ${GRAPHBLAS} ${LIBXXHASH} ${RAX} ${LIBCYPHER_PARSER} ${REDISEARCH_LIBS} ${UTF8PROC})
6252

63-
target_link_libraries(redisgraph PRIVATE ${REDISGRAPH_LIBS} c m dl pthread)
53+
target_link_options(redisgraph PRIVATE ${CMAKE_LD_FLAGS_LIST} ${CMAKE_SO_LD_FLAGS_LIST})
54+
target_link_libraries(redisgraph PRIVATE ${REDISGRAPH_LIBS} ${CMAKE_LD_LIBS})
6455

6556
extract_debug_symbols(redisgraph)
6657

6758
if (APPLE)
68-
# add_library(redisgraph_dylib SHARED $<TARGET_OBJECTS:redisgraph>)
69-
# target_link_libraries(redisgraph_dylib PRIVATE ${REDISGRAPH_LIBS} ${LIBOMP} c m dl pthread)
70-
7159
add_library(redisgraph_static STATIC $<TARGET_OBJECTS:redisgraph>)
7260
endif()
7361

7462
if (UNIT_TESTS)
7563
add_subdirectory(${root}/tests/unit tests/unit)
7664
endif()
65+

Makefile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ LIBS=$(RAX) $(LIBXXHASH) $(GRAPHBLAS) $(REDISEARCH_LIBS) $(LIBCYPHER_PARSER) $(U
141141

142142
CC_COMMON_H=$(SRCDIR)/src/common.h
143143

144+
CC_C_STD=gnu11
145+
CC_OPENMP=1
146+
144147
include $(MK)/defs
145148

146149
$(info # Building into $(BINDIR))
@@ -296,7 +299,7 @@ endif
296299

297300
#----------------------------------------------------------------------------------------------
298301

299-
pack package: $(TARGET)
302+
pack package: #$(TARGET)
300303
@MODULE=$(realpath $(TARGET)) $(ROOT)/sbin/pack.sh
301304

302305
upload-release:
@@ -321,14 +324,7 @@ ifneq ($(BUILD),0)
321324
TEST_DEPS=$(TARGET)
322325
endif
323326

324-
ifeq ($(VG_DOCKER),1)
325-
test:
326-
@echo Building docker to run valgrind on macOS
327-
$(SHOW)docker build -f tests/Dockerfile -t macos_test_docker .
328-
else
329-
test: $(TEST_DEPS)
330-
$(SHOW)MODULE=$(TARGET) BINROOT=$(BINROOT) PARALLEL=$(_RLTEST_PARALLEL) ./tests/flow/tests.sh
331-
endif
327+
test: unit-tests flow-tests tck-tests
332328

333329
unit-tests:
334330
ifneq ($(BUILD),0)
@@ -385,7 +381,9 @@ COV_EXCLUDE+=$(foreach D,$(COV_EXCLUDE_DIRS),'$(realpath $(ROOT))/$(D)/*')
385381
coverage:
386382
$(SHOW)$(MAKE) build COV=1
387383
$(SHOW)$(COVERAGE_RESET)
388-
-$(SHOW)$(MAKE) test COV=1
384+
-$(SHOW)$(MAKE) unit-tests COV=1
385+
-$(SHOW)$(MAKE) flow-tests COV=1
386+
-$(SHOW)$(MAKE) tck-tests COV=1
389387
$(SHOW)$(COVERAGE_COLLECT_REPORT)
390388

391389
.PHONY: coverage

build/docker/dockerfile.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ADD . /build
1919
RUN ./deps/readies/bin/getbash
2020
{% endif %}
2121
RUN ./deps/readies/bin/getupdates
22-
RUN ./sbin/setup
22+
RUN VERBOSE=1 ./sbin/setup
2323

2424
RUN make
2525

sbin/pack.sh

Lines changed: 74 additions & 46 deletions

0 commit comments

Comments
 (0)