diff --git a/.github/workflows/build-cmake.yml b/.github/workflows/build-cmake.yml new file mode 100644 index 00000000..63e1828b --- /dev/null +++ b/.github/workflows/build-cmake.yml @@ -0,0 +1,96 @@ +name: build-all +on: + workflow_dispatch: + inputs: + macos_version: + type: choice + description: Select MacOS version + default: macos-15 + required: true + options: + - macos-latest + - macos-15 + - macos-14 + - macos-13 + + linux_version: + type: choice + description: Select Linux version + default: ubuntu-24.04 + required: true + options: + - ubuntu-latest + - ubuntu-24.04 + - ubuntu-22.04 + + # windows_version: + # type: choice + # description: Select Windows version + # default: windows-2019 + # required: true + # options: + # - windows-latest + # - windows-2025 + # - windows-2022 + # - windows-2019 + +jobs: + build-macos: + runs-on: ${{ github.event.inputs.macos_version }} + steps: + + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + fetch-depth: '0' + + - name: install dependencies + run: brew update && brew install cairomm swig + + - name: build adaptagrams and swig python extension + run: make python + + - uses: actions/upload-artifact@v4 + with: + name: adaptagrams-macos + path: build/install + + + build-linux: + runs-on: ${{ github.event.inputs.linux_version }} + steps: + + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + fetch-depth: '0' + + - name: install dependencies + run: sudo apt update && sudo apt install libcairomm-1.16-dev swig + + - name: build adaptagrams and swig python extension + run: make python + + - uses: actions/upload-artifact@v4 + with: + name: adaptagrams-linux + path: build/install + + + # build-windows: + # runs-on: ${{ github.event.inputs.windows_version }} + # steps: + + # - uses: actions/checkout@v4 + # with: + # submodules: 'recursive' + # fetch-depth: '0' + + # - name: build adaptagrams and swig python extension + # run: make python + + # - uses: actions/upload-artifact@v4 + # with: + # name: adaptagrams-windows + # path: build/install + diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000..f19c544d --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,87 @@ +name: build-all +on: + workflow_dispatch: + inputs: + windows_version: + type: choice + description: Select Windows version + default: windows-2019 + required: true + options: + - windows-latest + - windows-2025 + - windows-2022 + - windows-2019 + +jobs: + build-windows: + runs-on: ${{ github.event.inputs.windows_version }} + steps: + + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + fetch-depth: '0' + + - name: install conan + run: pip install conan + + - name: create conan profile + run: conan profile detect --force + + - name: conan install dependencies + run: conan install . --output-folder=build --build=missing + + - name: build using cmake + run: | + cd build + cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release + cmake --build . --config Release + + - uses: actions/upload-artifact@v4 + with: + name: adaptagrams-windows + path: build/install + + + # build-macos: + # runs-on: ${{ github.event.inputs.macos_version }} + # steps: + + # - uses: actions/checkout@v4 + # with: + # submodules: 'recursive' + # fetch-depth: '0' + + # - name: install dependencies + # run: brew update && brew install cairomm swig + + # - name: build adaptagrams and swig python extension + # run: make python + + # - uses: actions/upload-artifact@v4 + # with: + # name: adaptagrams-macos + # path: build/install + + + # build-linux: + # runs-on: ${{ github.event.inputs.linux_version }} + # steps: + + # - uses: actions/checkout@v4 + # with: + # submodules: 'recursive' + # fetch-depth: '0' + + # - name: install dependencies + # run: sudo apt update && sudo apt install libcairomm-1.16-dev swig + + # - name: build adaptagrams and swig python extension + # run: make python + + # - uses: actions/upload-artifact@v4 + # with: + # name: adaptagrams-linux + # path: build/install + diff --git a/.gitignore b/.gitignore index 4a2cf647..afc66e83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store .vscode .idea +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..d0724c15 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,142 @@ +cmake_minimum_required(VERSION 3.28) + +project(adaptagrams) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} CACHE PATH "" FORCE) + +option(BUILD_SWIG_PYTHON "Enable building swig python wrapper") +option(BUILD_TESTS "Enable building tests") +option(ENABLE_CCACHE "Use ccache if available" ON) + +# use ccache if available +if(ENABLE_CCACHE) + find_program(CCACHE_PROGRAM ccache) + if(CCACHE_PROGRAM) + message(STATUS "Found ccache in ${CCACHE_PROGRAM}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}") + endif() +endif() + +message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") + +# optional cairo package +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(package_name cairomm-1.16) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(package_name cairomm-svg-1.16) +else() + set(HAVE_CAIROMM 0 CACHE BOOL "" FORCE) +endif() + +if(DEFINED package_name) + find_package(PkgConfig) + if(PkgConfig_FOUND) + pkg_check_modules(CAIROMM ${package_name}) + if(CAIROMM_FOUND) + set(HAVE_CAIROMM 1 CACHE BOOL "have cairomm on system" FORCE) + message(STATUS "CAIROMM_INCLUDE_DIRS: ${CAIROMM_INCLUDE_DIRS}") + message(STATUS "CAIROMM_LIBRARY_DIRS: ${CAIROMM_LIBRARY_DIRS}") + message(STATUS "CAIROMM_LIBRARIES: ${CAIROMM_LIBRARIES}") + message(STATUS "CAIROMM_CFLAGS: ${CAIROMM_CFLAGS}") + message(STATUS "CAIROMM_LDFLAGS: ${CAIROMM_LDFLAGS}") + else() + message(STATUS "${package_name} NOT FOUND") + set(HAVE_CAIROMM 0 CACHE BOOL "" FORCE) + endif() + else() + message(STATUS "PkgConfig NOT FOUND") + set(HAVE_CAIROMM 0 CACHE BOOL "" FORCE) + endif() +endif() + +include(CheckIncludeFile) + +CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H) +CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H) +CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) +CHECK_INCLUDE_FILE(stdio.h HAVE_STDIO_H) +CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H) +CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H) +CHECK_INCLUDE_FILE(string.h HAVE_STRING_H) +CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) + +configure_file( + ${CMAKE_SOURCE_DIR}/cola/libcola/config.h.cmake.in + ${CMAKE_SOURCE_DIR}/cola/libcola/config.h +) + +if(BUILD_TESTS) + enable_testing() +endif() + + +add_subdirectory(cola) + + +if(BUILD_SWIG_PYTHON) + find_package(SWIG COMPONENTS python) + find_package(Python COMPONENTS Interpreter Development.Module REQUIRED) + if(SWIG_FOUND AND Python_FOUND) + message(STATUS "building adaptagrams swig python extension") + set(generated_file ${CMAKE_BINARY_DIR}/adaptagrams_wrap.cxx) + execute_process( + OUTPUT_FILE ${CMAKE_BINARY_DIR}/adaptagrams_wrap.cxx + COMMAND ${SWIG_EXECUTABLE} -DNDEBUG -c++ -python + -outdir ${CMAKE_BINARY_DIR} + -o ${generated_file} adaptagrams.i + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cola + ) + if(NOT EXISTS ${generated_file}) + message(FATAL_ERROR "did not generate: ${generated_file}") + endif() + + python_add_library( + _adaptagrams + MODULE WITH_SOABI + ${generated_file} + ) + + set_target_properties( + _adaptagrams + PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + ) + + target_compile_definitions( + _adaptagrams + PRIVATE + USE_ASSERT_EXCEPTIONS + SWIG_PYTHON_SILENT_MEMLEAK + ) + + target_include_directories( + _adaptagrams + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ) + + target_link_libraries( + _adaptagrams + PRIVATE + avoid + cola + dialect + topology + vpsc + ) + + install(TARGETS _adaptagrams DESTINATION lib/adaptagrams) + install(FILES ${CMAKE_SOURCE_DIR}/cola/__init__.py DESTINATION lib/adaptagrams) + install(FILES ${CMAKE_BINARY_DIR}/adaptagrams.py DESTINATION lib/adaptagrams) + else() + message(FATAL_ERROR "NotFoundError: SWIG: ${SWIG_FOUND} Python: ${Python_FOUND}") + endif() +endif() diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e64fcc62 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ + +PREFIX ?= $(CURDIR)/build/install + +.PHONY: all build python test clean install + +all: build + +build: + @mkdir -p build \ + && cd build \ + && cmake .. \ + && cmake --build . --config Release + +python: + @mkdir -p build && cd build \ + && cmake .. -DBUILD_SWIG_PYTHON=ON \ + && cmake --build . --config Release \ + && cmake --install . --prefix $(PREFIX) + +test: + @mkdir -p build && cd build \ + && cmake .. -DBUILD_TESTS=ON \ + && cmake --build . --config Debug \ + && ctest + +install: build + @cd build \ + && cmake --install . --prefix $(PREFIX) + +clean: + @rm -rf build diff --git a/README.md b/README.md index 442ea785..4d5cddbb 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,64 @@ -Adaptagrams -=========== +# Adaptagrams Adaptagrams is a library of tools and reusable code for adaptive diagramming applications, for example: drawing tools, automated document and diagram layout, smart presentation software, graph drawing, chart layout, etc. -Currently, the [Adaptagrams repository][repo] includes five cross-platform C++ +Currently, the [Adaptagrams repository][repo] includes five cross-platform C++ libraries: - * [libvpsc][libvpsc] - - a solver for the Variable Placement with Separation - Constraints problem. This is a quadratic programming - problem in which the squared differences between a - placement vector and some ideal placement are minimised - subject to a set of separation constraints. This is very - useful in a number of layout problems. - * [libcola][libcola] - - a library for constraint graph layout. Specifically, - force-directed layout using the stress-majorization - method subject to separation constraints. Applications - include layout with non-overlapping nodes and clusters, - directed graph layout and layout preserving the crossing - properties of a given starting layout. - - libcola depends on libvpsc. - * [libavoid][libavoid] - - a library providing high-quality object-avoiding polyline - and orthogonal connector routing for use in interactive - diagram editors. - * [libtopology][libtopology] - - a library containing extensions to libcola to support - topology preserving constraint-based layout. - - libtopology depends on libavoid, libcola and libvpsc. - * [libdialect][libdialect] - - a library for computing human-like orthogonal network - (DiAlEcT) layouts via the following steps: - D = Decompose/Distribute; A = Arrange; - E = Expand/Emend; and T = Transform. - - libdialect depends on libavoid, libcola and libvpsc. +- [libvpsc][libvpsc] + - a solver for the Variable Placement with Separation + Constraints problem. This is a quadratic programming + problem in which the squared differences between a + placement vector and some ideal placement are minimised + subject to a set of separation constraints. This is very + useful in a number of layout problems. + +- [libcola][libcola] + - a library for constraint graph layout. Specifically, + force-directed layout using the stress-majorization + method subject to separation constraints. Applications + include layout with non-overlapping nodes and clusters, + directed graph layout and layout preserving the crossing + roperties of a given starting layout. + + - libcola depends on libvpsc. + +- [libavoid][libavoid] + - a library providing high-quality object-avoiding polyline + and orthogonal connector routing for use in interactive + diagram editors. + +- [libtopology][libtopology] + - a library containing extensions to libcola to support + topology preserving constraint-based layout. + + - libtopology depends on libavoid, libcola and libvpsc. + +- [libdialect][libdialect] + - a library for computing human-like orthogonal network + (`DiAlEcT`) layouts via the following steps: + + ```text + D = Decompose/Distribute; A = Arrange; + E = Expand/Emend; and T = Transform. + ``` + + - libdialect depends on libavoid, libcola and libvpsc. These libraries are collectively known as cola (for Constraint Layout). The -newest version of the C++ source code for cola can be found in the +newest version of the C++ source code for cola can be found in the Adaptagrams GitHub repository maintained by [Michael Wybrow][mw]: - * [https://github.com/mjwybrow/adaptagrams/][repo] +- [https://github.com/mjwybrow/adaptagrams/][repo] -The algorithms were developed by members of the [Immersive Analytics Lab][ialab] -at [Monash University][monash] in Melbourne, Australia. The Adaptagrams libraries +The algorithms were developed by members of the [Immersive Analytics Lab][ialab] +at [Monash University][monash] in Melbourne, Australia. The Adaptagrams libraries were written by [Tim Dwyer][td], [Michael Wybrow][mw] and [Steve Kieffer][sk]. All code in the Adaptagrams repository is released as open source software -under the terms of the LGPL 2.1 or later, see the LICENSE file. +under the terms of the LGPL 2.1 or later, see the LICENSE file. We also dual-license the Adaptagrams libraries and for a fee we can provide them under a less-restrictive commercial license as well as extend them to fit @@ -58,20 +67,17 @@ project and would like it to appear in the main Adaptagrams repository, we require that you assign the copyright on your changes to Monash University with the following statement: "I hereby assign copyright in this code to Monash University, to be licensed under the same terms as the rest of the code." - -Software using one or more of the Adaptagrams libraries include: - * [Dunnart][dunnart], constraint-based diagram editor, - * [Inkscape][inkscape], the popular open source vector graphics editor, - * [Graphviz][graphviz], open source graph visualisation software, - * [Arcadia][arcadia], a visualisation tool for metabolic pathways, - * [Gaphas][gaphor], an open source Python-based diagramming widget for GTK+, and - * [BRL-CAD][brlcad], a powerful cross-platform open source solid modeling system that includes interactive geometry editing, high-performance ray-tracing for rendering and geometric analysis, image and signal-processing tools, a system performance analysis benchmark suite, libraries for robust geometric representation, with more than 20 years of active development. +Software using one or more of the Adaptagrams libraries include: +- [Dunnart][dunnart], constraint-based diagram editor, +- [Inkscape][inkscape], the popular open source vector graphics editor, +- [Graphviz][graphviz], open source graph visualisation software, +- [Arcadia][arcadia], a visualisation tool for metabolic pathways, +- [Gaphas][gaphor], an open source Python-based diagramming widget for GTK+, and +- [BRL-CAD][brlcad], a powerful cross-platform open source solid modeling system that includes interactive geometry editing, high-performance ray-tracing for rendering and geometric analysis, image and signal-processing tools, a system performance analysis benchmark suite, libraries for robust geometric representation, with more than 20 years of active development. - -Building --------- +## Building The library code is all contained in the `cola` directory of the repository. @@ -83,13 +89,47 @@ The only dependency is [Cairo][cairo] if debugging SVG output is to be included Run `./autogen.sh` to compile from scratch. -Use from other languages ------------------------- +--- + +Alternatively, you can use [cmake](https://cmake.org) to build as well. + +In this case, the following installs `cmake` if required and also optional dependencies on MacOS: + +```sh +brew install cmake python swig cairomm +``` + +and similarly on a debian based Linux system: + +```sh +sudo apt install cmake swig libcairomm-1.16-dev +``` + +Then, to build the adaptagrams libraries, one can type `make` or: + +```sh +mkdir -p build && cd build && cmake .. && cmake --build . --config Release +``` + +To build a debug configuration and run tests, type `make test` or: + +```sh +mkdir -p build && cd build \ + && cmake .. -DBUILD_TESTS=ON && cmake --build . --config Release +``` + +To build the libraries with the swig python extension, type `make python` or: + +```sh +mkdir -p build && cd build \ + && cmake .. -DBUILD_SWIG_PYTHON=ON && cmake --build . --config Release +``` + +## Use from other languages Bindings for use of the Adaptagrams libraries can be generated using [SWIG][swig]. The repository contains a SWIG interface file `cola/adaptagrams.i`. We have successfully tested and used Adaptagrams from Java and Python in this way. -Cola in the browser -------------------- +## Cola in the browser [cola.js][webcola] (a.k.a. WebCola) is a JavaScript based rewrite of libcola which works well with [D3.js][d3] @@ -97,7 +137,6 @@ Cola in the browser [webcola]: http://ialab.it.monash.edu/webcola/ [swig]: http://www.swig.org/ [td]: http://users.monash.edu/~tdwyer/ -[km]: http://users.monash.edu/~kmarriott/ [mw]: http://users.monash.edu/~mwybrow/ [sk]: http://skieffer.info/ [ialab]: http://ialab.it.monash.edu/ @@ -115,4 +154,3 @@ Cola in the browser [cairo]: http://cairographics.org/ [repo]: https://github.com/mjwybrow/adaptagrams/ [brlcad]: http://brlcad.org/ - diff --git a/cola/.gitignore b/cola/.gitignore index 2958e029..12b0d7a2 100644 --- a/cola/.gitignore +++ b/cola/.gitignore @@ -55,6 +55,7 @@ diff !*/tests/*.cpp !*/tests/*.h !*/tests/Makefile.am +!*/tests/CMakeLists.txt !libdialect/tests/swig_tests libdialect/tests/swig_tests/output/* !libdialect/tests/swig_tests/output/README.txt diff --git a/cola/CMakeLists.txt b/cola/CMakeLists.txt new file mode 100644 index 00000000..3cd41ab9 --- /dev/null +++ b/cola/CMakeLists.txt @@ -0,0 +1,31 @@ + +set(COMMON_COMPILE_DEFINITIONS + # $<$:_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS> + # $<$:_CRT_SECURE_NO_WARNINGS> + # $<$:LIBAVOID_NO_DLL> + # $<$:_WIN32_WINNT=0x0501> + # $<$:_USE_MATH_DEFINES> + + # libavoid + $<$:NDEBUG> + $<$:NOMINMAX> + $<$:WIN32> + $<$:_WINDOWS> + $<$:_USRDLL> + $<$:LIBAVOID_EXPORTS> + + $<$:-Wall> + $<$:-Wpointer-arith> + $<$:-Wcast-align> + $<$:-Wsign-compare> + $<$:-Woverloaded-virtual> + $<$:-Wswitch> +) + +add_subdirectory(libavoid) +add_subdirectory(libcola) +add_subdirectory(libdialect) +add_subdirectory(libproject) +add_subdirectory(libtopology) +add_subdirectory(libvpsc) + diff --git a/cola/libavoid/CMakeLists.txt b/cola/libavoid/CMakeLists.txt new file mode 100644 index 00000000..f14b063f --- /dev/null +++ b/cola/libavoid/CMakeLists.txt @@ -0,0 +1,103 @@ +set(LIB_NAME avoid) + +set(LIB_SOURCES + actioninfo.cpp + connectionpin.cpp + connector.cpp + connend.cpp + geometry.cpp + geomtypes.cpp + graph.cpp + hyperedge.cpp + hyperedgeimprover.cpp + hyperedgetree.cpp + junction.cpp + makepath.cpp + mtst.cpp + obstacle.cpp + orthogonal.cpp + router.cpp + scanline.cpp + shape.cpp + timer.cpp + vertices.cpp + viscluster.cpp + visibility.cpp + vpsc.cpp +) + +set(LIB_HEADERS + actioninfo.h + assertions.h + connectionpin.h + connector.h + connend.h + debug.h + debughandler.h + dllexport.h + geometry.h + geomtypes.h + graph.h + hyperedge.h + hyperedgeimprover.h + hyperedgetree.h + junction.h + libavoid.h + makepath.h + mtst.h + obstacle.h + orthogonal.h + router.h + scanline.h + shape.h + timer.h + vertices.h + viscluster.h + visibility.h + vpsc.h +) + + +add_library(${LIB_NAME} + ${LIB_SOURCES} +) + +target_sources( + ${LIB_NAME} + PUBLIC + FILE_SET libavoid_headers + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + TYPE HEADERS + FILES ${LIB_HEADERS} +) + +target_include_directories(${LIB_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set_target_properties( + ${LIB_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON +) + +target_compile_definitions(${LIB_NAME} + PUBLIC + ${COMMON_COMPILE_DEFINITIONS} +) + +target_link_options(${LIB_NAME} + PUBLIC + ${COMMON_LINK_OPTIONS} +) + +if(BUILD_TESTS) + add_subdirectory(tests) +endif() + +install( + TARGETS ${LIB_NAME} + FILE_SET libavoid_headers DESTINATION include/libavoid +) diff --git a/cola/libavoid/tests/CMakeLists.txt b/cola/libavoid/tests/CMakeLists.txt new file mode 100644 index 00000000..c2bcd4bb --- /dev/null +++ b/cola/libavoid/tests/CMakeLists.txt @@ -0,0 +1,124 @@ + +# libavoid tests + +function(add_avoid_test) + + set(options) + + set(oneValueArgs + NAME + ) + + set(multiValueArgs + SOURCES + ) + + cmake_parse_arguments(AVOID_TEST "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + add_executable(${AVOID_TEST_NAME} + ${AVOID_TEST_SOURCES} + ) + + target_include_directories(${AVOID_TEST_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + target_link_libraries(${AVOID_TEST_NAME} + PUBLIC + avoid + ) + + add_test(NAME ${AVOID_TEST_NAME} + COMMAND ${AVOID_TEST_NAME} + ) + +endfunction() + + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output) + + +add_avoid_test(NAME penaltyRerouting01 SOURCES penaltyRerouting01.cpp ) +add_avoid_test(NAME treeRootCrash01 SOURCES treeRootCrash01.cpp ) +add_avoid_test(NAME treeRootCrash02 SOURCES treeRootCrash02.cpp ) +add_avoid_test(NAME hyperedgeRerouting01 SOURCES hyperedgeRerouting01.cpp ) +add_avoid_test(NAME forwardFlowingConnectors01 SOURCES forwardFlowingConnectors01.cpp ) +add_avoid_test(NAME removeJunctions01 SOURCES removeJunctions01.cpp ) +add_avoid_test(NAME endlessLoop01 SOURCES endlessLoop01.cpp ) +add_avoid_test(NAME nudgingSkipsCheckpoint01 SOURCES nudgingSkipsCheckpoint01.cpp ) +add_avoid_test(NAME nudgingSkipsCheckpoint02 SOURCES nudgingSkipsCheckpoint02.cpp ) +add_avoid_test(NAME nudgeCrossing01 SOURCES nudgeCrossing01.cpp ) +add_avoid_test(NAME checkpointNudging1 SOURCES checkpointNudging1.cpp ) +add_avoid_test(NAME checkpointNudging2 SOURCES checkpointNudging2.cpp ) +add_avoid_test(NAME checkpointNudging3 SOURCES checkpointNudging3.cpp ) +add_avoid_test(NAME finalSegmentNudging1 SOURCES finalSegmentNudging1.cpp ) +add_avoid_test(NAME finalSegmentNudging2 SOURCES finalSegmentNudging2.cpp ) +add_avoid_test(NAME finalSegmentNudging3 SOURCES finalSegmentNudging3.cpp ) +add_avoid_test(NAME buildOrthogonalChannelInfo1 SOURCES buildOrthogonalChannelInfo1.cpp ) +add_avoid_test(NAME hyperedgeLoop1 SOURCES hyperedgeLoop1.cpp ) +add_avoid_test(NAME improveHyperedge01 SOURCES improveHyperedge01.cpp ) +add_avoid_test(NAME improveHyperedge02 SOURCES improveHyperedge02.cpp ) +add_avoid_test(NAME improveHyperedge03 SOURCES improveHyperedge03.cpp ) +add_avoid_test(NAME improveHyperedge04 SOURCES improveHyperedge04.cpp ) +add_avoid_test(NAME improveHyperedge05 SOURCES improveHyperedge05.cpp ) +add_avoid_test(NAME improveHyperedge06 SOURCES improveHyperedge06.cpp ) +add_avoid_test(NAME performance01 SOURCES performance01.cpp ) +add_avoid_test(NAME restrictedNudging SOURCES restrictedNudging.cpp ) +add_avoid_test(NAME freeFloatingDirection01 SOURCES freeFloatingDirection01.cpp ) +add_avoid_test(NAME checkpoints01 SOURCES checkpoints01.cpp ) +add_avoid_test(NAME checkpoints02 SOURCES checkpoints02.cpp ) +add_avoid_test(NAME checkpoints03 SOURCES checkpoints03.cpp ) +add_avoid_test(NAME inlineShapes SOURCES inlineShapes.cpp ) +add_avoid_test(NAME 2junctions SOURCES 2junctions.cpp ) +add_avoid_test(NAME overlappingRects SOURCES overlappingRects.cpp ) +add_avoid_test(NAME lineSegWrapperCrash1 SOURCES lineSegWrapperCrash1.cpp ) +add_avoid_test(NAME lineSegWrapperCrash2 SOURCES lineSegWrapperCrash2.cpp ) +add_avoid_test(NAME lineSegWrapperCrash3 SOURCES lineSegWrapperCrash3.cpp ) +add_avoid_test(NAME lineSegWrapperCrash4 SOURCES lineSegWrapperCrash4.cpp ) +add_avoid_test(NAME lineSegWrapperCrash5 SOURCES lineSegWrapperCrash5.cpp ) +add_avoid_test(NAME lineSegWrapperCrash6 SOURCES lineSegWrapperCrash6.cpp ) +add_avoid_test(NAME lineSegWrapperCrash7 SOURCES lineSegWrapperCrash7.cpp ) +add_avoid_test(NAME lineSegWrapperCrash8 SOURCES lineSegWrapperCrash8.cpp ) +add_avoid_test(NAME example SOURCES example.cpp ) +add_avoid_test(NAME validPaths01 SOURCES validPaths01.cpp ) +add_avoid_test(NAME validPaths02 SOURCES validPaths02.cpp ) +add_avoid_test(NAME multiconnact SOURCES multiconnact.cpp ) +add_avoid_test(NAME complex SOURCES complex.cpp ) +add_avoid_test(NAME inline SOURCES inline.cpp ) +add_avoid_test(NAME infinity SOURCES infinity.cpp ) +add_avoid_test(NAME latesetup SOURCES latesetup.cpp ) +add_avoid_test(NAME nudgeold SOURCES nudgeold.cpp ) +add_avoid_test(NAME node1 SOURCES node1.cpp ) +add_avoid_test(NAME vertlineassertion SOURCES vertlineassertion.cpp ) +add_avoid_test(NAME inlineoverlap01 SOURCES inlineoverlap01.cpp ) +add_avoid_test(NAME inlineoverlap02 SOURCES inlineoverlap02.cpp ) +add_avoid_test(NAME inlineoverlap03 SOURCES inlineoverlap03.cpp ) +add_avoid_test(NAME inlineoverlap04 SOURCES inlineoverlap04.cpp ) +add_avoid_test(NAME inlineoverlap05 SOURCES inlineoverlap05.cpp ) +add_avoid_test(NAME inlineoverlap06 SOURCES inlineoverlap06.cpp ) +add_avoid_test(NAME inlineoverlap07 SOURCES inlineoverlap07.cpp ) +add_avoid_test(NAME inlineoverlap08 SOURCES inlineoverlap08.cpp ) +add_avoid_test(NAME inlineOverlap09 SOURCES inlineOverlap09.cpp ) +add_avoid_test(NAME inlineOverlap10 SOURCES inlineOverlap10.cpp ) +add_avoid_test(NAME inlineOverlap11 SOURCES inlineOverlap11.cpp ) +add_avoid_test(NAME orthordering01 SOURCES orthordering01.cpp ) +add_avoid_test(NAME orthordering02 SOURCES orthordering02.cpp ) +add_avoid_test(NAME tjunct SOURCES tjunct.cpp ) +add_avoid_test(NAME hyperedge01 SOURCES hyperedge01.cpp ) +add_avoid_test(NAME hyperedge02 SOURCES hyperedge02.cpp ) +add_avoid_test(NAME nudgeintobug SOURCES nudgeintobug.cpp ) +add_avoid_test(NAME slowrouting SOURCES slowrouting.cpp ) +add_avoid_test(NAME orderassertion SOURCES orderassertion.cpp ) +add_avoid_test(NAME connendmove SOURCES connendmove.cpp ) +add_avoid_test(NAME connectionpin01 SOURCES connectionpin01.cpp ) +add_avoid_test(NAME connectionpin02 SOURCES connectionpin02.cpp ) +add_avoid_test(NAME connectionpin03 SOURCES connectionpin03.cpp ) +add_avoid_test(NAME junction01 SOURCES junction01.cpp ) +add_avoid_test(NAME junction02 SOURCES junction02.cpp ) +add_avoid_test(NAME junction03 SOURCES junction03.cpp ) +add_avoid_test(NAME junction04 SOURCES junction04.cpp ) + + diff --git a/cola/libcola/CMakeLists.txt b/cola/libcola/CMakeLists.txt new file mode 100644 index 00000000..5dc40438 --- /dev/null +++ b/cola/libcola/CMakeLists.txt @@ -0,0 +1,101 @@ +set(LIB_NAME cola) + +set(LIB_SOURCES + box.cpp + cc_clustercontainmentconstraints.cpp + cc_nonoverlapconstraints.cpp + cluster.cpp + cola.cpp + colafd.cpp + compound_constraints.cpp + conjugate_gradient.cpp + connected_components.cpp + convex_hull.cpp + gradient_projection.cpp + output_svg.cpp + pseudorandom.cpp + shapepair.cpp + straightener.cpp +) + +set(LIB_HEADERS + box.h + cc_clustercontainmentconstraints.h + cc_nonoverlapconstraints.h + cluster.h + cola_log.h + cola.h + commondefs.h + compound_constraints.h + conjugate_gradient.h + connected_components.h + convex_hull.h + exceptions.h + gradient_projection.h + output_svg.h + pseudorandom.h + shapepair.h + shortest_paths.h + sparse_matrix.h + straightener.h + unused.h +) + +add_library(${LIB_NAME} + ${LIB_SOURCES} +) + +target_sources( + ${LIB_NAME} + PUBLIC + FILE_SET libcola_headers + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + TYPE HEADERS + FILES ${LIB_HEADERS} +) + +target_include_directories(${LIB_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} + $<${HAVE_CAIROMM}:${CAIROMM_INCLUDE_DIRS}> +) + +set_target_properties( + ${LIB_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON +) + +target_compile_definitions(${LIB_NAME} + PUBLIC + ${COMMON_COMPILE_DEFINITIONS} +) + +target_link_options(${LIB_NAME} + PUBLIC + ${COMMON_LINK_OPTIONS} +) + +add_dependencies(${LIB_NAME} + vpsc +) + +target_link_directories(${LIB_NAME} + PUBLIC + $<${HAVE_CAIROMM}:${CAIROMM_LIBRARY_DIRS}> +) + +target_link_libraries(${LIB_NAME} + PUBLIC + $<${HAVE_CAIROMM}:${CAIROMM_LIBRARIES}> +) + +if(BUILD_TESTS) + add_subdirectory(tests) +endif() + +install( + TARGETS ${LIB_NAME} + FILE_SET libcola_headers DESTINATION include/libcola +) diff --git a/cola/libcola/config.h.cmake.in b/cola/libcola/config.h.cmake.in new file mode 100644 index 00000000..8f09ca35 --- /dev/null +++ b/cola/libcola/config.h.cmake.in @@ -0,0 +1,70 @@ +/* libcola/config.h. Generated from config.h.cmake.in by cmake. */ + +/* Enable CairoMM code */ +/* #undef HAVE_CAIROMM */ + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libcola" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libcola" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libcola 0.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libcola" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1" + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.1" + + + + diff --git a/cola/libcola/tests/CMakeLists.txt b/cola/libcola/tests/CMakeLists.txt new file mode 100644 index 00000000..9be798d3 --- /dev/null +++ b/cola/libcola/tests/CMakeLists.txt @@ -0,0 +1,82 @@ + +# libcola tests + +MESSAGE(STATUS "HAVE_CAIROMM: ${HAVE_CAIROMM}") +MESSAGE(STATUS "CAIROMM_INCLUDE_DIRS: ${CAIROMM_INCLUDE_DIRS}") +MESSAGE(STATUS "CAIROMM_LIBRARY_DIRS: ${CAIROMM_LIBRARY_DIRS}") +MESSAGE(STATUS "CAIROMM_LIBRARIES: ${CAIROMM_LIBRARIES}") + +function(add_cola_test) + + set(options) + + set(oneValueArgs + NAME + ) + + set(multiValueArgs + SOURCES + ) + + cmake_parse_arguments( + COLA_TEST + "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} + ) + + add_executable(${COLA_TEST_NAME} + ${COLA_TEST_SOURCES} + ) + + target_include_directories(${COLA_TEST_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} + $<${HAVE_CAIROMM}:${CAIROMM_INCLUDE_DIRS}> + ) + + target_link_directories(${COLA_TEST_NAME} + PUBLIC + $<${HAVE_CAIROMM}:${CAIROMM_LIBRARY_DIRS}> + ) + + target_link_libraries(${COLA_TEST_NAME} + PUBLIC + vpsc + topology + cola + avoid + $<${HAVE_CAIROMM}:${CAIROMM_LIBRARIES}> + ) + + add_test(NAME ${COLA_TEST_NAME} + COMMAND ${COLA_TEST_NAME} + ) + +endfunction() + + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output) + +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/data) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endif() + +add_cola_test(NAME initialOverlap SOURCES initialOverlap.cpp) +add_cola_test(NAME overlappingClusters01 SOURCES overlappingClusters01.cpp) +add_cola_test(NAME overlappingClusters02 SOURCES overlappingClusters02.cpp) +add_cola_test(NAME overlappingClusters04 SOURCES overlappingClusters04.cpp) +add_cola_test(NAME rectangularClusters01 SOURCES rectangularClusters01.cpp) +add_cola_test(NAME StillOverlap01 SOURCES StillOverlap01.cpp) +add_cola_test(NAME StillOverlap02 SOURCES StillOverlap02.cpp) +add_cola_test(NAME FixedRelativeConstraint01 SOURCES FixedRelativeConstraint01.cpp) +add_cola_test(NAME rectclustershapecontainment SOURCES rectclustershapecontainment.cpp) +add_cola_test(NAME random_graph SOURCES random_graph.cpp) +add_cola_test(NAME page_bounds SOURCES page_bounds.cpp) +add_cola_test(NAME constrained SOURCES constrained.cpp) +add_cola_test(NAME unsatisfiable SOURCES unsatisfiable.cpp) +add_cola_test(NAME invalid SOURCES invalid.cpp) +add_cola_test(NAME makefeasible SOURCES makefeasible02.cpp) +add_cola_test(NAME shortest_paths SOURCES shortest_paths.cpp) + diff --git a/cola/libdialect/CMakeLists.txt b/cola/libdialect/CMakeLists.txt new file mode 100644 index 00000000..3accc4fb --- /dev/null +++ b/cola/libdialect/CMakeLists.txt @@ -0,0 +1,104 @@ +set(LIB_NAME dialect) + +set(LIB_SOURCES + aca.cpp + bendseqlookup.cpp + chains.cpp + constraints.cpp + edges.cpp + expansion.cpp + faces.cpp + graphs.cpp + hola.cpp + io.cpp + logging.cpp + nearalign.cpp + nexes.cpp + nodeconfig.cpp + nodes.cpp + ortho.cpp + peeling.cpp + planarise.cpp + qalookup.cpp + quadaction.cpp + routing.cpp + sides.cpp + treeplacement.cpp + trees.cpp +) + +set(LIB_HEADERS + aca.h + chains.h + commontypes.h + constraints.h + expansion.h + faces.h + graphs.h + hola.h + io.h + libdialect.h + logging.h + nearalign.h + nodeconfig.h + opts.h + ortho.h + peeling.h + planarise.h + quadaction.h + routing.h + treeplacement.h + trees.h + util.h +) + +add_library(${LIB_NAME} + ${LIB_SOURCES} +) + +target_sources( + ${LIB_NAME} + PUBLIC + FILE_SET libdialect_headers + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + TYPE HEADERS + FILES ${LIB_HEADERS} +) + +target_include_directories(${LIB_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set_target_properties( + ${LIB_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON +) + +target_compile_definitions(${LIB_NAME} + PUBLIC + ${COMMON_COMPILE_DEFINITIONS} +) + +target_link_options(${LIB_NAME} + PUBLIC + ${COMMON_LINK_OPTIONS} +) + +add_dependencies(${LIB_NAME} + avoid + cola + vpsc +) + +if(BUILD_TESTS) + add_subdirectory(tests) +endif() + +install( + TARGETS ${LIB_NAME} + FILE_SET libdialect_headers DESTINATION include/libdialect +) + diff --git a/cola/libdialect/tests/CMakeLists.txt b/cola/libdialect/tests/CMakeLists.txt new file mode 100644 index 00000000..ea0a0707 --- /dev/null +++ b/cola/libdialect/tests/CMakeLists.txt @@ -0,0 +1,128 @@ + +# libdialect tests + +function(add_dialect_test) + + set(options) + + set(oneValueArgs + NAME + ) + + set(multiValueArgs + SOURCES + ) + + cmake_parse_arguments( + DIALECT_TEST + "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} + ) + + add_executable(${DIALECT_TEST_NAME} + ${DIALECT_TEST_SOURCES} + ) + + target_include_directories(${DIALECT_TEST_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + target_link_libraries(${DIALECT_TEST_NAME} + PUBLIC + dialect + vpsc + cola + avoid + ) + + add_test(NAME ${DIALECT_TEST_NAME} + COMMAND ${DIALECT_TEST_NAME} + ) + +endfunction() + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/svg) + +if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/graphs) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/graphs + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endif() + +add_dialect_test(NAME aca SOURCES aca.cpp) +add_dialect_test(NAME assignments SOURCES assignments.cpp) +add_dialect_test(NAME bbox SOURCES bbox.cpp) +add_dialect_test(NAME bendcosts SOURCES bendcosts.cpp) +add_dialect_test(NAME chainconfig01 SOURCES chainconfig01.cpp) +add_dialect_test(NAME chainconfig02 SOURCES chainconfig02.cpp) +add_dialect_test(NAME chainconfig03 SOURCES chainconfig03.cpp) +add_dialect_test(NAME chainsandcycles SOURCES chainsandcycles.cpp) +add_dialect_test(NAME cmplayout01 SOURCES cmplayout01.cpp) +add_dialect_test(NAME collateralexpand01 SOURCES collateralexpand01.cpp) +add_dialect_test(NAME collateralexpand02 SOURCES collateralexpand02.cpp) +add_dialect_test(NAME conncomps SOURCES conncomps.cpp) +add_dialect_test(NAME containedsegment01 SOURCES containedsegment01.cpp) +add_dialect_test(NAME destress SOURCES destress.cpp) +add_dialect_test(NAME destress02 SOURCES destress02.cpp) +add_dialect_test(NAME destress_aca SOURCES destress_aca.cpp) +add_dialect_test(NAME expand01 SOURCES expand01.cpp) +add_dialect_test(NAME expand02 SOURCES expand02.cpp) +add_dialect_test(NAME expand03 SOURCES expand03.cpp) +add_dialect_test(NAME expand04 SOURCES expand04.cpp) +add_dialect_test(NAME expand05 SOURCES expand05.cpp) +add_dialect_test(NAME expand06 SOURCES expand06.cpp) +add_dialect_test(NAME expand07 SOURCES expand07.cpp) +add_dialect_test(NAME expand08 SOURCES expand08.cpp) +add_dialect_test(NAME expand09 SOURCES expand09.cpp) +add_dialect_test(NAME extrabdrygap SOURCES extrabdrygap.cpp) +add_dialect_test(NAME faceset01 SOURCES faceset01.cpp) +add_dialect_test(NAME faceset02 SOURCES faceset02.cpp) +add_dialect_test(NAME hola10 SOURCES hola10.cpp) +add_dialect_test(NAME hola11 SOURCES hola11.cpp) +add_dialect_test(NAME hola12 SOURCES hola12.cpp) +add_dialect_test(NAME hola_arpa SOURCES hola_arpa.cpp) +add_dialect_test(NAME hola_garr SOURCES hola_garr.cpp) +add_dialect_test(NAME hola_slovakia SOURCES hola_slovakia.cpp) +add_dialect_test(NAME holalonenode SOURCES holalonenode.cpp) +add_dialect_test(NAME inserttrees01 SOURCES inserttrees01.cpp) +add_dialect_test(NAME leaflessroute01 SOURCES leaflessroute01.cpp) +add_dialect_test(NAME leaflessroute02 SOURCES leaflessroute02.cpp) +add_dialect_test(NAME lookupqas SOURCES lookupqas.cpp) +add_dialect_test(NAME nbroctal SOURCES nbroctal.cpp) +add_dialect_test(NAME nearalign01 SOURCES nearalign01.cpp) +add_dialect_test(NAME nearalign02 SOURCES nearalign02.cpp) +add_dialect_test(NAME nearby SOURCES nearby.cpp) +add_dialect_test(NAME negativesepco SOURCES negativesepco.cpp) +add_dialect_test(NAME negativezero SOURCES negativezero.cpp) +add_dialect_test(NAME nodeconfig01 SOURCES nodeconfig01.cpp) +add_dialect_test(NAME nudgeopt SOURCES nudgeopt.cpp) +add_dialect_test(NAME partition01 SOURCES partition01.cpp) +add_dialect_test(NAME peel SOURCES peel.cpp) +add_dialect_test(NAME planarise01 SOURCES planarise01.cpp) +add_dialect_test(NAME planarise02 SOURCES planarise02.cpp) +add_dialect_test(NAME projseq01 SOURCES projseq01.cpp) +add_dialect_test(NAME readconstraints SOURCES readconstraints.cpp) +add_dialect_test(NAME rotate01 SOURCES rotate01.cpp) +add_dialect_test(NAME rotate02 SOURCES rotate02.cpp) +add_dialect_test(NAME rotate03 SOURCES rotate03.cpp) +add_dialect_test(NAME rotate04 SOURCES rotate04.cpp) +add_dialect_test(NAME routing01 SOURCES routing01.cpp) +add_dialect_test(NAME sep_matrix_iter SOURCES sep_matrix_iter.cpp) +add_dialect_test(NAME solidify SOURCES solidify.cpp) +add_dialect_test(NAME symmtree SOURCES symmtree.cpp) +add_dialect_test(NAME tglf01 SOURCES tglf01.cpp) +add_dialect_test(NAME treeboxes01 SOURCES treeboxes01.cpp) +add_dialect_test(NAME treeplacement01 SOURCES treeplacement01.cpp) +add_dialect_test(NAME treeplacement02 SOURCES treeplacement02.cpp) +add_dialect_test(NAME treeplacement03 SOURCES treeplacement03.cpp) +add_dialect_test(NAME trees SOURCES trees.cpp) +add_dialect_test(NAME trees2 SOURCES trees2.cpp) +add_dialect_test(NAME vpsc01 SOURCES vpsc01.cpp) +add_dialect_test(NAME holasbgn01 SOURCES holasbgn01.cpp) +add_dialect_test(NAME holasbgn02 SOURCES holasbgn02.cpp) +add_dialect_test(NAME holametro01 SOURCES holametro01.cpp) +add_dialect_test(NAME holasbgn03 SOURCES holasbgn03.cpp) +add_dialect_test(NAME holasbgn04 SOURCES holasbgn04.cpp) +add_dialect_test(NAME holaRand SOURCES holaRand.cpp) + diff --git a/cola/libproject/CMakeLists.txt b/cola/libproject/CMakeLists.txt new file mode 100644 index 00000000..20dd2b90 --- /dev/null +++ b/cola/libproject/CMakeLists.txt @@ -0,0 +1,57 @@ +set(LIB_NAME project) + +set(LIB_SOURCES + project.cpp + util.cpp +) + +set(LIB_HEADERS + project_log.h + project.h + util.h + variable.h +) + +add_library(${LIB_NAME} + ${LIB_SOURCES} +) + +target_sources( + ${LIB_NAME} + PUBLIC + FILE_SET libproject_headers + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + TYPE HEADERS + FILES ${LIB_HEADERS} +) + +target_include_directories(${LIB_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set_target_properties( + ${LIB_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON +) + +target_compile_definitions(${LIB_NAME} + PUBLIC + ${COMMON_COMPILE_DEFINITIONS} +) + +target_link_options(${LIB_NAME} + PUBLIC + ${COMMON_LINK_OPTIONS} +) + +if(BUILD_TESTS) + add_subdirectory(tests) +endif() + +install( + TARGETS ${LIB_NAME} + FILE_SET libproject_headers DESTINATION include/libproject +) diff --git a/cola/libproject/tests/CMakeLists.txt b/cola/libproject/tests/CMakeLists.txt new file mode 100644 index 00000000..34ee2541 --- /dev/null +++ b/cola/libproject/tests/CMakeLists.txt @@ -0,0 +1,56 @@ + +# libproject tests + +function(add_project_test) + + set(options) + + set(oneValueArgs + NAME + ) + + set(multiValueArgs + SOURCES + ) + + cmake_parse_arguments( + PROJECT_TEST + "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} + ) + + add_executable(${PROJECT_TEST_NAME} + ${PROJECT_TEST_SOURCES} + ) + + target_include_directories(${PROJECT_TEST_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + target_link_libraries(${PROJECT_TEST_NAME} + PUBLIC + project + ) + + add_test(NAME ${PROJECT_TEST_NAME} + COMMAND ${PROJECT_TEST_NAME} + ) + +endfunction() + + +set(testutil_SOURCES testutil.cpp quadprogpp/QuadProg++.cc) + +add_project_test(NAME simple SOURCES simple.cpp) +add_project_test(NAME static SOURCES static.cpp ${testutil_SOURCES}) +add_project_test(NAME random SOURCES random.cpp ${testutil_SOURCES}) +add_project_test(NAME treeqptest SOURCES treeqptest.cpp treeqp.cpp ${testutil_SOURCES}) +add_project_test(NAME quadprogpptest + SOURCES + quadprogpp/main.cc + quadprogpp/QuadProg++.h + quadprogpp/QuadProg++.cc +) + diff --git a/cola/libtopology/CMakeLists.txt b/cola/libtopology/CMakeLists.txt new file mode 100644 index 00000000..d8218d6a --- /dev/null +++ b/cola/libtopology/CMakeLists.txt @@ -0,0 +1,70 @@ +set(LIB_NAME topology) + +set(LIB_SOURCES + cola_topology_addon.cpp + compute_forces.cpp + orthogonal_topology.cpp + resize.cpp + topology_constraints_constructor.cpp + topology_constraints.cpp + topology_graph.cpp +) + +set(LIB_HEADERS + cola_topology_addon.h + orthogonal_topology.h + topology_constraints.h + topology_graph.h + topology_log.h + util.h +) + +add_library(${LIB_NAME} + ${LIB_SOURCES} +) + +target_sources( + ${LIB_NAME} + PUBLIC + FILE_SET libtopology_headers + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + TYPE HEADERS + FILES ${LIB_HEADERS} +) + +target_include_directories(${LIB_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set_target_properties( + ${LIB_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON +) + +target_compile_definitions(${LIB_NAME} + PUBLIC + ${COMMON_COMPILE_DEFINITIONS} +) + +target_link_options(${LIB_NAME} + PUBLIC + ${COMMON_LINK_OPTIONS} +) + +add_dependencies(${LIB_NAME} + avoid + cola + vpsc +) + +if(BUILD_TESTS) + add_subdirectory(tests) +endif() + +install( + TARGETS ${LIB_NAME} + FILE_SET libtopology_headers DESTINATION include/libtopology +) diff --git a/cola/libtopology/tests/CMakeLists.txt b/cola/libtopology/tests/CMakeLists.txt new file mode 100644 index 00000000..1a64be13 --- /dev/null +++ b/cola/libtopology/tests/CMakeLists.txt @@ -0,0 +1,61 @@ + +# libtopology tests + +function(add_topology_test) + + set(options) + + set(oneValueArgs + NAME + ) + + set(multiValueArgs + SOURCES + ) + + cmake_parse_arguments( + TOPOLOGY_TEST + "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} + ) + + add_executable(${TOPOLOGY_TEST_NAME} + ${TOPOLOGY_TEST_SOURCES} + ) + + target_include_directories(${TOPOLOGY_TEST_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} + $<${HAVE_CAIROMM}:${CAIROMM_INCLUDE_DIRS}> + ) + + target_link_directories(${TOPOLOGY_TEST_NAME} + PUBLIC + $<${HAVE_CAIROMM}:${CAIROMM_LIBRARY_DIRS}> + ) + + target_link_libraries(${TOPOLOGY_TEST_NAME} + PUBLIC + topology + cola + vpsc + avoid + $<${HAVE_CAIROMM}:${CAIROMM_LIBRARIES}> + ) + + add_test(NAME ${TOPOLOGY_TEST_NAME} + COMMAND ${TOPOLOGY_TEST_NAME} + ) + +endfunction() + + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output) + + +add_topology_test(NAME simple_bend SOURCES simple_bend.cpp) +add_topology_test(NAME nooverlap SOURCES nooverlap.cpp) +add_topology_test(NAME nodedragging SOURCES nodedragging.cpp) +add_topology_test(NAME beautify SOURCES beautify.cpp) +add_topology_test(NAME orthogonalOpt SOURCES orthogonalOpt.cpp) diff --git a/cola/libvpsc/CMakeLists.txt b/cola/libvpsc/CMakeLists.txt new file mode 100644 index 00000000..350daa85 --- /dev/null +++ b/cola/libvpsc/CMakeLists.txt @@ -0,0 +1,69 @@ +set(LIB_NAME vpsc) + +set(LIB_SOURCES + block.cpp + blocks.cpp + cbuffer.cpp + constraint.cpp + rectangle.cpp + solve_VPSC.cpp + variable.cpp +) + +set(LIB_HEADERS + assertions.h + block.h + blocks.h + cbuffer.h + constraint.h + exceptions.h + linesegment.h + pairing_heap.h + rectangle.h + solve_VPSC.h + variable.h +) + +add_library(${LIB_NAME} + ${LIB_SOURCES} +) + +target_sources( + ${LIB_NAME} + PUBLIC + FILE_SET libvpsc_headers + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} + TYPE HEADERS + FILES ${LIB_HEADERS} +) + +target_include_directories(${LIB_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set_target_properties( + ${LIB_NAME} + PROPERTIES + POSITION_INDEPENDENT_CODE ON +) + +target_compile_definitions(${LIB_NAME} + PUBLIC + ${COMMON_COMPILE_DEFINITIONS} +) + +target_link_options(${LIB_NAME} + PUBLIC + ${COMMON_LINK_OPTIONS} +) + +if(BUILD_TESTS) + add_subdirectory(tests) +endif() + +install( + TARGETS ${LIB_NAME} + FILE_SET libvpsc_headers DESTINATION include/libvpsc +) diff --git a/cola/libvpsc/tests/CMakeLists.txt b/cola/libvpsc/tests/CMakeLists.txt new file mode 100644 index 00000000..09238dcc --- /dev/null +++ b/cola/libvpsc/tests/CMakeLists.txt @@ -0,0 +1,47 @@ + +# libvpsc tests + +function(add_vpsc_test) + + set(options) + + set(oneValueArgs + NAME + ) + + set(multiValueArgs + SOURCES + ) + + cmake_parse_arguments( + VPSC_TEST + "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} + ) + + add_executable(${VPSC_TEST_NAME} + ${VPSC_TEST_SOURCES} + ) + + target_include_directories(${VPSC_TEST_NAME} + PUBLIC + ${CMAKE_SOURCE_DIR}/cola + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + target_link_libraries(${VPSC_TEST_NAME} + PUBLIC + vpsc + ) + + add_test(NAME ${VPSC_TEST_NAME} + COMMAND ${VPSC_TEST_NAME} + ) + +endfunction() + +add_vpsc_test(NAME satisfy_inc SOURCES satisfy_inc.cpp) +add_vpsc_test(NAME block SOURCES block.cpp) +add_vpsc_test(NAME rectangleoverlap SOURCES rectangleoverlap.cpp) + + diff --git a/cola/swig-python3-setup.py b/cola/swig-python3-setup.py index c3dfc6d2..5506116b 100644 --- a/cola/swig-python3-setup.py +++ b/cola/swig-python3-setup.py @@ -4,27 +4,29 @@ setup.py file for SWIG example """ -from distutils.core import setup, Extension +from setuptools import setup, Extension # distutils are marked deprecated and will be removed from Python 3.13 and beyond # install setuptools # from setuptools import setup, Extension -adaptagrams_module = Extension('_adaptagrams', - sources=['adaptagrams_wrap.cxx'], - # extra_compile_args=['-DUSE_ASSERT_EXCEPTIONS','-DSWIG_PYTHON_SILENT_MEMLEAK','-std=gnu++11','-stdlib=libc++'], - extra_compile_args=['-DUSE_ASSERT_EXCEPTIONS','-DSWIG_PYTHON_SILENT_MEMLEAK','-std=c++11'], - include_dirs=['.'], - extra_link_args=['libcola/.libs/libcola.a','libtopology/.libs/libtopology.a', 'libavoid/.libs/libavoid.a','libvpsc/.libs/libvpsc.a','libdialect/.libs/libdialect.a'], - # use this line on MacOS with older versions of the developer tools to avoid linker warning - # '-undefined dynamic_lookup may not work with chained fixups' - # see https://github.com/pybind/pybind11/pull/4301 - # extra_link_args=['-Wl,-no_fixup_chains','libcola/.libs/libcola.a','libtopology/.libs/libtopology.a', 'libavoid/.libs/libavoid.a','libvpsc/.libs/libvpsc.a','libdialect/.libs/libdialect.a'], - ) +adaptagrams_module = Extension( + '_adaptagrams', + sources=['adaptagrams_wrap.cxx'], + # extra_compile_args=['-DUSE_ASSERT_EXCEPTIONS','-DSWIG_PYTHON_SILENT_MEMLEAK','-std=gnu++11','-stdlib=libc++'], + extra_compile_args=['-DUSE_ASSERT_EXCEPTIONS','-DSWIG_PYTHON_SILENT_MEMLEAK','-std=c++11'], + include_dirs=['.'], + extra_link_args=['libcola/.libs/libcola.a','libtopology/.libs/libtopology.a', 'libavoid/.libs/libavoid.a','libvpsc/.libs/libvpsc.a','libdialect/.libs/libdialect.a'], + # use this line on MacOS with older versions of the developer tools to avoid linker warning + # '-undefined dynamic_lookup may not work with chained fixups' + # see https://github.com/pybind/pybind11/pull/4301 + # extra_link_args=['-Wl,-no_fixup_chains','libcola/.libs/libcola.a','libtopology/.libs/libtopology.a', 'libavoid/.libs/libavoid.a','libvpsc/.libs/libvpsc.a','libdialect/.libs/libdialect.a'], +) -setup (name = 'adaptagrams', - version = '0.1', - author = "MArVL", - description = """Adaptagrams libraries""", - ext_modules = [adaptagrams_module], - py_modules = ["adaptagrams"], - ) +setup ( + name = 'adaptagrams', + version = '0.1', + author = "MArVL", + description = """Adaptagrams libraries""", + ext_modules = [adaptagrams_module], + py_modules = ["adaptagrams"], +) diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 00000000..74d15f86 --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,8 @@ +[requires] +cairomm/1.18.0 +[generators] +CMakeDeps +CMakeToolchain +[layout] +cmake_layout + diff --git a/experimental/solve_VPSC/.Makefile.am.swp b/experimental/solve_VPSC/.Makefile.am.swp deleted file mode 100644 index 3f3329ed..00000000 Binary files a/experimental/solve_VPSC/.Makefile.am.swp and /dev/null differ diff --git a/experimental/solve_VPSC/.test_rectangleoverlap.cpp.swp b/experimental/solve_VPSC/.test_rectangleoverlap.cpp.swp deleted file mode 100644 index 23bc7f0b..00000000 Binary files a/experimental/solve_VPSC/.test_rectangleoverlap.cpp.swp and /dev/null differ