-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gordon Smith <[email protected]>
- Loading branch information
1 parent
1dc88d6
commit 5b5f2c0
Showing
40 changed files
with
465 additions
and
1,198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,126 @@ | ||
project(graphlayout) | ||
project(graphvizlib) | ||
|
||
# find and link libraries | ||
find_path(Graphviz_INCLUDE_DIRS NAMES graphviz/gvc.h HINTS "${VCPKG_INSTALLED_DIR}" REQUIRED) | ||
|
||
# display directories where Graphviz libraries and headers are found | ||
message("Graphviz libraries: ${graphviz_LIBRARIES}") | ||
message("Graphviz include directories: ${Graphviz_INCLUDE_DIRS}") | ||
|
||
find_package(expat CONFIG REQUIRED) | ||
|
||
set(GRAPHVIZ_LIB_DIR "${GRAPHVIZ_DIR}/lib") | ||
set(GRAPHVIZ_PLUGIN_DIR "${GRAPHVIZ_DIR}/plugin") | ||
set(GRAPHVIZ_BUILD_DIR "${GRAPHVIZ_DIR}/build") | ||
# See: https://github.com/emscripten-core/emscripten/blob/main/src/settings.js | ||
string(REPLACE ";" " " CPP_FLAGS "${EM_CPP_FLAGS}") | ||
|
||
set(EM_LINK_FLAGS | ||
${EM_LINK_FLAGS} | ||
"-sFILESYSTEM=1" | ||
"-sEXPORT_NAME='${CMAKE_PROJECT_NAME}'" | ||
"-sEXPORTED_FUNCTIONS=\"['_free', '_malloc']\"" | ||
"-sEXPORTED_RUNTIME_METHODS=\"[]\"" | ||
"--post-js ${CMAKE_CURRENT_BINARY_DIR}/main_glue.js" | ||
) | ||
string(REPLACE ";" " " LINK_FLAGS "${EM_LINK_FLAGS}") | ||
|
||
# Generate Glue from IDL file --- | ||
add_custom_command( | ||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/main.idl | ||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/main_glue.js ${CMAKE_CURRENT_BINARY_DIR}/main_glue.cpp | ||
COMMAND python3 ${CMAKE_BINARY_DIR}/../emsdk/upstream/emscripten/tools/webidl_binder.py ${CMAKE_CURRENT_SOURCE_DIR}/main.idl ${CMAKE_CURRENT_BINARY_DIR}/main_glue | ||
) | ||
set_property(SOURCE main.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/main_glue.cpp) | ||
# --- --- --- | ||
|
||
set(SRCS | ||
main.cpp | ||
) | ||
|
||
include_directories( | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${VCPKG_INCLUDE_DIR} | ||
${Graphviz_INCLUDE_DIRS}/graphviz | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
# =============================== Build options ================================ | ||
option(enable_ltdl "Support on-demand plugin loading" OFF) | ||
option(with_expat "Support HTML-like labels through expat" ON ) | ||
option(with_digcola "DIGCOLA features in neato layout engine" ON ) | ||
option(with_ipsepcola "IPSEPCOLA features in neato layout engine (disabled by default - C++ portability issues)." ON ) | ||
option(with_ortho "ORTHO features in neato layout engine." ON ) | ||
option(with_sfdp "sfdp layout engine." ON ) | ||
option(with_smyrna "SMYRNA large graph viewer (disabled by default - experimental)" OFF) | ||
option(with_zlib "Support raster image compression through zlib" OFF) | ||
option(use_coverage "enables analyzing code coverage" OFF) | ||
option(with_cxx_api "enables building the C++ API" ON) | ||
option(with_cxx_tests "enables building the C++ tests" OFF) | ||
option(use_win_pre_inst_libs "enables building using pre-installed Windows libraries" OFF) | ||
|
||
if(with_digcola) | ||
add_definitions(-DDIGCOLA) | ||
endif() | ||
|
||
if(with_ipsepcola) | ||
add_definitions(-DIPSEPCOLA) | ||
endif() | ||
|
||
if(with_ortho) | ||
add_definitions(-DORTHO) | ||
endif() | ||
|
||
if(with_sfdp) | ||
add_definitions(-DSFDP) | ||
endif() | ||
|
||
# ===================== Append local CMake module directory ==================== | ||
list(APPEND CMAKE_MODULE_PATH "${GRAPHVIZ_DIR}/cmake") | ||
|
||
# find_package(ANN) | ||
|
||
# find_package(CAIRO) | ||
|
||
if(with_expat) | ||
find_package(EXPAT) | ||
endif() | ||
|
||
# find_package(GD) | ||
|
||
if(enable_ltdl) | ||
find_package(LTDL) | ||
if(LTDL_FOUND) | ||
add_definitions(-DENABLE_LTDL) | ||
endif() | ||
endif() | ||
|
||
# find_package(PANGOCAIRO) | ||
|
||
if(with_zlib) | ||
find_package(ZLIB) | ||
endif() | ||
|
||
# if(UNIX) | ||
# find_library(MATH_LIB m) | ||
# link_libraries(${MATH_LIB}) | ||
# endif() | ||
add_subdirectory(lib) | ||
add_subdirectory(plugin) | ||
add_subdirectory(graphvizlib) | ||
add_executable(graphvizlib | ||
${SRCS} | ||
) | ||
|
||
set_target_properties(graphvizlib PROPERTIES COMPILE_FLAGS "${CPP_FLAGS}") | ||
set_target_properties(graphvizlib PROPERTIES LINK_FLAGS "${LINK_FLAGS}") | ||
|
||
# link libraries | ||
function(add_graphviz_library library) | ||
find_library(GRAPHVIZ_${library} NAMES ${library}) | ||
if(GRAPHVIZ_${library}) | ||
target_link_libraries(graphvizlib PRIVATE ${GRAPHVIZ_${library}}) | ||
else() | ||
message(FATAL_ERROR "Could not find library ${library}!") | ||
endif() | ||
endfunction() | ||
|
||
# common gvplugin_core gvplugin_dot_layout gvplugin_neato_layout ortho gvc cdt cgraph dotgen neatogen fdpgen sfdpgen twopigen circogen label osage patchwork pack sparse pathplan xdot | ||
add_graphviz_library(common) | ||
add_graphviz_library(gvc) | ||
add_graphviz_library(gvplugin_core) | ||
add_graphviz_library(gvplugin_dot_layout) | ||
add_graphviz_library(gvplugin_neato_layout) | ||
add_graphviz_library(ortho) | ||
add_graphviz_library(cdt) | ||
add_graphviz_library(cgraph) | ||
add_graphviz_library(dotgen) | ||
add_graphviz_library(neatogen) | ||
add_graphviz_library(fdpgen) | ||
add_graphviz_library(sfdpgen) | ||
add_graphviz_library(twopigen) | ||
add_graphviz_library(circogen) | ||
add_graphviz_library(label) | ||
add_graphviz_library(osage) | ||
add_graphviz_library(patchwork) | ||
add_graphviz_library(pack) | ||
add_graphviz_library(sparse) | ||
add_graphviz_library(pathplan) | ||
add_graphviz_library(xdot) | ||
|
||
target_link_libraries(graphvizlib PRIVATE | ||
${EXPAT_LIBRARIES} | ||
) | ||
|
||
packWasm(graphvizlib) | ||
|
||
# add_executable(graphvizlib-web | ||
# ${SRCS} | ||
# ) | ||
|
||
# set_target_properties(graphvizlib-web PROPERTIES LINK_FLAGS "${LINK_FLAGS} -s ENVIRONMENT=web") | ||
|
||
# target_link_libraries(graphvizlib-web PRIVATE | ||
# gvplugin_core | ||
# gvplugin_dot_layout | ||
# gvplugin_neato_layout | ||
# ortho | ||
# ) | ||
|
||
# add_executable(graphvizlib-worker | ||
# ${SRCS} | ||
# ) | ||
|
||
# set_target_properties(graphvizlib-worker PROPERTIES LINK_FLAGS "${LINK_FLAGS} -s ENVIRONMENT=worker") | ||
|
||
# target_link_libraries(graphvizlib-worker PRIVATE | ||
# gvplugin_core | ||
# gvplugin_dot_layout | ||
# gvplugin_neato_layout | ||
# ortho | ||
# ) | ||
|
||
# add_executable(graphvizlib-node | ||
# ${SRCS} | ||
# ) | ||
|
||
# set_target_properties(graphvizlib-node PROPERTIES LINK_FLAGS "${LINK_FLAGS} -s ENVIRONMENT=node") | ||
|
||
# target_link_libraries(graphvizlib-node PRIVATE | ||
# gvplugin_core | ||
# gvplugin_dot_layout | ||
# gvplugin_neato_layout | ||
# ortho | ||
# ) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.