Skip to content

Commit

Permalink
CMake build support refs #10
Browse files Browse the repository at this point in the history
  • Loading branch information
gamecreature committed May 23, 2017
2 parents 2710e99 + c999ee1 commit 1ff047e
Show file tree
Hide file tree
Showing 10 changed files with 441 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ Makefile

edbee-lib-doxydocs

# cmake ignores
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ addons:
compiler:
- gcc
- clang
env:
matrix:
- Q_OR_C_MAKE=cmake
- Q_OR_C_MAKE=qmake
matrix:
exclude:
- os: osx
Expand All @@ -32,8 +36,8 @@ before_script:
- mkdir build
script:
- cd build
- if [ "${CC}" = "clang" ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then SPEC="-spec linux-clang"; fi
- qmake ${SPEC} ../edbee-lib.pro && make -j2
- if [ "${CC}" = "clang" ] && [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${Q_OR_C_MAKE}" = "qmake" ] ; then SPEC="-spec linux-clang"; fi
- if [ "${Q_OR_C_MAKE}" = "qmake" ]; then qmake -v; qmake ../edbee-lib.pro && make -j2; else cmake --version; cmake .. && make -j2; fi
- cd edbee-test
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then cd edbee-test.app/Contents/MacOS/; fi
- if [ "${TRAVIS_OS_NAME}" = "osx" ] && [ "${Q_OR_C_MAKE}" = "qmake" ]; then cd edbee-test.app/Contents/MacOS/; fi
- ./edbee-test
2 changes: 1 addition & 1 deletion CI/travis.osx.install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -ev
BREWS="qt5"
BREWS="qt5 cmake"
for i in $BREWS; do
brew outdated | grep -q $i && brew upgrade $i
done
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Should be called before PROJECT.
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)

PROJECT(edbee)

ADD_SUBDIRECTORY(edbee-lib)
ADD_SUBDIRECTORY(edbee-test)

205 changes: 205 additions & 0 deletions edbee-lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Should be called before PROJECT.
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)

IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()

PROJECT(edbee-lib)

SET(SOURCES
edbee/util/mem/debug_new.cpp
edbee/util/mem/debug_allocs.cpp
edbee/util/simpleprofiler.cpp
edbee/util/textcodecdetector.cpp
edbee/util/lineending.cpp
edbee/texteditorwidget.cpp
edbee/views/textrenderer.cpp
edbee/models/textdocument.cpp
edbee/models/chardocument/chartextdocument.cpp
edbee/models/texteditorconfig.cpp
edbee/models/texteditorkeymap.cpp
edbee/models/textundostack.cpp
edbee/views/textcaretcache.cpp
edbee/models/textlexer.cpp
edbee/models/textrange.cpp
edbee/views/textselection.cpp
edbee/models/textdocumentscopes.cpp
edbee/lexers/grammartextlexer.cpp
edbee/util/gapvector.h
edbee/util/lineoffsetvector.cpp
edbee/models/textlinedata.cpp
edbee/models/textbuffer.cpp
edbee/models/chardocument/chartextbuffer.cpp
edbee/texteditorcontroller.cpp
edbee/texteditorcommand.cpp
edbee/commands/selectioncommand.cpp
edbee/commands/undocommand.cpp
edbee/commands/redocommand.cpp
edbee/commands/replaceselectioncommand.cpp
edbee/commands/copycommand.cpp
edbee/commands/cutcommand.cpp
edbee/commands/pastecommand.cpp
edbee/io/textdocumentserializer.cpp
edbee/util/test.cpp
edbee/util/textcodec.cpp
edbee/io/tmlanguageparser.cpp
edbee/commands/debugcommand.cpp
edbee/util/regexp.cpp
edbee/io/tmthemeparser.cpp
edbee/io/baseplistparser.cpp
edbee/io/jsonparser.cpp
edbee/models/textgrammar.cpp
edbee/models/texteditorcommandmap.cpp
edbee/views/components/texteditorcomponent.cpp
edbee/views/components/texteditorrenderer.cpp
edbee/views/components/textmargincomponent.cpp
edbee/views/texttheme.cpp
edbee/views/texteditorscrollarea.cpp
edbee/models/textsearcher.cpp
edbee/commands/findcommand.cpp
edbee/io/keymapparser.cpp
edbee/commands/tabcommand.cpp
edbee/edbee.cpp
edbee/models/textdocumentfilter.cpp
edbee/util/cascadingqvariantmap.cpp
edbee/commands/duplicatecommand.cpp
edbee/commands/newlinecommand.cpp
edbee/util/util.cpp
edbee/commands/removecommand.cpp
edbee/models/change.cpp
edbee/models/changes/abstractrangedchange.cpp
edbee/models/changes/linedatalistchange.cpp
edbee/models/changes/linedatachange.cpp
edbee/models/changes/selectionchange.cpp
edbee/models/changes/textchange.cpp
edbee/models/changes/textchangewithcaret.cpp
edbee/models/changes/mergablechangegroup.cpp
edbee/commands/commentcommand.cpp
edbee/util/rangesetlineiterator.cpp
edbee/models/dynamicvariables.cpp
edbee/util/rangelineiterator.cpp
edbee/data/factorykeymap.cpp
edbee/data/factorycommandmap.cpp
)

SET(HEADERS
edbee/util/logging.h
edbee/util/mem/debug_new.h
edbee/util/mem/debug_allocs.h
edbee/util/simpleprofiler.h
edbee/util/textcodecdetector.h
edbee/util/lineending.h
edbee/texteditorwidget.h
edbee/views/textrenderer.h
edbee/models/textdocument.h
edbee/models/chardocument/chartextdocument.h
edbee/models/texteditorconfig.h
edbee/models/texteditorkeymap.h
edbee/models/textundostack.h
edbee/texteditorcontroller.h
edbee/views/textcaretcache.h
edbee/models/textlexer.h
edbee/models/textrange.h
edbee/views/textselection.h
edbee/models/textdocumentscopes.h
edbee/lexers/grammartextlexer.h
edbee/util/lineoffsetvector.h
edbee/models/textlinedata.h
edbee/models/textbuffer.h
edbee/models/chardocument/chartextbuffer.h
edbee/texteditorcommand.h
edbee/commands/selectioncommand.h
edbee/commands/undocommand.h
edbee/commands/redocommand.h
edbee/commands/replaceselectioncommand.h
edbee/commands/copycommand.h
edbee/commands/cutcommand.h
edbee/commands/pastecommand.h
edbee/models/textdocumentfilter.h
edbee/debug.h
edbee/io/textdocumentserializer.h
edbee/util/test.h
edbee/util/textcodec.h
edbee/io/tmlanguageparser.h
edbee/commands/debugcommand.h
edbee/util/regexp.h
edbee/io/tmthemeparser.h
edbee/io/baseplistparser.h
edbee/io/jsonparser.h
edbee/models/textgrammar.h
edbee/models/texteditorcommandmap.h
edbee/views/components/texteditorcomponent.h
edbee/views/components/texteditorrenderer.h
edbee/views/components/textmargincomponent.h
edbee/views/texttheme.h
edbee/views/texteditorscrollarea.h
edbee/models/textsearcher.h
edbee/commands/findcommand.h
edbee/io/keymapparser.h
edbee/commands/tabcommand.h
edbee/edbee.h
edbee/util/cascadingqvariantmap.h
edbee/commands/duplicatecommand.h
edbee/commands/newlinecommand.h
edbee/util/util.h
edbee/commands/removecommand.h
edbee/models/change.h
edbee/models/changes/abstractrangedchange.h
edbee/models/changes/linedatalistchange.h
edbee/models/changes/linedatachange.h
edbee/models/changes/selectionchange.h
edbee/models/changes/textchange.h
edbee/models/changes/textchangewithcaret.h
edbee/models/changes/mergablechangegroup.h
edbee/commands/commentcommand.h
edbee/util/rangesetlineiterator.h
edbee/models/dynamicvariables.h
edbee/util/rangelineiterator.h
edbee/data/factorykeymap.h
edbee/data/factorycommandmap.h
)

FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Qt5UiTools REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)

IF(Qt5_POSITION_INDEPENDENT_CODE)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
ENDIF()

set(CMAKE_AUTOMOC ON)

add_subdirectory(../vendor/qslog/ qslog)
add_subdirectory(../vendor/onig/ onig)

ADD_DEFINITIONS(
${Qt5Core_DEFINITIONS}
${Qt5UiTools_DEFINTIONS}
${Qt5Widgets_DEFINTIONS}
)


SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(
${Qt5Core_INCLUDE_DIRS}
${Qt5UiTools_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${QS_LOG_INCLUDE_DIRS}
${ONIG_INCLUDE_DIRS}
)

ADD_LIBRARY(edbee-lib STATIC
${SOURCES} ${HEADERS} ${QS_LOG_SOURCES} ${QS_LOG_HEADERS} ${ONIG_SOURCES}
${ONIG_HEADERS})

TARGET_INCLUDE_DIRECTORIES(edbee-lib PUBLIC
${Qt5Core_INCLUDE_DIRS}
${Qt5UiTools_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${QS_LOG_INCLUDE_DIRS}
${ONIG_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
)

SET_PROPERTY(TARGET edbee-lib PROPERTY CXX_STANDARD 11)
8 changes: 6 additions & 2 deletions edbee-lib/edbee/util/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
// MACROS
//=============================================================================

#define DECLARE_TEST(className) static edbee::test::Test<className> t(#className)
#define DECLARE_NAMED_TEST(name,className) static edbee::test::Test<className> name(#className)
#define TEST_CONCATENATE_DETAIL(x, y) x##y
#define TEST_CONCATENATE(x, y) TEST_CONCATENATE_DETAIL(x, y)
#define TEST_MAKE_UNIQUE(x) TEST_CONCATENATE(x, __COUNTER__)

#define DECLARE_TEST(className) static edbee::test::Test<className> TEST_MAKE_UNIQUE(t)(#className)
#define DECLARE_NAMED_TEST(name,className) static edbee::test::Test<className> TEST_MAKE_UNIQUE(name)(#className)


namespace edbee { namespace test {
Expand Down
99 changes: 99 additions & 0 deletions edbee-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Should be called before PROJECT.
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)

IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()

PROJECT(edbee-test)

SET(SOURCES
edbee/commands/replaceselectioncommandtest.cpp
edbee/models/textrangetest.cpp
edbee/models/textdocumenttest.cpp
edbee/models/textbuffertest.cpp
edbee/models/textlinedatatest.cpp
edbee/util/gapvectortest.cpp
edbee/util/lineoffsetvectortest.cpp
main.cpp
edbee/util/lineendingtest.cpp
edbee/textdocumentserializertest.cpp
edbee/io/tmlanguageparsertest.cpp
edbee/util/regexptest.cpp
edbee/models/textdocumentscopestest.cpp
edbee/models/textundostacktest.cpp
edbee/util/cascadingqvariantmaptest.cpp
edbee/models/textsearchertest.cpp
edbee/commands/duplicatecommandtest.cpp
edbee/commands/newlinecommandtest.cpp
edbee/util/utiltest.cpp
edbee/lexers/grammartextlexertest.cpp
edbee/commands/removecommandtest.cpp
edbee/models/changes/linedatalistchangetest.cpp
edbee/models/changes/textchangetest.cpp
edbee/models/changes/mergablechangegrouptest.cpp
edbee/util/rangesetlineiteratortest.cpp
edbee/models/dynamicvariablestest.cpp
edbee/util/rangelineiteratortest.cpp
)

SET(HEADERS
edbee/commands/replaceselectioncommandtest.h
edbee/models/textrangetest.h
edbee/models/textdocumenttest.h
edbee/models/textbuffertest.h
edbee/models/textlinedatatest.h
edbee/util/gapvectortest.h
edbee/util/lineoffsetvectortest.h
edbee/util/lineendingtest.h
edbee/textdocumentserializertest.h
edbee/io/tmlanguageparsertest.h
edbee/util/regexptest.h
edbee/models/textdocumentscopestest.h
edbee/models/textundostacktest.h
edbee/util/cascadingqvariantmaptest.h
edbee/models/textsearchertest.h
edbee/commands/duplicatecommandtest.h
edbee/commands/newlinecommandtest.h
edbee/util/utiltest.h
edbee/lexers/grammartextlexertest.h
edbee/commands/removecommandtest.h
edbee/models/changes/linedatalistchangetest.h
edbee/models/changes/textchangetest.h
edbee/models/changes/mergablechangegrouptest.h
edbee/util/rangesetlineiteratortest.h
edbee/models/dynamicvariablestest.h
edbee/util/rangelineiteratortest.h
)

FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Qt5UiTools REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)

add_subdirectory(../vendor/qslog/ qslog)

ADD_DEFINITIONS(
${Qt5Core_DEFINITIONS}
${Qt5UiTools_DEFINTIONS}
${Qt5Widgets_DEFINTIONS}
)

SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(
${Qt5Core_INCLUDE_DIRS}
${Qt5UiTools_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
../edbee-lib/
${QS_LOG_INCLUDE_DIRS}
)

set(CMAKE_AUTOMOC ON)

ADD_EXECUTABLE(edbee-test
${SOURCES} ${HEADERS} ${QS_LOG_SOURCES} ${QS_LOG_HEADERS}
)

TARGET_LINK_LIBRARIES(edbee-test edbee-lib ${Qt5Core_LIBRARIES}
${Qt5Widgets_LIBRARIES} ${Qt5UiTools_LIBRARIES})

SET_PROPERTY(TARGET edbee-test PROPERTY CXX_STANDARD 11)
2 changes: 2 additions & 0 deletions edbee-test/edbee/commands/replaceselectioncommandtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Author Rick Blommers
*/

#pragma once

#include "edbee/util/test.h"

namespace edbee {
Expand Down
Loading

0 comments on commit 1ff047e

Please sign in to comment.