|
Toshihiro Shimizu |
890ddd |
cmake_minimum_required(VERSION 2.8.11)
|
|
Toshihiro Shimizu |
890ddd |
project(OpenToonz)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
get_filename_component(SDKROOT ../../thirdparty/ ABSOLUTE)
|
|
Toshihiro Shimizu |
890ddd |
message("SDK Root:" ${SDKROOT})
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (WIN32)
|
|
Toshihiro Shimizu |
890ddd |
message("Windows System")
|
|
Toshihiro Shimizu |
890ddd |
set(QT_PATH "C:/Qt/Qt5.5.1/5.5/msvc2013_64" CACHE PATH "Qt instlattion directory")
|
|
Toshihiro Shimizu |
890ddd |
if(NOT EXISTS ${QT_PATH})
|
|
Toshihiro Shimizu |
890ddd |
message("Specify QT_PATH properly")
|
|
Toshihiro Shimizu |
890ddd |
return()
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
set(QT_LIB_PATH ${QT_PATH})
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_PREFIX_PATH "${QT_PATH}/lib/cmake/")
|
|
Toshihiro Shimizu |
890ddd |
elseif (APPLE)
|
|
Toshihiro Shimizu |
890ddd |
message("Apple System")
|
|
Toshihiro Shimizu |
890ddd |
if (NOT PLATFORM)
|
|
Toshihiro Shimizu |
890ddd |
set(PLATFORM 64)
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
message("PLATFORM:" ${PLATFORM})
|
|
Toshihiro Shimizu |
890ddd |
if (PLATFORM EQUAL 64)
|
|
Toshihiro Shimizu |
890ddd |
set(QT_PATH "~/Qt/5.5/clang_64/lib/")
|
|
Toshihiro Shimizu |
890ddd |
set(QT_LIB_PATH ${QT_PATH})
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_PREFIX_PATH ${QT_PATH}cmake/)
|
|
Toshihiro Shimizu |
890ddd |
message("CMAKE_PREFIX_PATH:" ${CMAKE_PREFIX_PATH})
|
|
Toshihiro Shimizu |
890ddd |
add_definitions(-DMACOSX -Di386)
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++11 -stdlib=libc++ -fno-implicit-templates")
|
|
Toshihiro Shimizu |
890ddd |
elseif(PLATFORM EQUAL 32)
|
|
Toshihiro Shimizu |
890ddd |
set(QT_PATH "~/Qt/5.5/clang_32/lib/")
|
|
Toshihiro Shimizu |
890ddd |
set(QT_LIB_PATH ${QT_PATH})
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_PREFIX_PATH ${QT_PATH}cmake/)
|
|
Toshihiro Shimizu |
890ddd |
message("CMAKE_PREFIX_PATH:" ${CMAKE_PREFIX_PATH})
|
|
Toshihiro Shimizu |
890ddd |
add_definitions(-DMACOSX -Di386)
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -std=c++11 -stdlib=libc++ -fno-implicit-templates -D HAS_QUICKDRAW")
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -m32")
|
|
Toshihiro Shimizu |
890ddd |
else()
|
|
Toshihiro Shimizu |
890ddd |
message(FATAL_ERROR "Invalid PLATFORM:" ${PLATFORM} ". 'PLATFORM' must be 32 or 64.")
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
else ()
|
|
Toshihiro Shimizu |
890ddd |
message("Unknown System")
|
|
Toshihiro Shimizu |
890ddd |
endif ()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
add_definitions(-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
# Find includes in corresponding build directories
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_INSTALL_RPATH ${QT_LIB_PATH})
|
|
Toshihiro Shimizu |
890ddd |
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
Toshihiro Shimizu |
890ddd |
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
# Find the QtWidgets library
|
|
Toshihiro Shimizu |
890ddd |
find_package(Qt5 REQUIRED
|
|
Toshihiro Shimizu |
890ddd |
Core
|
|
Toshihiro Shimizu |
890ddd |
Gui
|
|
Toshihiro Shimizu |
890ddd |
Network
|
|
Toshihiro Shimizu |
890ddd |
OpenGL
|
|
Toshihiro Shimizu |
890ddd |
Svg
|
|
Toshihiro Shimizu |
890ddd |
Xml
|
|
Toshihiro Shimizu |
890ddd |
Script
|
|
Toshihiro Shimizu |
890ddd |
Widgets
|
|
Toshihiro Shimizu |
890ddd |
PrintSupport
|
|
Toshihiro Shimizu |
890ddd |
LinguistTools)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
include_directories(include ${SDKROOT}/boost/boost_1_55_0/)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if(WIN32)
|
|
Toshihiro Shimizu |
890ddd |
include_directories(
|
|
Toshihiro Shimizu |
890ddd |
${SDKROOT}/glut/3.7.6/include
|
|
Toshihiro Shimizu |
890ddd |
${SDKROOT}/zlib/zlib-1.2.7
|
|
Toshihiro Shimizu |
890ddd |
${SDKROOT}/LibJPEG/jpeg-9)
|
|
Toshihiro Shimizu |
890ddd |
add_definitions(-DGLUT_NO_LIB_PRAGMA)
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
get_target_property(QtCore_location Qt5::Core LOCATION)
|
|
Toshihiro Shimizu |
890ddd |
get_target_property(QtWidget_location Qt5::Widgets LOCATION)
|
|
Toshihiro Shimizu |
890ddd |
message("Qt Core Location:" ${QtCore_location})
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
macro(_find_toonz_library OUT_LIB_LIST IN_LIB_LIST)
|
|
Toshihiro Shimizu |
890ddd |
set(OUTLIST "")
|
|
Toshihiro Shimizu |
890ddd |
foreach(arg ${IN_LIB_LIST})
|
|
Toshihiro Shimizu |
890ddd |
unset(COREPATH CACHE)
|
|
Toshihiro Shimizu |
890ddd |
# find しても cmake が走るときにはできていないので完全なパス名を生成して返すだけ
|
|
Toshihiro Shimizu |
890ddd |
if(WIN32)
|
|
Toshihiro Shimizu |
890ddd |
set(LIBPATH ${arg})
|
|
Toshihiro Shimizu |
890ddd |
else()
|
|
Toshihiro Shimizu |
890ddd |
set(LIBPATH ${CMAKE_CURRENT_BINARY_DIR}/../${arg}/lib${arg}${CMAKE_SHARED_LIBRARY_SUFFIX})
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
set(OUTLIST ${OUTLIST} ${LIBPATH})
|
|
Toshihiro Shimizu |
890ddd |
endforeach()
|
|
Toshihiro Shimizu |
890ddd |
set(${OUT_LIB_LIST} ${OUTLIST})
|
|
Toshihiro Shimizu |
890ddd |
endmacro()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
set(TNZSTDFX_Location)
|
|
Toshihiro Shimizu |
890ddd |
set(TFARM_Location)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if(WIN32)
|
|
Toshihiro Shimizu |
890ddd |
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
Toshihiro Shimizu |
890ddd |
set(PLATFORM 32)
|
|
Toshihiro Shimizu |
890ddd |
set(PLATFORM2)
|
|
Toshihiro Shimizu |
890ddd |
else()
|
|
Toshihiro Shimizu |
890ddd |
set(PLATFORM 64)
|
|
Toshihiro Shimizu |
890ddd |
set(PLATFORM2 _64)
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
set(GLUT_LIB ${SDKROOT}/glut/3.7.6/lib/glut${PLATFORM}.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(GL_LIB opengl32.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(Z_LIB
|
|
Toshihiro Shimizu |
890ddd |
optimized ${SDKROOT}/zlib/zlib-1.2.7/lib/zlib-1.2.7${PLATFORM2}.lib
|
|
Toshihiro Shimizu |
890ddd |
debug ${SDKROOT}/zlib/zlib-1.2.7/lib/zlib-1.2.7${PLATFORM2}d.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(JPEG_LIB ${SDKROOT}/LibJPEG/jpeg-9/lib/LibJPEG-9${PLATFORM2}.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(TIFF_LIB
|
|
Toshihiro Shimizu |
890ddd |
optimized ${SDKROOT}/LibTIFF/tiff-4.0.3/lib/LibTIFF-4.0.3${PLATFORM2}.lib
|
|
Toshihiro Shimizu |
890ddd |
debug ${SDKROOT}/LibTIFF/tiff-4.0.3/lib/LibTIFF-4.0.3${PLATFORM2}d.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(GLEW_LIB ${SDKROOT}/glew/glew-1.9.0/lib/glew${PLATFORM}.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(LZ4_LIB ${SDKROOT}/Lz4/Lz4_131/lz4_${PLATFORM}.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(SUPERLU_LIB ${SDKROOT}/superlu/SuperLU_${PLATFORM}.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(OPENBLAS_LIB ${SDKROOT}/openblas/libopenblas_${PLATFORM}.lib)
|
|
Toshihiro Shimizu |
890ddd |
set(USB_LIB) # unused
|
|
Toshihiro Shimizu |
890ddd |
if (PLATFORM EQUAL 32)
|
|
Toshihiro Shimizu |
890ddd |
set(QT_LIB ${SDKROOT}/quicktime/QT73SDK/Libraries/QTMLClient.lib)
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
else()
|
|
Toshihiro Shimizu |
890ddd |
find_library(GLUT_LIB GLUT)
|
|
Toshihiro Shimizu |
890ddd |
find_library(GL_LIB OpenGL)
|
|
Toshihiro Shimizu |
890ddd |
find_library(Z_LIB z)
|
|
Toshihiro Shimizu |
890ddd |
set(JPEG_LIB ${SDKROOT}/LibJPEG/jpeg-9/libjpeg.a)
|
|
Toshihiro Shimizu |
890ddd |
set(TIFF_LIB ${SDKROOT}/LibTIFF/tiff-4.0.3/lib/libtiff.a)
|
|
Toshihiro Shimizu |
890ddd |
set(GLEW_LIB ${SDKROOT}/glew/glew-1.9.0/lib/libGLEW.dylib)
|
|
Toshihiro Shimizu |
890ddd |
set(LZ4_LIB ${SDKROOT}/Lz4/Lz4_131/lib/liblz4.a)
|
|
Toshihiro Shimizu |
890ddd |
set(SUPERLU_LIB ${SDKROOT}/superlu/libsuperlu_4.1.a)
|
|
Toshihiro Shimizu |
890ddd |
set(OPENBLAS_LIB) # unused?
|
|
Toshihiro Shimizu |
890ddd |
set(USB_LIB ${SDKROOT}/libusb/libusb-1.0.9/libusb/.libs/libusb-1.0.a)
|
|
Toshihiro Shimizu |
890ddd |
if (PLATFORM EQUAL 32)
|
|
Toshihiro Shimizu |
890ddd |
find_library(QT_LIB QuickTime)
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if(WIN32 AND PLATFORM EQUAL 64)
|
|
Toshihiro Shimizu |
890ddd |
add_definitions(-Dx64)
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if(WIN32)
|
|
Toshihiro Shimizu |
890ddd |
# place Toonz.exe and dlls in the same directory
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
Toshihiro Shimizu |
890ddd |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
# generate Qt translations and messages
|
|
Toshihiro Shimizu |
890ddd |
set(LANGUAGES japanese italian french)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
function(add_translation module)
|
|
Toshihiro Shimizu |
890ddd |
set(translation)
|
|
Toshihiro Shimizu |
890ddd |
foreach(lang ${LANGUAGES})
|
|
Toshihiro Shimizu |
890ddd |
set(name "${CMAKE_SOURCE_DIR}/translations/${lang}/${module}.ts")
|
|
Toshihiro Shimizu |
890ddd |
list(APPEND translation ${name})
|
|
Toshihiro Shimizu |
890ddd |
set_source_files_properties(${name} PROPERTIES
|
|
Toshihiro Shimizu |
890ddd |
OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/loc/${lang}")
|
|
Toshihiro Shimizu |
890ddd |
endforeach()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
qt5_create_translation(message ${translation} ${ARGN})
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
add_custom_target("translation_${module}" DEPENDS ${message})
|
|
Toshihiro Shimizu |
890ddd |
set_target_properties("translation_${module}" PROPERTIES
|
|
Toshihiro Shimizu |
890ddd |
EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
|
Toshihiro Shimizu |
890ddd |
endfunction()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(tnzcore)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(tnzbase)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(tnzext)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(toonzlib)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(toonzfarm/tfarm)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(stdfx)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(sound)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(colorfx)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(image)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(toonzqt)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(tnztools)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(toonz)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(${SDKROOT}/lzo/driver lzodriver)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(tcleanupper)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(tcomposer)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(tconverter)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(toonzfarm)
|
|
Toshihiro Shimizu |
890ddd |
if(PLATFORM EQUAL 32)
|
|
Toshihiro Shimizu |
890ddd |
add_subdirectory(t32bitsrv)
|
|
Toshihiro Shimizu |
890ddd |
endif()
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (APPLE)
|
|
Toshihiro Shimizu |
890ddd |
add_custom_command(TARGET executable
|
|
Toshihiro Shimizu |
890ddd |
POST_BUILD COMMAND
|
|
Toshihiro Shimizu |
890ddd |
${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH}
|
|
Toshihiro Shimizu |
890ddd |
$<target_file:executable>)</target_file:executable>
|
|
Toshihiro Shimizu |
890ddd |
endif (APPLE)
|