From 5a2ff6d27981289760b7d32cb458f5300758a9c8 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Fri, 24 Nov 2017 13:10:45 +0900 Subject: [PATCH] Add add_dependencies Command to CMake for OSX (#1587) * fix cmake for osx * try using make -j 2 for osx travis * obtain qt5.9.2 from the previous homebrew --- ci-scripts/osx/travis-build.sh | 2 +- ci-scripts/osx/travis-install.sh | 7 +++++-- toonz/sources/colorfx/CMakeLists.txt | 1 + toonz/sources/image/CMakeLists.txt | 1 + toonz/sources/sound/CMakeLists.txt | 1 + toonz/sources/stdfx/CMakeLists.txt | 1 + toonz/sources/tnzbase/CMakeLists.txt | 1 + toonz/sources/tnzext/CMakeLists.txt | 1 + toonz/sources/tnztools/CMakeLists.txt | 1 + toonz/sources/toonz/CMakeLists.txt | 1 + toonz/sources/toonzfarm/tfarm/CMakeLists.txt | 2 +- toonz/sources/toonzlib/CMakeLists.txt | 1 + toonz/sources/toonzqt/CMakeLists.txt | 1 + 13 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ci-scripts/osx/travis-build.sh b/ci-scripts/osx/travis-build.sh index a9137dda..9b956fe0 100644 --- a/ci-scripts/osx/travis-build.sh +++ b/ci-scripts/osx/travis-build.sh @@ -7,4 +7,4 @@ cmake ../sources \ -DQT_PATH=/usr/local/Cellar/qt/5.9.2/lib/ \ -DTIFF_INCLUDE_DIR=../../thirdparty/tiff-4.0.3/libtiff/ \ -DSUPERLU_INCLUDE_DIR=../../thirdparty/superlu/SuperLU_4.1/include/ -make +make -j 2 diff --git a/ci-scripts/osx/travis-install.sh b/ci-scripts/osx/travis-install.sh index b8d99f1a..06728024 100755 --- a/ci-scripts/osx/travis-install.sh +++ b/ci-scripts/osx/travis-install.sh @@ -1,5 +1,8 @@ #!/bin/bash brew update -brew install glew lz4 lzo libusb libmypaint qt +brew install glew lz4 lzo libusb libmypaint brew tap tcr/tcr -brew install clang-format \ No newline at end of file +brew install clang-format +# obtain qt5.9.2 from the previous version of the formula +curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/9bc1bdd8d26747cffd7a18c31975f86cd0a97bc3/Formula/qt.rb +brew install ./qt.rb \ No newline at end of file diff --git a/toonz/sources/colorfx/CMakeLists.txt b/toonz/sources/colorfx/CMakeLists.txt index 6029b6a0..17cf53c1 100644 --- a/toonz/sources/colorfx/CMakeLists.txt +++ b/toonz/sources/colorfx/CMakeLists.txt @@ -27,6 +27,7 @@ add_definitions( if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libcolorfx.dylib") + add_dependencies(colorfx tnzcore tnzbase) endif() message("subdir: colorfx") diff --git a/toonz/sources/image/CMakeLists.txt b/toonz/sources/image/CMakeLists.txt index 271131bb..b5303ddb 100644 --- a/toonz/sources/image/CMakeLists.txt +++ b/toonz/sources/image/CMakeLists.txt @@ -100,6 +100,7 @@ add_definitions( if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libimage.dylib") + add_dependencies(image tnzcore tnzbase toonzlib) endif() message("subdir: image") diff --git a/toonz/sources/sound/CMakeLists.txt b/toonz/sources/sound/CMakeLists.txt index f3caaece..92019123 100644 --- a/toonz/sources/sound/CMakeLists.txt +++ b/toonz/sources/sound/CMakeLists.txt @@ -23,6 +23,7 @@ add_definitions( if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libsound.dylib") + add_dependencies(sound tnzcore tnzbase toonzlib) endif() message("subdir: sound") diff --git a/toonz/sources/stdfx/CMakeLists.txt b/toonz/sources/stdfx/CMakeLists.txt index 9367326e..26880bae 100644 --- a/toonz/sources/stdfx/CMakeLists.txt +++ b/toonz/sources/stdfx/CMakeLists.txt @@ -267,6 +267,7 @@ add_definitions( if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnzstdfx.dylib") + add_dependencies(tnzstdfx tnzcore tnzbase toonzlib) endif() message("subdir: tnzstdfx") diff --git a/toonz/sources/tnzbase/CMakeLists.txt b/toonz/sources/tnzbase/CMakeLists.txt index f31e898a..3df02f33 100644 --- a/toonz/sources/tnzbase/CMakeLists.txt +++ b/toonz/sources/tnzbase/CMakeLists.txt @@ -166,6 +166,7 @@ add_library(tnzbase SHARED ${HEADERS} ${SOURCES} ${OBJCSOURCES}) if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnzbase.dylib") + add_dependencies(tnzbase tnzcore) endif() add_definitions( diff --git a/toonz/sources/tnzext/CMakeLists.txt b/toonz/sources/tnzext/CMakeLists.txt index 2d85a091..f44761d9 100644 --- a/toonz/sources/tnzext/CMakeLists.txt +++ b/toonz/sources/tnzext/CMakeLists.txt @@ -81,6 +81,7 @@ add_library(tnzext SHARED ${HEADERS} ${SOURCES} ${OBJCSOURCES}) if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnzext.dylib") + add_dependencies(tnzext tnzcore tnzbase) endif() add_definitions( diff --git a/toonz/sources/tnztools/CMakeLists.txt b/toonz/sources/tnztools/CMakeLists.txt index 172a11ad..75ca52f5 100644 --- a/toonz/sources/tnztools/CMakeLists.txt +++ b/toonz/sources/tnztools/CMakeLists.txt @@ -111,6 +111,7 @@ add_definitions( if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtnztools.dylib") + add_dependencies(tnztools tnzcore tnzbase tnzext toonzlib toonzqt) endif() message("subdir: tnztools") diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt index a2bff76b..31d408d8 100644 --- a/toonz/sources/toonz/CMakeLists.txt +++ b/toonz/sources/toonz/CMakeLists.txt @@ -416,6 +416,7 @@ elseif(BUILD_ENV_APPLE) # 変なところにライブラリ生成するカスども set(EXTRA_LIBS ${EXTRA_LIBS} "$" "$") + add_dependencies(OpenToonz_${VERSION} tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm) target_link_libraries(OpenToonz_${VERSION} Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml diff --git a/toonz/sources/toonzfarm/tfarm/CMakeLists.txt b/toonz/sources/toonzfarm/tfarm/CMakeLists.txt index a681a1ff..afcbbed6 100644 --- a/toonz/sources/toonzfarm/tfarm/CMakeLists.txt +++ b/toonz/sources/toonzfarm/tfarm/CMakeLists.txt @@ -49,13 +49,13 @@ elseif(BUILD_ENV_APPLE) ${CMAKE_CURRENT_BINARY_DIR}/../../tnzbase/libtnzbase.dylib ${CMAKE_CURRENT_BINARY_DIR}/../../toonzlib/libtoonzlib.dylib ) + add_dependencies(tfarm tnzcore tnzbase toonzlib tnzext) elseif(BUILD_ENV_UNIXLIKE) _find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase;toonzlib;tnzext") if(BUILD_TARGET_WIN) set(EXTRA_LIBS ${EXTRA_LIBS} -lws2_32) endif() endif() - target_link_libraries(tfarm Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Network ${GLUT_LIB} ${GL_LIB} ${EXTRA_LIBS} diff --git a/toonz/sources/toonzlib/CMakeLists.txt b/toonz/sources/toonzlib/CMakeLists.txt index 76b0a2a4..bc03c7c7 100644 --- a/toonz/sources/toonzlib/CMakeLists.txt +++ b/toonz/sources/toonzlib/CMakeLists.txt @@ -332,6 +332,7 @@ qt5_wrap_cpp(SOURCES ${MOC_HEADERS}) add_library(toonzlib SHARED ${HEADERS} ${SOURCES}) if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtoonzlib.dylib") + add_dependencies(toonzlib tnzcore tnzbase tnzext) endif() add_definitions( diff --git a/toonz/sources/toonzqt/CMakeLists.txt b/toonz/sources/toonzqt/CMakeLists.txt index 089a4fec..bed47358 100644 --- a/toonz/sources/toonzqt/CMakeLists.txt +++ b/toonz/sources/toonzqt/CMakeLists.txt @@ -215,6 +215,7 @@ qt5_wrap_cpp(SOURCES ${MOC_HEADERS} OPTIONS ${incs}) add_library(toonzqt SHARED ${HEADERS} ${SOURCES} ${RESOURCES}) if(BUILD_ENV_APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-install_name,@rpath/libtoonzqt.dylib") + add_dependencies(toonzqt tnzcore tnzbase tnzext toonzlib sound) endif() add_definitions(