-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add standalone executable #250
Closed
Closed
Changes from 5 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
3c93e6c
Add standalone executable
ahcorde 4710cdb
improvements
ahcorde 5be5998
Fixed path windows
ahcorde c40195d
Fixed CMakelist.txt
ahcorde bce242e
Fixed CMakelist.txt
ahcorde 246217e
Fixed windows build!
ahcorde 738e789
Merge remote-tracking branch 'origin/ign-gui5' into ahcorde/5/standalone
ahcorde 500f86a
Fixed linux build
ahcorde d6b491c
fix windows
ahcorde f5418cc
find ignition-tools
ahcorde 6470807
attemp to fix windows
ahcorde 14641f2
another attemp
ahcorde 8fe9843
another attemp
ahcorde 70800c9
another attemp
ahcorde d13277a
another attemp
ahcorde ce069a4
Update CMakeLists.txt
ahcorde bd8d974
QT_QPA_PLATFORM
ahcorde d102084
QT_QPA_PLATFORM
ahcorde 17fb711
QT_QPA_PLATFORM
ahcorde 98ca47a
standalone test
ahcorde a9b4e26
update
ahcorde eb57c5f
update
ahcorde 4e87255
Revert changes to installed ign.hh
scpeters 3b0a96b
Reverse logic for env delimiter
scpeters e1a1db3
Merge branch 'ign-gui5' into ahcorde/5/standalone
scpeters c06f27c
gui_main: include both ign.hh headers
scpeters f2906b4
src/CMakeLists.txt: extensions for test sources
scpeters ced10f4
ign.cc: fix includes
scpeters 1081654
Fixed Windows build
ahcorde be6873d
Fixed build
ahcorde 93d3067
Refactor cmake code, run test without install
scpeters fbee59a
Merge remote-tracking branch 'origin/ign-gui5' into ahcorde/5/standalone
scpeters File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,8 +321,17 @@ bool Application::LoadPlugin(const std::string &_filename, | |
// Add default folder and install folder | ||
std::string home; | ||
common::env(IGN_HOMEDIR, home); | ||
systemPaths.AddPluginPaths(home + "/.ignition/gui/plugins:" + | ||
IGN_GUI_PLUGIN_INSTALL_DIR); | ||
|
||
#ifndef _WIN32 | ||
std::string delimiter = ":"; | ||
#else | ||
std::string delimiter = ";"; | ||
#endif | ||
|
||
systemPaths.AddPluginPaths( | ||
common::joinPaths(home, ".ignition", "gui", "plugins") + | ||
delimiter + | ||
IGN_GUI_PLUGIN_INSTALL_DIR); | ||
|
||
auto pathToLib = systemPaths.FindSharedLibrary(_filename); | ||
if (pathToLib.empty()) | ||
|
@@ -577,7 +586,7 @@ std::vector<std::pair<std::string, std::vector<std::string>>> | |
// 3. ~/.ignition/gui/plugins | ||
std::string home; | ||
common::env(IGN_HOMEDIR, home); | ||
paths.push_back(home + "/.ignition/gui/plugins"); | ||
paths.push_back(common::joinPaths(home, ".ignition", "gui", "plugins")); | ||
|
||
// 4. Install path | ||
paths.push_back(IGN_GUI_PLUGIN_INSTALL_DIR); | ||
|
@@ -598,8 +607,14 @@ std::vector<std::pair<std::string, std::vector<std::string>>> | |
// All we verify is that the file starts with "lib", any further | ||
// checks would require loading the plugin. | ||
|
||
#ifdef _WIN32 | ||
if (plugin.find(".lib") != std::string::npos) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking if you meant to use the |
||
#else | ||
if (plugin.find("lib") == 0) | ||
#endif | ||
{ | ||
ps.push_back(plugin); | ||
} | ||
} | ||
|
||
plugins.push_back(std::make_pair(path, ps)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,189 @@ | ||
# Generate a the ruby script. | ||
# Collect source files into the "sources" variable and unit test files into the | ||
# "gtest_sources" variable. | ||
ign_get_libsources_and_unittests(sources gtest_sources) | ||
|
||
add_library(ign STATIC ign.cc) | ||
target_include_directories(ign PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
target_link_libraries(ign PUBLIC | ||
${PROJECT_LIBRARY_TARGET_NAME} | ||
ignition-common${IGN_COMMON_VER}::ignition-common${IGN_COMMON_VER} | ||
) | ||
|
||
set(gui_executable ign-gui) | ||
add_executable(${gui_executable} gui_main.cc) | ||
target_link_libraries(${gui_executable} | ||
ign | ||
ignition-utils${IGN_UTILS_VER}::cli | ||
ignition-common${IGN_COMMON_VER}::ignition-common${IGN_COMMON_VER} | ||
) | ||
|
||
install( | ||
TARGETS | ||
${gui_executable} | ||
DESTINATION | ||
${IGN_LIB_INSTALL_DIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/ | ||
) | ||
|
||
# Build the unit tests. | ||
ign_build_tests(TYPE UNIT SOURCES ${gtest_sources} | ||
TEST_LIST test_list | ||
LIB_DEPS | ||
${EXTRA_TEST_LIB_DEPS} | ||
ignition-common${IGN_COMMON_VER}::ignition-common${IGN_COMMON_VER} | ||
) | ||
|
||
foreach(test ${test_list}) | ||
target_link_libraries(${test} ign) | ||
|
||
# Inform each test of its output directory so it knows where to call the | ||
# auxiliary files from. Using a generator expression here is useful for | ||
# multi-configuration generators, like Visual Studio. | ||
target_compile_definitions(${test} PRIVATE | ||
"DETAIL_IGN_TRANSPORT_TEST_DIR=\"$<TARGET_FILE_DIR:${test}>\"" | ||
"IGN_TEST_LIBRARY_PATH=\"$<TARGET_FILE_DIR:${PROJECT_LIBRARY_TARGET_NAME}>\"") | ||
|
||
endforeach() | ||
|
||
#=============================================================================== | ||
# Used for the installed version. | ||
# Generate the ruby script that gets installed. | ||
# Note that the major version of the library is included in the name. | ||
if (APPLE) | ||
set(IGN_LIBRARY_NAME lib${PROJECT_NAME_LOWER}.dylib) | ||
else() | ||
set(IGN_LIBRARY_NAME lib${PROJECT_NAME_LOWER}.so) | ||
endif() | ||
# Ex: cmdgui5.rb | ||
set(cmd_script_generated "${CMAKE_CURRENT_BINARY_DIR}/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb") | ||
set(cmd_script_configured "${cmd_script_generated}.configured") | ||
|
||
# Set the library_location variable to the relative path to the library file | ||
# within the install directory structure. | ||
set(gui_exe_location "../../../${CMAKE_INSTALL_LIBDIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/$<TARGET_FILE_NAME:${gui_executable}>") | ||
|
||
configure_file( | ||
"cmdgui.rb.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/cmdgui${PROJECT_VERSION_MAJOR}.rb" @ONLY) | ||
"cmd${IGN_DESIGNATION}.rb.in" | ||
"${cmd_script_configured}" | ||
@ONLY) | ||
|
||
file(GENERATE | ||
OUTPUT "${cmd_script_generated}" | ||
INPUT "${cmd_script_configured}") | ||
|
||
#Used for the installed version. | ||
set(ign_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}") | ||
|
||
# Generate the configuration file that is installed. | ||
# Note that the major version of the library is included in the name. | ||
# Ex: gui5.yaml | ||
configure_file( | ||
"${IGN_DESIGNATION}.yaml.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.configure.yaml" @ONLY) | ||
|
||
file(GENERATE | ||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" | ||
INPUT "${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.configure.yaml") | ||
|
||
# Install the yaml configuration files in an unversioned location. | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ignition/) | ||
|
||
# Install the ruby command line library in an unversioned location. | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmdgui${PROJECT_VERSION_MAJOR}.rb DESTINATION lib/ruby/ignition) | ||
install(FILES ${cmd_script_generated} DESTINATION lib/ruby/ignition) | ||
|
||
if (TARGET UNIT_ign_TEST) | ||
# Generate the ruby script for internal testing. | ||
# Note that the major version of the library is included in the name. | ||
# Ex: cmdgui5.rb | ||
set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/$<CONFIG>/lib/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb") | ||
set(cmd_script_configured_test "${CMAKE_CURRENT_BINARY_DIR}/test_cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb.configured") | ||
|
||
# Set the library_location variable to the full path of the library file within | ||
# the build directory. | ||
set(gui_exe_location "$<TARGET_FILE:${gui_executable}>") | ||
|
||
configure_file( | ||
"cmd${IGN_DESIGNATION}.rb.in" | ||
"${cmd_script_configured_test}" | ||
@ONLY | ||
) | ||
|
||
file(GENERATE | ||
OUTPUT "${cmd_script_generated_test}" | ||
INPUT "${cmd_script_configured_test}" | ||
) | ||
# Generate a configuration file for internal testing. | ||
# Note that the major version of the library is included in the name. | ||
# Ex: gui5.yaml | ||
configure_file( | ||
"${IGN_DESIGNATION}.yaml.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml.configured" @ONLY) | ||
|
||
# Used for the installed version. | ||
set(ign_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmd${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.rb") | ||
|
||
file(GENERATE | ||
OUTPUT "${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" | ||
INPUT "${CMAKE_CURRENT_BINARY_DIR}/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml.configured") | ||
|
||
set(_env_vars) | ||
if(WIN32) | ||
list(APPEND _env_vars "PATH=${CMAKE_INSTALL_PREFIX}/bin;$ENV{PATH}") | ||
endif() | ||
list(APPEND _env_vars "IGN_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>") | ||
|
||
set_tests_properties( | ||
UNIT_ign_TEST | ||
PROPERTIES | ||
ENVIRONMENT | ||
"${_env_vars}" | ||
) | ||
endif() | ||
|
||
if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt) | ||
get_target_property(_qt5_qmake_location | ||
Qt5::qmake IMPORTED_LOCATION | ||
) | ||
|
||
execute_process( | ||
COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX | ||
RESULT_VARIABLE return_code | ||
OUTPUT_VARIABLE qt5_install_prefix | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
# Anaconda3 Location | ||
set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe") | ||
# vcpkg location | ||
set(imported_location2 "${qt5_install_prefix}/tools/qt5/bin/windeployqt.exe") | ||
|
||
if(EXISTS ${imported_location}) | ||
set(QML_DIR ${qt5_install_prefix}/qml) | ||
add_executable(Qt5::windeployqt IMPORTED) | ||
|
||
set_target_properties(Qt5::windeployqt PROPERTIES | ||
IMPORTED_LOCATION ${imported_location} | ||
) | ||
elseif(EXISTS ${imported_location2}) | ||
set(QML_DIR ${qt5_install_prefix}/qml) | ||
add_executable(Qt5::windeployqt IMPORTED) | ||
|
||
set_target_properties(Qt5::windeployqt PROPERTIES | ||
IMPORTED_LOCATION ${imported_location2} | ||
) | ||
else() | ||
message("Not able to locate windeployqt.exe") | ||
endif() | ||
endif() | ||
|
||
if(TARGET Qt5::windeployqt) | ||
# execute windeployqt in a tmp directory after build | ||
add_custom_command(TARGET ${gui_executable} | ||
POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" | ||
COMMAND set PATH=%PATH%$<SEMICOLON>${qt5_install_prefix}/bin | ||
COMMAND Qt5::windeployqt --dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" --qmldir ${QML_DIR} ${CMAKE_BINARY_DIR}/bin/$<CONFIG>/ign-gui.exe --quick --qml | ||
) | ||
|
||
# copy deployment directory during installation | ||
install( | ||
DIRECTORY | ||
"${CMAKE_CURRENT_BINARY_DIR}/windeployqt/" | ||
DESTINATION ${IGN_LIB_INSTALL_DIR}/ignition/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}/ | ||
) | ||
endif() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why is this needed?