diff -r 1394901b557a -r d0bf58f3560f CMakeLists.txt --- a/CMakeLists.txt Sat Jun 06 22:28:34 2015 +0300 +++ b/CMakeLists.txt Sat Jun 06 23:02:51 2015 +0300 @@ -14,22 +14,32 @@ include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) set (ZCINEMA_SOURCES - src/config.cpp - src/configwindow.cpp src/demo.cpp src/main.cpp - src/misc.cpp src/prompts.cpp ) +set (ZCINEMA_COMMON_SOURCES + src-common/config.cpp + src-common/misc.cpp + src-common/version.cpp +) + +set (ZCINEMA_CONFIG_SOURCES + src-config/configwindow.cpp + src-config/addversionprompt.cpp + src-config/main.cpp +) + set (ZCINEMA_HEADERS - src/config.h - src/configwindow.h + src-common/config.h + src-common/misc.h + src-common/types.h + src-common/version.h + src-config/addversionprompt.h + src-config/configwindow.h src/demo.h - src/main.h - src/misc.h src/prompts.h - src/types.h ) set (ZCINEMA_FORMS @@ -48,41 +58,54 @@ endif() include_directories ("${PROJECT_BINARY_DIR}") +include_directories ("${PROJECT_SOURCE_DIR}/src") include_directories ("${PROJECT_BINARY_DIR}/src") +include_directories ("${PROJECT_SOURCE_DIR}/src-common") +include_directories ("${PROJECT_BINARY_DIR}/src-common") +include_directories ("${PROJECT_SOURCE_DIR}/src-config") +include_directories ("${PROJECT_BINARY_DIR}/src-config") if (USE_QT5) qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS}) qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES}) qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) - add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_MOC} - ${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS}) + + add_library (${PROJECT_NAME}-common STATIC + ${ZCINEMA_COMMON_SOURCES} + ${ZCINEMA_MOC} + ${ZCINEMA_QRC} + ${ZCINEMA_FORMS_HEADERS}) else() qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS}) qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES}) - add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_HEADERS} ${ZCINEMA_RCC} - ${ZCINEMA_FORMS_HEADERS} ${ZCINEMA_MOC}) + + add_library (${PROJECT_NAME}-common STATIC + ${ZCINEMA_COMMON_SOURCES} + ${ZCINEMA_MOC} + ${ZCINEMA_RCC} + ${ZCINEMA_FORMS_HEADERS}) endif() +add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES}) +add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES}) + if (USE_QT5) - target_link_libraries (${PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES}) + target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets) else() - target_link_libraries (${PROJECT_NAME} - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTNETWORK_LIBRARY} - ${QT_QTOPENGL_LIBRARY} - ${OPENGL_LIBRARIES} - ) + target_link_libraries (${PROJECT_NAME}-common ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) endif() +target_link_libraries (${PROJECT_NAME} ${PROJECT_NAME}-common) +target_link_libraries (${PROJECT_NAME}-config ${PROJECT_NAME}-common) + add_custom_target (make_hginfo COMMAND python "${CMAKE_SOURCE_DIR}/updaterevision.py" "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -add_dependencies (${PROJECT_NAME} make_hginfo) +add_dependencies (${PROJECT_NAME}-common make_hginfo) # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword # which clang doesn't seem to like.