Skip to content

Commit 802d7b9

Browse files
committed
Making the codebase compatible with macOS.
1 parent 7adf083 commit 802d7b9

File tree

7 files changed

+104
-13
lines changed

7 files changed

+104
-13
lines changed

CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ include(Functions.cmake)
1010
# Do some sanity check on the testing setup and enable testing if applicable.
1111
include(Testing.cmake)
1212

13-
find_package(Boost REQUIRED COMPONENTS filesystem log program_options regex system thread)
14-
find_package(Java REQUIRED)
15-
find_package(Odb REQUIRED)
16-
find_package(Threads REQUIRED)
17-
find_package(Thrift REQUIRED)
13+
find_package(Boost REQUIRED COMPONENTS filesystem log program_options regex system thread)
14+
find_package(Java REQUIRED)
15+
find_package(Odb REQUIRED)
16+
find_package(Threads REQUIRED)
17+
find_package(Thrift REQUIRED)
18+
find_package(Graphviz REQUIRED)
1819
find_package(GTest)
1920

2021
include(UseJava)

FindGraphviz.cmake

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# - Try to find Graphviz
2+
# Once done this will define
3+
#
4+
# GRAPHVIZ_FOUND - system has Graphviz
5+
# GRAPHVIZ_INCLUDE_DIRS - Graphviz include directories
6+
# GRAPHVIZ_CDT_LIBRARY - Graphviz CDT library
7+
# GRAPHVIZ_GVC_LIBRARY - Graphviz GVC library
8+
# GRAPHVIZ_CGRAPH_LIBRARY - Graphviz CGRAPH library
9+
# GRAPHVIZ_PATHPLAN_LIBRARY - Graphviz PATHPLAN library
10+
# GRAPHVIZ_VERSION - Graphviz version
11+
#
12+
# This module reads hints about search locations from the following cmake variables:
13+
# GRAPHVIZ_ROOT - Graphviz installation prefix
14+
# (containing bin/, include/, etc.)
15+
16+
# Copyright (c) 2009, Adrien Bustany, <[email protected]>
17+
# Copyright (c) 2013-2014 Kevin Funk <[email protected]>
18+
19+
# Version computation and some cleanups by Allen Winter <[email protected]>
20+
# Copyright (c) 2012-2014 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
21+
22+
# Simplified script by Dogan Can <[email protected]>
23+
# Copyright (c) 2014 University of Southern California
24+
25+
# Redistribution and use is allowed according to the terms of the GPLv3+ license.
26+
# Source: https://github.com/usc-sail/barista/blob/master/cmake/FindGraphviz.cmake
27+
28+
if(GRAPHVIZ_ROOT)
29+
set(_GRAPHVIZ_INCLUDE_DIR ${GRAPHVIZ_ROOT}/include)
30+
set(_GRAPHVIZ_LIBRARY_DIR ${GRAPHVIZ_ROOT}/lib)
31+
endif()
32+
33+
find_path(GRAPHVIZ_INCLUDE_DIR NAMES graphviz/cgraph.h
34+
HINTS ${_GRAPHVIZ_INCLUDE_DIR})
35+
find_library(GRAPHVIZ_CDT_LIBRARY NAMES cdt
36+
HINTS ${_GRAPHVIZ_LIBRARY_DIR})
37+
find_library(GRAPHVIZ_GVC_LIBRARY NAMES gvc
38+
HINTS ${_GRAPHVIZ_LIBRARY_DIR})
39+
find_library(GRAPHVIZ_CGRAPH_LIBRARY NAMES cgraph
40+
HINTS ${_GRAPHVIZ_LIBRARY_DIR})
41+
find_library(GRAPHVIZ_PATHPLAN_LIBRARY NAMES pathplan
42+
HINTS ${_GRAPHVIZ_LIBRARY_DIR})
43+
44+
if(GRAPHVIZ_INCLUDE_DIR AND GRAPHVIZ_CDT_LIBRARY AND GRAPHVIZ_GVC_LIBRARY
45+
AND GRAPHVIZ_CGRAPH_LIBRARY AND GRAPHVIZ_PATHPLAN_LIBRARY)
46+
set(GRAPHVIZ_FOUND TRUE)
47+
else()
48+
set(GRAPHVIZ_FOUND FALSE)
49+
endif()
50+
51+
# Ok, now compute the version
52+
if(GRAPHVIZ_FOUND)
53+
set(FIND_GRAPHVIZ_VERSION_SOURCE
54+
"#include <graphviz/graphviz_version.h>\n#include <stdio.h>\n int main()\n {\n printf(\"%s\",PACKAGE_VERSION);return 1;\n }\n")
55+
set(FIND_GRAPHVIZ_VERSION_SOURCE_FILE ${CMAKE_BINARY_DIR}/CMakeTmp/FindGRAPHVIZ.cxx)
56+
file(WRITE "${FIND_GRAPHVIZ_VERSION_SOURCE_FILE}" "${FIND_GRAPHVIZ_VERSION_SOURCE}")
57+
58+
set(FIND_GRAPHVIZ_VERSION_ADD_INCLUDES
59+
"-DINCLUDE_DIRECTORIES:STRING=${GRAPHVIZ_INCLUDE_DIR}")
60+
61+
try_run(RUN_RESULT COMPILE_RESULT
62+
${CMAKE_BINARY_DIR}
63+
${FIND_GRAPHVIZ_VERSION_SOURCE_FILE}
64+
CMAKE_FLAGS "${FIND_GRAPHVIZ_VERSION_ADD_INCLUDES}"
65+
RUN_OUTPUT_VARIABLE GRAPHVIZ_VERSION)
66+
67+
if(COMPILE_RESULT AND RUN_RESULT EQUAL 1)
68+
message(STATUS "Graphviz version: ${GRAPHVIZ_VERSION}")
69+
else()
70+
message(FATAL_ERROR "Unable to compile or run the graphviz version detection program.")
71+
endif()
72+
73+
set(GRAPHVIZ_INCLUDE_DIRS ${GRAPHVIZ_INCLUDE_DIR} ${GRAPHVIZ_INCLUDE_DIR}/graphviz)
74+
75+
if(NOT Graphviz_FIND_QUIETLY)
76+
message(STATUS "Graphviz include: ${GRAPHVIZ_INCLUDE_DIRS}")
77+
message(STATUS "Graphviz libraries: ${GRAPHVIZ_CDT_LIBRARY} ${GRAPHVIZ_GVC_LIBRARY} ${GRAPHVIZ_CGRAPH_LIBRARY} ${GRAPHVIZ_PATHPLAN_LIBRARY}")
78+
endif()
79+
endif()
80+
81+
if(Graphviz_FIND_REQUIRED AND NOT GRAPHVIZ_FOUND)
82+
message(FATAL_ERROR "Could not find GraphViz.")
83+
endif()

doc/deps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ cd thrift-0.13.0
192192
--without-php --without-php_extension --without-dart \
193193
--without-haskell --without-go --without-rs --without-haxe \
194194
--without-dotnetcore --without-d --without-qt4 --without-qt5 \
195-
--without-java
195+
--without-java --without-swift
196196

197197
make install -j $(nproc)
198198
```

logger/src/ldlogger-util.h

+2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
#define CC_LOGGER_UTIL_H
33

44
#include <limits.h>
5+
#ifdef __linux__
56
#include <linux/limits.h>
7+
#endif
68
#include <string.h>
79

810
/**

model/include/model/buildaction.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef CC_MODEL_BUILDACTION_H
22
#define CC_MODEL_BUILDACTION_H
33

4+
#include <cstdint>
45
#include <string>
56
#include <memory>
67
#include <vector>

plugins/cpp/service/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ target_link_libraries(cppservice
2626
mongoose
2727
projectservice
2828
languagethrift
29-
gvc
29+
${GRAPHVIZ_GVC_LIBRARY}
3030
${THRIFT_LIBTHRIFT_LIBRARIES})
3131

3232
install(TARGETS cppservice DESTINATION ${INSTALL_SERVICE_DIR})

util/CMakeLists.txt

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
include_directories(
22
${PROJECT_SOURCE_DIR}/util/include
3-
${PROJECT_SOURCE_DIR}/model/include
4-
${BOOST_INCLUDE_DIRS})
3+
${PROJECT_SOURCE_DIR}/model/include)
54

65
include_directories(SYSTEM
7-
${ODB_INCLUDE_DIRS})
6+
${Boost_INCLUDE_DIRS}
7+
${ODB_INCLUDE_DIRS}
8+
${GRAPHVIZ_INCLUDE_DIRS})
89

910
add_library(util SHARED
1011
src/dbutil.cpp
@@ -18,13 +19,16 @@ add_library(util SHARED
1819
src/util.cpp)
1920

2021
target_link_libraries(util
21-
gvc
22-
${Boost_LIBRARIES})
22+
${Boost_LIBRARIES}
23+
${ODB_LIBRARIES}
24+
${GRAPHVIZ_GVC_LIBRARY}
25+
${GRAPHVIZ_CGRAPH_LIBRARY})
2326

2427
string(TOLOWER "${DATABASE}" _database)
2528
if (${_database} STREQUAL "sqlite")
29+
find_package(SQLite3)
2630
target_link_libraries(util
27-
sqlite3)
31+
${SQLite3_LIBRARIES})
2832
endif()
2933

3034
install(TARGETS util DESTINATION ${INSTALL_LIB_DIR})

0 commit comments

Comments
 (0)