light: add "testlight" target

This commit is contained in:
Eric Wasylishen 2016-08-15 21:18:14 -06:00
parent cb85ca74c4
commit 5e9b62dc8b
5 changed files with 53 additions and 2 deletions

View File

@ -394,5 +394,6 @@ const vec_t *GetSurfaceVertexNormal(const bsp2_t *bsp, const bsp2_dface_t *f, co
const bsp2_dface_t *Face_EdgeIndexSmoothed(const bsp2_t *bsp, const bsp2_dface_t *f, const int edgeindex);
const std::vector<bouncelight_t> &BounceLights();
bool Leaf_HasSky(const bsp2_t *bsp, const bsp2_dleaf_t *leaf);
int light_main(int argc, const char **argv);
#endif /* __LIGHT_LIGHT_H__ */

View File

@ -42,7 +42,7 @@ if (embree_FOUND)
endif(embree_FOUND)
add_executable(light ${LIGHT_SOURCES})
add_executable(light ${LIGHT_SOURCES} main.cc)
target_link_libraries (light ${CMAKE_THREAD_LIBS_INIT})
if (embree_FOUND)
@ -87,3 +87,22 @@ endif(embree_FOUND)
install(TARGETS light RUNTIME DESTINATION bin)
install(FILES ${CMAKE_SOURCE_DIR}/gpl_v3.txt DESTINATION bin)
# test
set(GOOGLETEST_SOURCES ${CMAKE_SOURCE_DIR}/3rdparty/googletest/src/gtest-all.cc)
include_directories(${CMAKE_SOURCE_DIR}/3rdparty/googletest/include)
include_directories(${CMAKE_SOURCE_DIR}/3rdparty/googletest)
set(LIGHT_TEST_SOURCE
${LIGHT_SOURCES}
${GOOGLETEST_SOURCES}
test.cc)
add_executable(testlight ${LIGHT_TEST_SOURCE})
target_link_libraries (testlight ${CMAKE_THREAD_LIBS_INIT})
if (embree_FOUND)
target_link_libraries (testlight ${EMBREE_LIBRARY})
add_definitions(-DHAVE_EMBREE)
endif (embree_FOUND)

View File

@ -1346,7 +1346,7 @@ static const char *ParseString(int *i_inout, int argc, const char **argv)
* ==================
*/
int
main(int argc, const char **argv)
light_main(int argc, const char **argv)
{
bspdata_t bspdata;
bsp2_t *const bsp = &bspdata.data.bsp2;

25
light/main.cc Normal file
View File

@ -0,0 +1,25 @@
/* Copyright (C) 1996-1997 Id Software, Inc.
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See file, 'COPYING', for details.
*/
#include <light/light.hh>
int main(int argc, const char **argv)
{
return light_main(argc, argv);
}

6
light/test.cc Normal file
View File

@ -0,0 +1,6 @@
#include "gtest/gtest.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}