diff --git a/.travis.yml b/.travis.yml index 9d8f611..993b58a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,10 +27,15 @@ before_install: script: - qmake -v - cd ./build - - if [ $USING_CMAKE -eq 1 ]; then cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt; else qmake -o Makefile ipc.pro QMAKE_CC=$CC QMAKE_CXX=$CXX QMAKE_LINK=$CXX; fi - - qmake -o MakefileTest test.pro QMAKE_CC=$CC QMAKE_CXX=$CXX QMAKE_LINK=$CXX - - make - - make -f MakefileTest + - if [ $USING_CMAKE -eq 1 ]; then + cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt + make + else + qmake -o Makefile ipc.pro QMAKE_CC=$CC QMAKE_CXX=$CXX QMAKE_LINK=$CXX + qmake -o MakefileTest test.pro QMAKE_CC=$CC QMAKE_CXX=$CXX QMAKE_LINK=$CXX + make + make -f MakefileTest + fi - export LD_LIBRARY_PATH=../output:$LD_LIBRARY_PATH && ../output/test notifications: diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index a7ab401..4df2f3f 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -1,23 +1,3 @@ cmake_minimum_required(VERSION 3.10) -project(ipc) - -add_compile_definitions(__IPC_LIBRARY__) -if(MSVC) - add_compile_options("/std:c++17") -else() - add_compile_options("-std=gnu++1z") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") -endif() - -include_directories("../include") -include_directories("../src") - -if(UNIX) - file(GLOB DIR_SRCS ../src/platform/*_linux.cpp) -else() - file(GLOB DIR_SRCS ../src/platform/*_win.cpp) -endif() -aux_source_directory(../src DIR_SRCS) - -add_library(ipc SHARED ${DIR_SRCS}) -set(LIBRARY_OUTPUT_PATH ../output) \ No newline at end of file +project(cpp-ipc) +add_subdirectory(test) \ No newline at end of file diff --git a/build/ipc/CMakeLists.txt b/build/ipc/CMakeLists.txt new file mode 100644 index 0000000..b01dfe8 --- /dev/null +++ b/build/ipc/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.10) +project(ipc) + +add_compile_definitions(__IPC_LIBRARY__) +if(MSVC) + add_compile_options(/std:c++17) +else() + add_compile_options(-std=gnu++1z) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") +endif() + +include_directories(../../include ../../src) + +if(UNIX) + file(GLOB DIR_SRCS ../../src/platform/*_linux.cpp) +else() + file(GLOB DIR_SRCS ../../src/platform/*_win.cpp) +endif() +aux_source_directory(../../src DIR_SRCS) + +add_library(ipc SHARED ${DIR_SRCS}) +set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../output) \ No newline at end of file diff --git a/build/test/CMakeLists.txt b/build/test/CMakeLists.txt new file mode 100644 index 0000000..7bf9e8a --- /dev/null +++ b/build/test/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.10) +project(test) + +set(CMAKE_AUTOMOC ON) +find_package(Qt5Core) +find_package(Qt5Test) + +if(MSVC) + add_compile_options(/std:c++17) +else() + add_compile_options(-std=gnu++1z -Wno-unused-function -Wno-attributes) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") +endif() + +include_directories(../../include ../../src ../../test ../../test/capo) +file(GLOB SRC_FILES "../../test/*.cpp") +file(GLOB HEAD_FILES "../../test/*.h") +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/../output) + +link_directories(${EXECUTABLE_OUTPUT_PATH}) +add_subdirectory(../ipc ipc.out) + +add_executable(${PROJECT_NAME} ${SRC_FILES} ${HEAD_FILES}) +target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Test ipc) \ No newline at end of file