Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitexternals
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- mode: cmake -*-
# CMake/common https://github.com/Eyescale/CMake.git 3d5d284
# CMake/common https://github.com/Eyescale/CMake.git 40e030e
6 changes: 3 additions & 3 deletions .gitsubprojects
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- mode: cmake -*-
git_subproject(ZeroEQ https://github.com/HBPVIS/ZeroEQ.git 9b7ca61)
git_subproject(Deflect https://github.com/BlueBrain/Deflect.git 76526f0)
git_subproject(TUIO https://github.com/BlueBrain/TUIO.git fdf5cf7)
git_subproject(ZeroEQ https://github.com/HBPVIS/ZeroEQ.git 505caf8)
git_subproject(Deflect https://github.com/BlueBrain/Deflect.git 7ebb0a5)
git_subproject(TUIO https://github.com/BlueBrain/TUIO.git 67a65ad)
git_subproject(VirtualKeyboard https://github.com/rdumusc/QtFreeVirtualKeyboard.git b2f79e3)
52 changes: 33 additions & 19 deletions CMake/GitExternal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ function(GIT_EXTERNAL DIR REPO tag)

if(NOT EXISTS "${DIR}")
# clone
message(STATUS "git clone --recursive ${REPO} ${DIR} [${TAG}]")
message(STATUS "git clone ${REPO} ${DIR} [${TAG}]")
execute_process(
COMMAND "${GIT_EXECUTABLE}" clone --recursive ${REPO} ${DIR}
COMMAND "${GIT_EXECUTABLE}" clone ${REPO} ${DIR}
RESULT_VARIABLE nok ERROR_VARIABLE error
WORKING_DIRECTORY "${GIT_EXTERNAL_DIR}")
if(nok)
Expand All @@ -112,6 +112,9 @@ function(GIT_EXTERNAL DIR REPO tag)
RESULT_VARIABLE nok ERROR_VARIABLE error WORKING_DIRECTORY "${DIR}")
if(nok)
message(FATAL_ERROR "git checkout ${TAG} in ${DIR} failed: ${error}\n")
else()
execute_process(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive
WORKING_DIRECTORY "${DIR}")
endif()
endif()

Expand Down Expand Up @@ -180,8 +183,7 @@ function(GIT_EXTERNAL DIR REPO tag)
" RESULT_VARIABLE nok ERROR_VARIABLE error\n"
" WORKING_DIRECTORY \"${DIR}\")\n"
"if(nok)\n"
" message(FATAL_ERROR \"git checkout ${TAG} in ${__dir} failed: ${error}\n\")\n"
"endif()\n"
" message(FATAL_ERROR \"git checkout ${TAG} in ${__dir} failed: \${error}\")\n"
)
else()
# requested TAG is a branch
Expand All @@ -198,10 +200,18 @@ function(GIT_EXTERNAL DIR REPO tag)
" execute_process(COMMAND \"${GIT_EXECUTABLE}\" rebase --abort\n"
" WORKING_DIRECTORY \"${DIR}\" ERROR_QUIET OUTPUT_QUIET)\n"
" message(FATAL_ERROR \"Rebase ${__dir} failed:\n\${output}\${error}\")\n"
"endif()\n"
)
endif()

file(APPEND ${__rebase_cmake}
# update submodules if checkout worked
"else()\n"
" execute_process(\n"
" COMMAND \"${GIT_EXECUTABLE}\" submodule update --init --recursive\n"
" WORKING_DIRECTORY \"${DIR}\")\n"
"endif()\n"
)

if(NOT GIT_EXTERNAL_SCRIPT_MODE)
add_custom_target(${__target}-rebase
COMMAND ${CMAKE_COMMAND} -P ${__rebase_cmake}
Expand Down Expand Up @@ -239,28 +249,28 @@ if(EXISTS ${GIT_EXTERNALS} AND NOT GIT_EXTERNAL_SCRIPT_MODE)
list(GET DATA 2 TAG)

# Create a unique, flat name
string(REPLACE "/" "-" GIT_EXTERNAL_NAME ${DIR}_${PROJECT_NAME})
string(REPLACE "/" "-" GIT_EXTERNAL_NAME ${DIR})

if(NOT TARGET update-gitexternal-${GIT_EXTERNAL_NAME}) # not done
if(NOT TARGET ${PROJECT_NAME}-update-gitexternal-${GIT_EXTERNAL_NAME}) # not done
# pull in identified external
git_external(${DIR} ${REPO} ${TAG})

# Create update script and target to bump external spec
if(NOT TARGET update)
add_custom_target(update)
endif()
if(NOT TARGET ${PROJECT_NAME}-update-gitexternal)
add_custom_target(${PROJECT_NAME}-update-gitexternal)
add_custom_target(${PROJECT_NAME}-flatten-gitexternal)
add_dependencies(update ${PROJECT_NAME}-update-gitexternal)
if(NOT TARGET ${PROJECT_NAME}-update-gitexternals)
add_custom_target(${PROJECT_NAME}-update-gitexternals)
add_custom_target(${PROJECT_NAME}-flatten-gitexternals)
add_dependencies(update ${PROJECT_NAME}-update-gitexternals)
endif()

# Create a unique, flat name
file(RELATIVE_PATH GIT_EXTERNALS_BASE ${CMAKE_SOURCE_DIR}
${GIT_EXTERNALS})
string(REPLACE "/" "_" GIT_EXTERNAL_TARGET ${GIT_EXTERNALS_BASE})

set(GIT_EXTERNAL_TARGET update-gitexternal-${GIT_EXTERNAL_TARGET})
set(GIT_EXTERNAL_TARGET ${PROJECT_NAME}-write-gitexternal-${GIT_EXTERNAL_NAME})
if(NOT TARGET ${GIT_EXTERNAL_TARGET})
set(GIT_EXTERNAL_SCRIPT
"${CMAKE_CURRENT_BINARY_DIR}/${GIT_EXTERNAL_TARGET}.cmake")
Expand Down Expand Up @@ -288,21 +298,21 @@ if(newref)
else()
file(APPEND ${GIT_EXTERNALS} \"# ${DIR} ${REPO} ${TAG}\n\")
endif()")
add_custom_target(update-gitexternal-${GIT_EXTERNAL_NAME}
add_custom_target(${PROJECT_NAME}-update-gitexternal-${GIT_EXTERNAL_NAME}
COMMAND "${CMAKE_COMMAND}" -DGIT_EXTERNAL_SCRIPT_MODE=1 -P ${GIT_EXTERNAL_SCRIPT}
COMMENT "Update ${REPO} in ${GIT_EXTERNALS_BASE}"
DEPENDS ${GIT_EXTERNAL_TARGET}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
add_dependencies(${PROJECT_NAME}-update-gitexternal
update-gitexternal-${GIT_EXTERNAL_NAME})
add_dependencies(${PROJECT_NAME}-update-gitexternals
${PROJECT_NAME}-update-gitexternal-${GIT_EXTERNAL_NAME})

# Flattens a git external repository into its parent repo:
# * Clean any changes from external
# * Unlink external from git: Remove external/.git and .gitexternals
# * Add external directory to parent
# * Commit with flattened repo and tag info
# - Depend on release branch checked out
add_custom_target(flatten-gitexternal-${GIT_EXTERNAL_NAME}
add_custom_target(${PROJECT_NAME}-flatten-gitexternal-${GIT_EXTERNAL_NAME}
COMMAND "${GIT_EXECUTABLE}" clean -dfx
COMMAND "${CMAKE_COMMAND}" -E remove_directory .git
COMMAND "${CMAKE_COMMAND}" -E remove -f "${CMAKE_CURRENT_SOURCE_DIR}/.gitexternals"
Expand All @@ -311,10 +321,14 @@ endif()")
COMMENT "Flatten ${REPO} into ${DIR}"
DEPENDS ${PROJECT_NAME}-make-branch
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}")
add_dependencies(${PROJECT_NAME}-flatten-gitexternal
flatten-gitexternal-${GIT_EXTERNAL_NAME})
add_dependencies(${PROJECT_NAME}-flatten-gitexternals
${PROJECT_NAME}-flatten-gitexternal-${GIT_EXTERNAL_NAME})

foreach(_target flatten-gitexternal-${GIT_EXTERNAL_NAME} ${PROJECT_NAME}-flatten-gitexternal update-gitexternal-${GIT_EXTERNAL_NAME} ${GIT_EXTERNAL_TARGET} ${PROJECT_NAME}-update-gitexternal update)
foreach(_target ${PROJECT_NAME}-flatten-gitexternal-${GIT_EXTERNAL_NAME}
${PROJECT_NAME}-flatten-gitexternals
${PROJECT_NAME}-update-gitexternal-${GIT_EXTERNAL_NAME}
${PROJECT_NAME}-update-gitexternals
${GIT_EXTERNAL_TARGET} update)
set_target_properties(${_target} PROPERTIES
EXCLUDE_FROM_DEFAULT_BUILD ON FOLDER git)
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Raphael Dumusc <raphael.dumusc@epfl.ch>

cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(Tide VERSION 1.2.2)
project(Tide VERSION 1.3.0)
set(Tide_VERSION_ABI 1)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake
Expand Down
36 changes: 29 additions & 7 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,47 @@
# Copyright (c) 2013-2016, EPFL/Blue Brain Project
# Copyright (c) 2013-2017, EPFL/Blue Brain Project
# Raphael Dumusc <raphael.dumusc@epfl.ch>

include(CommonHelp)

include_directories(${PROJECT_SOURCE_DIR}/tide/core)

add_subdirectory(TideForker)
add_subdirectory(TideMaster)
add_subdirectory(TideWall)
add_subdirectory(Launcher)
add_subdirectory(Whiteboard)

set(_tide_in ${CMAKE_CURRENT_SOURCE_DIR}/tide)
set(_tide_out ${PROJECT_BINARY_DIR}/bin/tide)
add_custom_command(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not configure_file(@only)? This way it should run only if _tide_in has changed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I had to investigate more to understand:

  • configure_file(COPYONLY) is executed during CMake configure step, which means that CMake has to be re-run if the file has changed.
  • also, if one does "rm bin/tide", then "ninja tide" doesn't know how to recreate the missing dependency (ninja: error: 'bin/tide', needed by 'apps/CMakeFiles/tide', missing and no known rule to make it).
  • with the custom_command aproach the file is correctly recreated if it is missing, and it is also copied only if it has changed (I checked the exact modification dates).

However, my code was missing "DEPENDS ${_tide_in}" in add_custom_command(), so it did not copy the file again if _tide_in was changed. Now everything works as expected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good then.

DEPENDS ${_tide_in}
OUTPUT ${_tide_out}
POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${_tide_in} ${_tide_out}
)
add_custom_target(tide ALL DEPENDS ${_tide_out} tideForker tideMaster tideWall
tideLauncher tideWhiteboard
)
add_dependencies(${PROJECT_NAME}-all tide)

if(TARGET Qt5::WebKitWidgets)
add_subdirectory(LocalStreamer)
add_subdirectory(LocalStreamer)
add_dependencies(tide tideLocalstreamer)
endif()
if(TARGET Qt5::WebEngine)
add_subdirectory(Webbrowser)
add_dependencies(tide tideWebbrowser)
endif()

install(PROGRAMS pyramidmaker tide DESTINATION bin COMPONENT apps)

# Copy the startup script and default config to the bin folder to be able to
# launch after building without requiring an install folder and 'make install'
file(COPY pyramidmaker tide DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${PROJECT_SOURCE_DIR}/examples/configuration_1x3.xml
DESTINATION ${CMAKE_BINARY_DIR}/share/Tide/examples
file(
COPY ${PROJECT_SOURCE_DIR}/examples/configuration_1x3.xml
DESTINATION ${PROJECT_BINARY_DIR}/share/Tide/examples
)

file(COPY pyramidmaker DESTINATION ${PROJECT_BINARY_DIR}/bin)
install(PROGRAMS pyramidmaker tide DESTINATION bin COMPONENT apps)

# Generate application help pages for doxygen
common_help(tide LOCATION ${_tide_out})
common_help(pyramidmaker LOCATION ${PROJECT_BINARY_DIR}/bin/pyramidmaker)
9 changes: 5 additions & 4 deletions apps/Launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2016, EPFL/Blue Brain Project
# Ahmet Bilgili <ahmet.bilgili@epfl.ch>
# Raphael Dumusc <raphael.dumusc@epfl.ch>
# Copyright (c) 2016-2017, EPFL/Blue Brain Project
# Ahmet Bilgili <ahmet.bilgili@epfl.ch>
# Raphael Dumusc <raphael.dumusc@epfl.ch>

set(TIDELAUNCHER_HEADERS
Launcher.h
Expand All @@ -14,7 +14,8 @@ set(TIDELAUNCHER_SOURCES

set(TIDELAUNCHER_LINK_LIBRARIES DeflectQt TideMaster)

common_application(tideLauncher)
common_application(tideLauncher NOHELP)

if(TARGET VirtualKeyboard)
add_dependencies(tideLauncher VirtualKeyboard)
endif()
7 changes: 5 additions & 2 deletions apps/Launcher/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*********************************************************************/
/* Copyright (c) 2016, EPFL/Blue Brain Project */
/* Raphael Dumusc <raphael.dumusc@epfl.ch> */
/* Copyright (c) 2016-2017, EPFL/Blue Brain Project */
/* Raphael Dumusc <raphael.dumusc@epfl.ch> */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
Expand Down Expand Up @@ -40,12 +40,15 @@
#include "Launcher.h"

#include "tide/core/log.h"
#include "tide/master/localstreamer/CommandLineOptions.h"

int main( int argc, char** argv )
{
logger_id = "launcher";
qInstallMessageHandler( qtMessageLogger );

COMMAND_LINE_PARSER_CHECK( CommandLineOptions, "tideLauncher" );

// Load virtualkeyboard input context plugin
qputenv( "QT_IM_MODULE", QByteArray( "virtualkeyboard" ));

Expand Down
12 changes: 6 additions & 6 deletions apps/LocalStreamer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

# Copyright (c) 2013-2015, EPFL/Blue Brain Project
# Copyright (c) 2013-2017, EPFL/Blue Brain Project
# Raphael Dumusc <raphael.dumusc@epfl.ch>

include_directories(${PROJECT_SOURCE_DIR}/tide/master)

set(LOCALSTREAMER_HEADERS
set(TIDELOCALSTREAMER_HEADERS
Application.h
)

set(LOCALSTREAMER_SOURCES
main.cpp
set(TIDELOCALSTREAMER_SOURCES
Application.cpp
main.cpp
)

set(LOCALSTREAMER_LINK_LIBRARIES TideMaster Deflect)
set(TIDELOCALSTREAMER_LINK_LIBRARIES TideMaster Deflect)

common_application(localstreamer)
common_application(tideLocalstreamer NOHELP)
16 changes: 5 additions & 11 deletions apps/LocalStreamer/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*********************************************************************/
/* Copyright (c) 2013, EPFL/Blue Brain Project */
/* Raphael Dumusc <raphael.dumusc@epfl.ch> */
/* Copyright (c) 2013-2017, EPFL/Blue Brain Project */
/* Raphael Dumusc <raphael.dumusc@epfl.ch> */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
Expand Down Expand Up @@ -49,15 +49,9 @@

int main( int argc, char* argv[] )
{
CommandLineOptions options( argc, argv );
COMMAND_LINE_PARSER_CHECK( CommandLineOptions, "tideLocalstreamer" );

if( options.getHelp( ))
{
options.showSyntax();
return 0;
}

const PixelStreamerType type = options.getPixelStreamerType();
const PixelStreamerType type = commandLine.getPixelStreamerType();
if( type == PS_UNKNOWN )
{
std::cerr << "Invalid streamer type." << std::endl;
Expand All @@ -68,7 +62,7 @@ int main( int argc, char* argv[] )
qInstallMessageHandler( qtMessageLogger );

Application app( argc, argv );
if( !app.initialize( options ))
if( !app.initialize( commandLine ))
return FAILED_APP_INITIALIZATION_ERROR_CODE;

return app.exec();
Expand Down
4 changes: 2 additions & 2 deletions apps/TideForker/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) 2013-2016, EPFL/Blue Brain Project
# Copyright (c) 2013-2017, EPFL/Blue Brain Project
# Raphael Dumusc <raphael.dumusc@epfl.ch>

include_directories(${PROJECT_SOURCE_DIR}/tide/master)

set(TIDEFORKER_SOURCES main.cpp)
set(TIDEFORKER_LINK_LIBRARIES TideMaster)
common_application(tideForker)
common_application(tideForker NOHELP)
21 changes: 17 additions & 4 deletions apps/TideForker/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*********************************************************************/
/* Copyright (c) 2011 - 2012, The University of Texas at Austin. */
/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */
/* Copyright (c) 2013-2017, EPFL/Blue Brain Project */
/* Raphael.Dumusc@epfl.ch */
/* Daniel.Nachbaur@epfl.ch */
/* All rights reserved. */
Expand Down Expand Up @@ -39,15 +39,28 @@
/* or implied, of Ecole polytechnique federale de Lausanne. */
/*********************************************************************/

#include "localstreamer/ProcessForker.h"
#include "log.h"
#include "network/MPIChannel.h"
#include "tide/core/CommandLineParser.h"
#include "tide/core/log.h"
#include "tide/core/network/MPIChannel.h"
#include "tide/master/localstreamer/ProcessForker.h"

class CommandLineHelper : public CommandLineParser
{
public:
void showSyntax( const std::string& appName ) const final
{
std::cout << "Usage: " << appName << " is an internal subprocess of "
"tideMaster, do not run manually." << std::endl;
}
};

int main( int argc, char* argv[] )
{
logger_id = "forker";
qInstallMessageHandler( qtMessageLogger );

COMMAND_LINE_PARSER_CHECK( CommandLineHelper, "tideForker" );

{
MPIChannelPtr worldChannel( new MPIChannel( argc, argv ));
const int rank = worldChannel->getRank();
Expand Down
4 changes: 2 additions & 2 deletions apps/TideMaster/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) 2013-2016, EPFL/Blue Brain Project
# Copyright (c) 2013-2017, EPFL/Blue Brain Project
# Raphael Dumusc <raphael.dumusc@epfl.ch>

include_directories(${PROJECT_SOURCE_DIR}/tide/master)

set(TIDEMASTER_SOURCES main.cpp)
set(TIDEMASTER_LINK_LIBRARIES TideMaster)
common_application(tideMaster)
common_application(tideMaster NOHELP)
Loading