Skip to content

Commit

Permalink
Package vtx_renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Nov 8, 2023
1 parent 701aa6b commit 35498e8
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 23 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/cmake_renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,16 @@ jobs:
- name: Create default profile
run: conan profile detect --force

- name: Configure packages
- name: Create packages
working-directory: ${{env.CMAKELISTS_DIR}}
run: |
conan editable add .
conan editable add ${{github.workspace}}/lib/util
conan editable add ${{github.workspace}}/lib/io
conan editable add ${{github.workspace}}/lib/io/chemfiles
conan editable add ${{github.workspace}}/lib/core
- name: Build
working-directory: ${{env.CMAKELISTS_DIR}}
run: |
conan build test --build=missing --build=editable --settings=compiler.cppstd=20
conan build bench --build=missing --build=editable --settings=compiler.cppstd=20 -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=True
conan create ../util --build=missing --settings=compiler.cppstd=20
conan create ../core --build=missing --settings=compiler.cppstd=20
conan create ../io/chemfiles --build=missing
conan create ../io --build=missing --settings=compiler.cppstd=20
conan create . --build=missing --settings=compiler.cppstd=20
conan create test --build=missing --settings=compiler.cppstd=20
- name: Test
working-directory: ${{env.CMAKELISTS_DIR}}
run: ctest --verbose
Expand Down
2 changes: 1 addition & 1 deletion lib/io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ find_package(vtx_util CONFIG REQUIRED)
find_package(vtx_core CONFIG REQUIRED)
find_package(chemfiles CONFIG REQUIRED)

add_library(vtx_io STATIC ${HEADERS} ${SOURCES})
add_library(vtx_io)
configureTarget(vtx_io)

file(GLOB_RECURSE HEADERS include/*)
Expand Down
16 changes: 10 additions & 6 deletions lib/renderer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
message("vtx_renderer")
cmake_minimum_required(VERSION 3.23)
include(../util/cmake/configure-target.cmake)
include(cmake/configure-target.cmake)
project(vtx_renderer)

find_package(vtx_util CONFIG REQUIRED)

add_library(vtx_renderer)
configureTarget(vtx_renderer)

file(GLOB_RECURSE HEADERS include/*)
file(GLOB_RECURSE SOURCES src/*)
file(GLOB_RECURSE VENDORS vendor/*)
target_sources(vtx_renderer
PRIVATE ${SOURCES}
PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS include FILES ${HEADERS}
PUBLIC FILE_SET public_vendors TYPE HEADERS BASE_DIRS vendor FILES ${VENDORS})

add_library(vtx_renderer STATIC ${HEADERS} ${SOURCES} ${VENDORS})
configureTarget(vtx_renderer)
target_include_directories(vtx_renderer PUBLIC include)
target_include_directories(vtx_renderer PUBLIC vendor)
target_link_libraries(vtx_renderer PRIVATE vtx_util::vtx_util)

target_link_libraries(vtx_renderer PRIVATE vtx_util::vtx_util)
install(TARGETS vtx_renderer FILE_SET public_headers FILE_SET public_vendors)
19 changes: 19 additions & 0 deletions lib/renderer/bench/cmake/configure-target.cmake
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()
19 changes: 19 additions & 0 deletions lib/renderer/cmake/configure-target.cmake
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()
2 changes: 1 addition & 1 deletion lib/renderer/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class VTXRendererRecipe(ConanFile):

generators = "CMakeDeps", "CMakeToolchain"

#exports_sources = "CMakeLists.txt", "src/*", "include/*, vendor/*"
exports_sources = "CMakeLists.txt", "src/*", "include/*", "cmake/*", "vendor/*"

def requirements(self):
self.requires("vtx_util/1.0")
Expand Down
6 changes: 5 additions & 1 deletion lib/renderer/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
message("vtx_renderer_test")
cmake_minimum_required(VERSION 3.23)
include(cmake/configure-target.cmake)
project(vtx_renderer_test)

find_package(vtx_util CONFIG REQUIRED)
find_package(vtx_renderer CONFIG REQUIRED)
find_package(Catch2 REQUIRED)

add_executable(vtx_renderer_test src/main.cpp)
configureTarget(vtx_renderer_test)

target_link_libraries(vtx_renderer_test PRIVATE vtx_util::vtx_util)
target_link_libraries(vtx_renderer_test PRIVATE vtx_renderer::vtx_renderer)
target_link_libraries(vtx_renderer_test PRIVATE Catch2::Catch2WithMain)

include(CTest)
include(Catch)
catch_discover_tests(vtx_renderer_test)
catch_discover_tests(vtx_renderer_test)

install(TARGETS vtx_renderer_test)
19 changes: 19 additions & 0 deletions lib/renderer/test/cmake/configure-target.cmake
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()
14 changes: 13 additions & 1 deletion lib/renderer/test/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
from conan.tools.cmake import cmake_layout, CMake

class VTXRendererTestRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
name = "vtx_renderer_test"
version = "1.0"
package_type = "application"

settings = "os", "compiler", "build_type", "arch"

generators = "CMakeToolchain", "CMakeDeps"

exports_sources = "CMakeLists.txt", "src/*", "cmake/*"

def requirements(self):
self.requires("vtx_util/1.0")
self.requires("vtx_renderer/1.0")
Expand All @@ -19,3 +24,10 @@ def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["vtx_renderer_test"]

0 comments on commit 35498e8

Please sign in to comment.