-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
109 additions
and
26 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,19 +25,19 @@ jobs: | |
uses: turtlebrowser/[email protected] | ||
|
||
- name: Create default profile | ||
run: conan profile detect --force | ||
run: conan profile detect | ||
|
||
- name: Configure packages | ||
- name: Create packages | ||
working-directory: ${{env.CMAKELISTS_DIR}} | ||
run: | | ||
conan editable add . | ||
conan editable add chemfiles | ||
conan editable add ${{github.workspace}}/lib/util | ||
conan editable add ${{github.workspace}}/lib/core | ||
conan create ../util --build=missing --settings=compiler.cppstd=20 | ||
conan create ../core --build=missing --settings=compiler.cppstd=20 | ||
conan create chemfiles --build=missing | ||
conan create . --build=missing --settings=compiler.cppstd=20 | ||
- name: Build | ||
- name: Build tests | ||
working-directory: ${{env.CMAKELISTS_DIR}} | ||
run: conan build test --build=missing --build=editable --settings=compiler.cppstd=20 | ||
run: conan build test --build=missing --settings=compiler.cppstd=20 | ||
|
||
- name: Test | ||
working-directory: ${{env.CMAKELISTS_DIR}} | ||
|
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,19 +1,23 @@ | ||
message("vtx_io") | ||
cmake_minimum_required(VERSION 3.23) | ||
include(../util/cmake/configure-target.cmake) | ||
include(cmake/configure-target.cmake) | ||
project(vtx_io) | ||
|
||
find_package(vtx_util CONFIG REQUIRED) | ||
find_package(vtx_core CONFIG REQUIRED) | ||
find_package(chemfiles CONFIG REQUIRED) | ||
|
||
file(GLOB_RECURSE HEADERS include/*) | ||
file(GLOB_RECURSE SOURCES src/*) | ||
|
||
add_library(vtx_io STATIC ${HEADERS} ${SOURCES}) | ||
configureTarget(vtx_io) | ||
target_include_directories(vtx_io PUBLIC include) | ||
|
||
file(GLOB_RECURSE HEADERS include/*) | ||
file(GLOB_RECURSE SOURCES src/*) | ||
target_sources(vtx_io | ||
PRIVATE ${SOURCES} | ||
PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS include FILES ${HEADERS}) | ||
|
||
target_link_libraries(vtx_io PRIVATE vtx_util::vtx_util) | ||
target_link_libraries(vtx_io PRIVATE vtx_core::vtx_core) | ||
target_link_libraries(vtx_io PRIVATE chemfiles::chemfiles) | ||
target_link_libraries(vtx_io PRIVATE chemfiles::chemfiles) | ||
|
||
install(TARGETS vtx_io FILE_SET public_headers) |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function(configureTarget p_target) | ||
if(CMAKE_COMPILER_IS_GNUCC) | ||
target_compile_options(${p_target} PRIVATE "-Wpedantic") | ||
target_compile_options(${p_target} PRIVATE "-Wall") | ||
elseif(MSVC) | ||
# General. | ||
target_compile_options(${p_target} PRIVATE "/W3") # Warning level 3. | ||
target_compile_options(${p_target} PRIVATE "/WX") # Warnings as errors. | ||
target_compile_options(${p_target} PRIVATE "/MP") # Multicore compilation. | ||
target_compile_options(${p_target} PRIVATE "/sdl") # Additional Security Checks. | ||
target_compile_options(${p_target} PRIVATE "/utf-8") | ||
target_compile_options(${p_target} PRIVATE "/fp:fast") # Floating Point Model. | ||
# Optimization. | ||
target_compile_options(${p_target} PRIVATE "$<$<CONFIG:Release>:/O2>") | ||
target_compile_options(${p_target} PRIVATE "$<$<CONFIG:Release>:/Ob2>") | ||
target_compile_options(${p_target} PRIVATE "$<$<CONFIG:Release>:/Ot>") | ||
target_compile_options(${p_target} PRIVATE "$<$<CONFIG:Release>:/Oi>") | ||
endif() | ||
endfunction() |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
find_package(Qt6 COMPONENTS Core REQUIRED) | ||
|
||
# get absolute path to qmake, then use it to find windeployqt executable | ||
|
||
get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) | ||
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) | ||
|
||
function(win_deploy_qt target) | ||
|
||
# POST_BUILD step | ||
# - after build, we have a bin/lib for analyzing qt dependencies | ||
# - we run windeployqt on target and deploy Qt libs | ||
|
||
if (MSVC) | ||
string(APPEND CONFIG_FLAG | ||
"$<IF:$<CONFIG:Debug>," | ||
"--debug," | ||
"--release" | ||
">") | ||
else() | ||
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE) | ||
if (BUILD_TYPE STREQUAL debug) | ||
string(APPEND CONFIG_FLAG "--" BUILD_TYPE ) | ||
else() | ||
string(APPEND CONFIG_FLAG "--release" ) | ||
endif() | ||
endif() | ||
|
||
add_custom_command(TARGET ${target} POST_BUILD | ||
COMMAND "${_qt_bin_dir}/windeployqt.exe" | ||
--verbose 2 | ||
"${CONFIG_FLAG}" | ||
--no-translations | ||
--no-opengl-sw | ||
--no-system-d3d-compiler | ||
--libdir $<TARGET_FILE_DIR:${target}> | ||
--plugindir $<TARGET_FILE_DIR:${target}> | ||
\"$<TARGET_FILE:${target}>\" | ||
COMMENT "Deploying Qt libraries using windeployqt for compilation target '${target}' ..." | ||
|
||
# TODO : Check if usefull ? | ||
if(!MSVC) | ||
qt_import_plugins(${target} INCLUDE Qt::QMinimalIntegrationPlugin) | ||
endif() | ||
|
||
) | ||
endfunction() | ||
|
||
function (configure_qt) | ||
|
||
set(CMAKE_AUTOMOC ON PARENT_SCOPE) | ||
set(CMAKE_AUTORCC ON PARENT_SCOPE) | ||
set(CMAKE_AUTOUIC ON PARENT_SCOPE) | ||
set(CMAKE_AUTOUIC_SEARCH_PATHS "asset/qt/forms" PARENT_SCOPE) | ||
#set(CMAKE_AUTOGEN_TARGETS_FOLDER "autogen") | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON PARENT_SCOPE) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON PARENT_SCOPE) | ||
#set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
endfunction() | ||
|
||
|
||
function (apply_qt_options target) | ||
|
||
set_property(TARGET ${target} PROPERTY AUTOUIC_OPTIONS "--no-autoconnection") | ||
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00) | ||
|
||
endfunction() |
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,30 +1,24 @@ | ||
message("vtx_io_test") | ||
cmake_minimum_required(VERSION 3.23) | ||
include(../cmake/configure-target.cmake) | ||
project(vtx_io_test) | ||
|
||
set(GIT_URL_CHEMFILES https://github.com/VTX-Molecular-Visualization/chemfiles.git) | ||
set(GIT_TAG_CHEMFILES master) | ||
include(FetchContent) | ||
FetchContent_Declare(chemfiles GIT_REPOSITORY ${GIT_URL_CHEMFILES} GIT_TAG ${GIT_TAG_CHEMFILES}) | ||
FetchContent_MakeAvailable(chemfiles) | ||
|
||
find_package(vtx_util CONFIG REQUIRED) | ||
find_package(vtx_core CONFIG REQUIRED) | ||
find_package(vtx_io CONFIG REQUIRED) | ||
find_package(Catch2 REQUIRED) | ||
|
||
add_executable(vtx_io_test src/main.cpp) | ||
configureTarget(vtx_io_test) | ||
|
||
target_link_libraries(vtx_io_test PRIVATE vtx_util::vtx_util) | ||
target_link_libraries(vtx_io_test PRIVATE vtx_core::vtx_core) | ||
target_link_libraries(vtx_io_test PRIVATE vtx_io::vtx_io) | ||
target_link_libraries(vtx_io_test PRIVATE chemfiles) | ||
target_link_libraries(vtx_io_test PRIVATE Catch2::Catch2WithMain) | ||
|
||
include(CTest) | ||
include(Catch) | ||
catch_discover_tests(vtx_io_test) | ||
|
||
# Copy data. | ||
add_custom_target(vtx_io_test_copy_data ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data $<TARGET_FILE_DIR:vtx_io_test>/data) | ||
add_dependencies(vtx_io_test vtx_io_test_copy_data) |
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