From 8f4b506608a6bff94652f06668b464798c87e6df Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 28 Apr 2017 13:04:12 -0600 Subject: [PATCH] qbsp: refactor cmake setup --- CMakeLists.txt | 50 ++++++++++++++++++++++++++++++++++++++++++ include/qbsp/qbsp.hh | 1 + qbsp/CMakeLists.txt | 52 +------------------------------------------- qbsp/main.cc | 25 +++++++++++++++++++++ qbsp/qbsp.cc | 5 ++--- 5 files changed, 79 insertions(+), 54 deletions(-) create mode 100644 qbsp/main.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index eb51b467..e5b09380 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,56 @@ set(COMMON_INCLUDES ${CMAKE_SOURCE_DIR}/include/common/wadlib.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) if (CMAKE_USE_PTHREADS_INIT) diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 5407c632..9c434991 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -349,6 +349,7 @@ extern options_t options; #include #include +int qbsp_main(int argc, const char **argv); void ProcessEntity(mapentity_t *entity, const int hullnum); void CreateSingleHull(const int hullnum); void CreateHulls(void); diff --git a/qbsp/CMakeLists.txt b/qbsp/CMakeLists.txt index d96c80cb..6a1fbeb5 100644 --- a/qbsp/CMakeLists.txt +++ b/qbsp/CMakeLists.txt @@ -1,58 +1,8 @@ cmake_minimum_required (VERSION 2.8) 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_executable(qbsp ${QBSP_SOURCES}) +add_executable(qbsp ${QBSP_SOURCES} main.cc) target_link_libraries(qbsp ${CMAKE_THREAD_LIBS_INIT}) install(TARGETS qbsp RUNTIME DESTINATION bin) diff --git a/qbsp/main.cc b/qbsp/main.cc new file mode 100644 index 00000000..8142bc60 --- /dev/null +++ b/qbsp/main.cc @@ -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 + +int main(int argc, const char **argv) +{ + return qbsp_main(argc, argv); +} diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index b69e20b2..39538644 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -849,7 +849,7 @@ InitQBSP ================== */ static void -InitQBSP(int argc, char **argv) +InitQBSP(int argc, const char **argv) { int i; char *szBuf; @@ -944,8 +944,7 @@ InitQBSP(int argc, char **argv) main ================== */ -int -main(int argc, char **argv) +int qbsp_main(int argc, const char **argv) { double start, end;