-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [magnum] Add recipe * remove non-ascii char * use build-module to populate some CMake variables * add suffix for debug libraries * gcc 4.9 is not supported * Update recipes/magnum/all/conanfile.py Co-authored-by: SSE4 <tomskside@gmail.com> * add with_gl_info option * add glfw application * let Conan manage the options * egl (running Linux) * CGL context * add glx and wgl contexts * added applications (macos perspective) * add executables * test executables (Macos) * testing in Linux (gcc10) * work on Windows, thanks @SSE4 * use windowless application to test * use naive test for linux * use c++11 * use naive testing * Apply suggestions from code review Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com> * add audio and al-info (tested in Linux) * rename 'with_xxxx' options to 'xxxx' * refactor 'target_gl' option, make it a choice one * use snake_case for option names * use snake_case for options for executables * enable audio importers * Apply suggestions from code review Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com> * capture proper exception * improve test_pkg comment Co-authored-by: SSE4 <tomskside@gmail.com> Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
- Loading branch information
1 parent
fbe15eb
commit a1d245e
Showing
8 changed files
with
896 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_subdirectory("source_subfolder") |
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,25 @@ | ||
|
||
# Here we are reproducing the variables and call performed by the FindMagnum.cmake provided by the library | ||
|
||
# Read flags from configuration | ||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../../include/Magnum/configure.h" _magnumConfigure) | ||
string(REGEX REPLACE ";" "\\\\;" _magnumConfigure "${_magnumConfigure}") | ||
string(REGEX REPLACE "\n" ";" _magnumConfigure "${_magnumConfigure}") | ||
set(_magnumFlags | ||
BUILD_DEPRECATED | ||
BUILD_STATIC | ||
BUILD_STATIC_UNIQUE_GLOBALS | ||
TARGET_GL | ||
TARGET_GLES | ||
TARGET_GLES2 | ||
TARGET_GLES3 | ||
TARGET_DESKTOP_GLES | ||
TARGET_WEBGL | ||
TARGET_HEADLESS | ||
TARGET_VK) | ||
foreach(_magnumFlag ${_magnumFlags}) | ||
list(FIND _magnumConfigure "#define MAGNUM_${_magnumFlag}" _magnum_${_magnumFlag}) | ||
if(NOT _magnum_${_magnumFlag} EQUAL -1) | ||
set(MAGNUM_${_magnumFlag} 1) | ||
endif() | ||
endforeach() |
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,4 @@ | ||
sources: | ||
"2020.06": | ||
url: "https://github.com/mosra/magnum/archive/refs/tags/v2020.06.tar.gz" | ||
sha256: "98dfe802e56614e4e6bf750d9b693de46a5ed0c6eb479b0268f1a20bf34268bf" |
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(Magnum REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} Magnum::Magnum) | ||
set_target_properties(${PROJECT_NAME} | ||
PROPERTIES | ||
CXX_STANDARD 11 | ||
CXX_STANDARD_REQUIRED ON | ||
CXX_EXTENSIONS OFF | ||
) | ||
|
||
|
||
# Run some executables (we can only be sure they exist if native build) | ||
if (EXEC_GL_INFO AND NOT CMAKE_CROSSCOMPILING) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} PRE_BUILD | ||
COMMAND Magnum::gl-info | ||
ARGS "--help" | ||
COMMENT "Running magnum-gl-info" | ||
) | ||
endif() | ||
|
||
if (EXEC_AL_INFO AND NOT CMAKE_CROSSCOMPILING) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} PRE_BUILD | ||
COMMAND Magnum::al-info | ||
ARGS "--help" | ||
COMMENT "Running magnum-al-info" | ||
) | ||
endif() | ||
|
||
if (EXEC_DISTANCEFIELDCONVERTER_INFO AND NOT CMAKE_CROSSCOMPILING) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} PRE_BUILD | ||
COMMAND Magnum::distancefieldconverter | ||
ARGS "--help" | ||
COMMENT "Running magnum-distancefieldconverter" | ||
) | ||
endif() | ||
|
||
if (EXEC_FONTCONVERTER_INFO AND NOT CMAKE_CROSSCOMPILING) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} PRE_BUILD | ||
COMMAND Magnum::fontconverter | ||
ARGS "--help" | ||
COMMENT "Running magnum-fontconverter" | ||
) | ||
endif() | ||
|
||
if (EXEC_IMAGECONVERTER_INFO AND NOT CMAKE_CROSSCOMPILING) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} PRE_BUILD | ||
COMMAND Magnum::imageconverter | ||
ARGS "--help" | ||
COMMENT "Running magnum-imageconverter" | ||
) | ||
endif() | ||
|
||
if (EXEC_SCENECONVERTER_INFO AND NOT CMAKE_CROSSCOMPILING) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} PRE_BUILD | ||
COMMAND Magnum::sceneconverter | ||
ARGS "--help" | ||
COMMENT "Running magnum-sceneconverter" | ||
) | ||
endif() |
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,41 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanException | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
@property | ||
def _executables(self): | ||
available = [] | ||
# (executable, option name) | ||
all_execs = (("gl-info", "gl_info"), | ||
("al-info", "al_info"), | ||
("distancefieldconverter", "distance_field_converter"), | ||
("fontconverter", "font_converter"), | ||
("imageconverter", "image_converter"), | ||
("sceneconverter", "scene_converter")) | ||
for executable, opt_name in all_execs: | ||
try: | ||
if getattr(self.options["magnum"], opt_name): | ||
available.append(executable) | ||
except ConanException: | ||
pass | ||
return available | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
for exec in self._executables: | ||
cmake.definitions["EXEC_{}".format(exec.replace("-", "_")).upper()] = True | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
for exec in self._executables: | ||
self.run("magnum-{} --help".format(exec), run_environment=True) | ||
|
||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
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,21 @@ | ||
#include <iostream> | ||
#include "Magnum/Math/Vector.h" | ||
#include "Magnum/Math/StrictWeakOrdering.h" | ||
|
||
/* | ||
I would like to use some windowless application to test, like | ||
https://github.com/mosra/magnum-bootstrap/tree/windowless | ||
but it doesn't work in CI, it complains about EGL_NOT_INITIALIZED | ||
(headless machine?) | ||
*/ | ||
|
||
int main() { | ||
const Magnum::Math::Vector<2, Magnum::Float> v2a{1.0f, 2.0f}; | ||
const Magnum::Math::Vector<2, Magnum::Float> v2b{2.0f, 3.0f}; | ||
const Magnum::Math::Vector<2, Magnum::Float> v2c{1.0f, 3.0f}; | ||
|
||
Magnum::Math::StrictWeakOrdering o; | ||
if (o(v2a, v2b)) { | ||
std::cout << "Magnum working\n"; | ||
} | ||
} |
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,3 @@ | ||
versions: | ||
"2020.06": | ||
folder: all |