qbsp: refactor cmake setup

This commit is contained in:
Eric Wasylishen 2017-04-28 13:04:12 -06:00
parent 64efc77055
commit 8f4b506608
5 changed files with 79 additions and 54 deletions

View File

@ -31,6 +31,56 @@ set(COMMON_INCLUDES
${CMAKE_SOURCE_DIR}/include/common/wadlib.hh ${CMAKE_SOURCE_DIR}/include/common/wadlib.hh
${CMAKE_SOURCE_DIR}/include/common/bsputils.hh) ${CMAKE_SOURCE_DIR}/include/common/bsputils.hh)
set(QBSP_INCLUDES
${CMAKE_SOURCE_DIR}/include/qbsp/bspfile.hh
${CMAKE_SOURCE_DIR}/include/qbsp/file.hh
${CMAKE_SOURCE_DIR}/include/qbsp/parser.hh
${CMAKE_SOURCE_DIR}/include/qbsp/qbsp.hh
${CMAKE_SOURCE_DIR}/include/qbsp/wad.hh
${CMAKE_SOURCE_DIR}/include/qbsp/warnerr.hh
${CMAKE_SOURCE_DIR}/include/qbsp/brush.hh
${CMAKE_SOURCE_DIR}/include/qbsp/csg4.hh
${CMAKE_SOURCE_DIR}/include/qbsp/map.hh
${CMAKE_SOURCE_DIR}/include/qbsp/winding.hh
${CMAKE_SOURCE_DIR}/include/qbsp/merge.hh
${CMAKE_SOURCE_DIR}/include/qbsp/outside.hh
${CMAKE_SOURCE_DIR}/include/qbsp/portals.hh
${CMAKE_SOURCE_DIR}/include/qbsp/region.hh
${CMAKE_SOURCE_DIR}/include/qbsp/solidbsp.hh
${CMAKE_SOURCE_DIR}/include/qbsp/surfaces.hh
${CMAKE_SOURCE_DIR}/include/qbsp/tjunc.hh
${CMAKE_SOURCE_DIR}/include/qbsp/util.hh
${CMAKE_SOURCE_DIR}/include/qbsp/writebsp.hh)
set(QBSP_SOURCES
${CMAKE_SOURCE_DIR}/common/threads.cc
${CMAKE_SOURCE_DIR}/common/cmdlib.cc
${CMAKE_SOURCE_DIR}/common/log.cc
${CMAKE_SOURCE_DIR}/common/qvec.cc
${CMAKE_SOURCE_DIR}/common/mathlib.cc
${CMAKE_SOURCE_DIR}/common/polylib.cc
${CMAKE_SOURCE_DIR}/qbsp/brush.cc
${CMAKE_SOURCE_DIR}/qbsp/bspfile.cc
${CMAKE_SOURCE_DIR}/qbsp/csg4.cc
${CMAKE_SOURCE_DIR}/qbsp/file.cc
${CMAKE_SOURCE_DIR}/qbsp/globals.cc
${CMAKE_SOURCE_DIR}/qbsp/map.cc
${CMAKE_SOURCE_DIR}/qbsp/merge.cc
${CMAKE_SOURCE_DIR}/qbsp/outside.cc
${CMAKE_SOURCE_DIR}/qbsp/parser.cc
${CMAKE_SOURCE_DIR}/qbsp/portals.cc
${CMAKE_SOURCE_DIR}/qbsp/qbsp.cc
${CMAKE_SOURCE_DIR}/qbsp/solidbsp.cc
${CMAKE_SOURCE_DIR}/qbsp/surfaces.cc
${CMAKE_SOURCE_DIR}/qbsp/tjunc.cc
${CMAKE_SOURCE_DIR}/qbsp/util.cc
${CMAKE_SOURCE_DIR}/qbsp/wad.cc
${CMAKE_SOURCE_DIR}/qbsp/winding.cc
${CMAKE_SOURCE_DIR}/qbsp/writebsp.cc
${CMAKE_SOURCE_DIR}/qbsp/exportobj.cc
${COMMON_INCLUDES}
${QBSP_INCLUDES})
find_package (Threads) find_package (Threads)
if (CMAKE_USE_PTHREADS_INIT) if (CMAKE_USE_PTHREADS_INIT)

View File

@ -349,6 +349,7 @@ extern options_t options;
#include <qbsp/map.hh> #include <qbsp/map.hh>
#include <qbsp/util.hh> #include <qbsp/util.hh>
int qbsp_main(int argc, const char **argv);
void ProcessEntity(mapentity_t *entity, const int hullnum); void ProcessEntity(mapentity_t *entity, const int hullnum);
void CreateSingleHull(const int hullnum); void CreateSingleHull(const int hullnum);
void CreateHulls(void); void CreateHulls(void);

View File

@ -1,58 +1,8 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8)
project (qbsp CXX) project (qbsp CXX)
set(QBSP_INCLUDES
${CMAKE_SOURCE_DIR}/include/qbsp/bspfile.hh
${CMAKE_SOURCE_DIR}/include/qbsp/file.hh
${CMAKE_SOURCE_DIR}/include/qbsp/parser.hh
${CMAKE_SOURCE_DIR}/include/qbsp/qbsp.hh
${CMAKE_SOURCE_DIR}/include/qbsp/wad.hh
${CMAKE_SOURCE_DIR}/include/qbsp/warnerr.hh
${CMAKE_SOURCE_DIR}/include/qbsp/brush.hh
${CMAKE_SOURCE_DIR}/include/qbsp/csg4.hh
${CMAKE_SOURCE_DIR}/include/qbsp/map.hh
${CMAKE_SOURCE_DIR}/include/qbsp/winding.hh
${CMAKE_SOURCE_DIR}/include/qbsp/merge.hh
${CMAKE_SOURCE_DIR}/include/qbsp/outside.hh
${CMAKE_SOURCE_DIR}/include/qbsp/portals.hh
${CMAKE_SOURCE_DIR}/include/qbsp/region.hh
${CMAKE_SOURCE_DIR}/include/qbsp/solidbsp.hh
${CMAKE_SOURCE_DIR}/include/qbsp/surfaces.hh
${CMAKE_SOURCE_DIR}/include/qbsp/tjunc.hh
${CMAKE_SOURCE_DIR}/include/qbsp/util.hh
${CMAKE_SOURCE_DIR}/include/qbsp/writebsp.hh)
set(QBSP_SOURCES
${CMAKE_SOURCE_DIR}/common/threads.cc
${CMAKE_SOURCE_DIR}/common/cmdlib.cc
${CMAKE_SOURCE_DIR}/common/log.cc
${CMAKE_SOURCE_DIR}/common/qvec.cc
${CMAKE_SOURCE_DIR}/common/mathlib.cc
${CMAKE_SOURCE_DIR}/common/polylib.cc
brush.cc
bspfile.cc
csg4.cc
file.cc
globals.cc
map.cc
merge.cc
outside.cc
parser.cc
portals.cc
qbsp.cc
solidbsp.cc
surfaces.cc
tjunc.cc
util.cc
wad.cc
winding.cc
writebsp.cc
exportobj.cc
${COMMON_INCLUDES}
${QBSP_INCLUDES})
add_definitions(-DDOUBLEVEC_T) add_definitions(-DDOUBLEVEC_T)
add_executable(qbsp ${QBSP_SOURCES}) add_executable(qbsp ${QBSP_SOURCES} main.cc)
target_link_libraries(qbsp ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(qbsp ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS qbsp RUNTIME DESTINATION bin) install(TARGETS qbsp RUNTIME DESTINATION bin)

25
qbsp/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 <qbsp/qbsp.hh>
int main(int argc, const char **argv)
{
return qbsp_main(argc, argv);
}

View File

@ -849,7 +849,7 @@ InitQBSP
================== ==================
*/ */
static void static void
InitQBSP(int argc, char **argv) InitQBSP(int argc, const char **argv)
{ {
int i; int i;
char *szBuf; char *szBuf;
@ -944,8 +944,7 @@ InitQBSP(int argc, char **argv)
main main
================== ==================
*/ */
int int qbsp_main(int argc, const char **argv)
main(int argc, char **argv)
{ {
double start, end; double start, end;