Make inclusions to vectorwrapper through generated headers.

This way cloonelgraphics includes headers using the absolute path
and should be usable from other projecs. Setting
CLOONEL_SRC_DIR to the path to cloonel's top-level cmake file is
now compulsory.
This commit is contained in:
King_DuckZ 2017-03-16 21:32:35 +00:00
parent 19db180460
commit c30b4e430e
5 changed files with 131 additions and 2 deletions

View file

@ -0,0 +1,36 @@
/*
Copyright 2014 Michele "King_DuckZ" Santullo
This file is part of CloonelJump.
CloonelJump is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CloonelJump is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CloonelJump. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
//See vectorwrapper.hpp.in for comments
#if defined(VWR_OUTER_NAMESPACE)
# define OLD_VWR_OUTER_NAMESPACE VWR_OUTER_NAMESPACE
# undef VWR_OUTER_NAMESPACE
#endif
#define VWR_OUTER_NAMESPACE cloonel
#include "@CMAKE_CURRENT_SOURCE_DIR@/../../lib/vectorwrapper/include/vectorwrapper/vector_cast.hpp"
#undef VWR_OUTER_NAMESPACE
#if defined(OLD_VWR_OUTER_NAMESPACE)
# define VWR_OUTER_NAMESPACE OLD_VWR_OUTER_NAMESPACE
# undef OLD_VWR_OUTER_NAMESPACE
#endif

View file

@ -0,0 +1,36 @@
/*
Copyright 2014 Michele "King_DuckZ" Santullo
This file is part of CloonelJump.
CloonelJump is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CloonelJump is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CloonelJump. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
//See vectorwrapper.hpp.in for comments
#if defined(VWR_OUTER_NAMESPACE)
# define OLD_VWR_OUTER_NAMESPACE VWR_OUTER_NAMESPACE
# undef VWR_OUTER_NAMESPACE
#endif
#define VWR_OUTER_NAMESPACE cloonel
#include "@CMAKE_CURRENT_SOURCE_DIR@/../../lib/vectorwrapper/include/vectorwrapper/vectorops.hpp"
#undef VWR_OUTER_NAMESPACE
#if defined(OLD_VWR_OUTER_NAMESPACE)
# define VWR_OUTER_NAMESPACE OLD_VWR_OUTER_NAMESPACE
# undef OLD_VWR_OUTER_NAMESPACE
#endif

View file

@ -0,0 +1,45 @@
/*
Copyright 2014 Michele "King_DuckZ" Santullo
This file is part of CloonelJump.
CloonelJump is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CloonelJump is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CloonelJump. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
//The reason for this file is that I want to force cloonelgraphics to use the
//version of vectorwrapper that it's bundled with in git. When it's used as a
//library into a project different than clooneljump, the outer project will
//probably have its own version of vectorwrapper, and likely in a different
//outer namespace. Since both sdlmain.hpp, for example, and some hypotetical
//mygame.cpp from the client code will both #include
//"vectorwrapper/vectorwrapper.hpp", the search paths at the time mygame.cpp is
//built will be different than the one used by cloonelgraphics. By putting an
//absolute path here and forcing the outer namespace to cloonel this problem
//should be avoided.
#if defined(VWR_OUTER_NAMESPACE)
# define OLD_VWR_OUTER_NAMESPACE VWR_OUTER_NAMESPACE
# undef VWR_OUTER_NAMESPACE
#endif
#define VWR_OUTER_NAMESPACE cloonel
#include "@CMAKE_CURRENT_SOURCE_DIR@/../../lib/vectorwrapper/include/vectorwrapper/vectorwrapper.hpp"
#undef VWR_OUTER_NAMESPACE
#if defined(OLD_VWR_OUTER_NAMESPACE)
# define VWR_OUTER_NAMESPACE OLD_VWR_OUTER_NAMESPACE
# undef OLD_VWR_OUTER_NAMESPACE
#endif

View file

@ -21,8 +21,8 @@ target_include_directories(${PROJECT_NAME}
PRIVATE ${PNG_INCLUDE_DIRS}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${PHYSFS_INCLUDE_DIR}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vectorwrapper_include
PUBLIC ../../lib/tree-3.1/src
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include
)
target_compile_definitions(${PROJECT_NAME}
@ -32,3 +32,16 @@ target_compile_definitions(${PROJECT_NAME}
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
configure_file(
${CLOONEL_SRC_DIR}/cloonel_vectorwrapper/vectorwrapper.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/cloonel_vectorwrapper/vectorwrapper.hpp
)
configure_file(
${CLOONEL_SRC_DIR}/cloonel_vectorwrapper/vector_cast.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/cloonel_vectorwrapper/vector_cast.hpp
)
configure_file(
${CLOONEL_SRC_DIR}/cloonel_vectorwrapper/vectorops.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/cloonel_vectorwrapper/vectorops.hpp
)

View file

@ -1 +0,0 @@
../../../lib/vectorwrapper/include/vectorwrapper-1.0