Skip to content

Commit

Permalink
2262: fix build issues on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kduske committed Sep 18, 2019
1 parent 7299f5c commit fd5e095
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 27 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Using TARGET_LINK_LIBRARY to link an object library to qt requires 3.12
cmake_minimum_required(VERSION 3.12)
# Using target_link_options requires Cmake 3.13
cmake_minimum_required(VERSION 3.13)

# Configure CCache if available
find_program(CCACHE_FOUND ccache)
Expand Down Expand Up @@ -63,6 +64,7 @@ get_git_describe("${GIT_EXECUTABLE}" "${CMAKE_SOURCE_DIR}" GIT_DESCRIBE)
get_app_version(GIT_DESCRIBE APP_VERSION_YEAR APP_VERSION_NUMBER)
set(APP_BUILD_TYPE "${CMAKE_BUILD_TYPE}")

# Some global variables used in several targets
set(APP_DIR "${CMAKE_SOURCE_DIR}/app")
set(APP_RESOURCE_DIR "${APP_DIR}/resources")

Expand Down
8 changes: 3 additions & 5 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ endif()

# Set up resource compilation for Windows
if(WIN32)
# Create the cmake script for generating the resource file information
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateResourceFile.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/GenerateResourceFile.cmake" @ONLY)
add_custom_target(generate_resource_file ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/GenerateResourceFile.cmake")
add_dependencies(common generate_resource_file)
# Create the windows resource file
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/TrenchBroom.rc.in" "${CMAKE_CURRENT_BINARY_DIR}/TrenchBroom.rc" @ONLY)

if(COMPILER_IS_MSVC)
set(APP_SOURCE ${APP_SOURCE} "${APP_SOURCE_DIR}/TrenchBroom.rc")
set(APP_SOURCE ${APP_SOURCE} "${CMAKE_CURRENT_BINARY_DIR}/TrenchBroom.rc")
elseif(MINGW)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
Expand Down
7 changes: 0 additions & 7 deletions app/cmake/GenerateResourceFile.cmake.in

This file was deleted.

14 changes: 8 additions & 6 deletions app/cmake/TrenchBroom.rc.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
AAAAAAAA ICON "../resources/win32/icons/AppIcon.ico"
APPICON ICON "../resources/win32/icons/DocIcon.ico"
#include "@CMAKE_BINARY_DIR@/common/Version.h"

AAAAAAAA ICON "@APP_RESOURCE_DIR@/win32/icons/AppIcon.ico"
APPICON ICON "@APP_RESOURCE_DIR@/win32/icons/DocIcon.ico"

1 VERSIONINFO
FILEVERSION @APP_VERSION_YEAR@,@APP_VERSION_NUMBER@
PRODUCTVERSION @APP_VERSION_YEAR@,@APP_VERSION_NUMBER@
FILEVERSION VERSION_RC
PRODUCTVERSION VERSION_RC
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -20,12 +22,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Kristian Duske"
VALUE "FileDescription", "TrenchBroom Level Editor"
VALUE "FileVersion", @APP_VERSION_YEAR@,@APP_VERSION_NUMBER@
VALUE "FileVersion", VERSION_RC
VALUE "InternalName", "TrenchBroom.exe"
VALUE "LegalCopyright", "Copyright (C) 2010-2018"
VALUE "OriginalFilename", "TrenchBroom.exe"
VALUE "ProductName", "TrenchBroom"
VALUE "ProductVersion", "@APP_VERSION_YEAR@.@APP_VERSION_NUMBER@"
VALUE "ProductVersion", VERSION_STR
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ elseif(COMPILER_IS_MSVC)
# Request 8MB stack on Windows.
# Default is 1MB and we need more for our current AABB builder on large maps (https://github.com/kduske/TrenchBroom/issues/2803)
set(TB_STACK_SIZE 8388608)
target_compile_options(common INTERFACE "/STACK:${TB_STACK_SIZE}")
target_link_options(common PUBLIC "/STACK:${TB_STACK_SIZE}")
else()
message(FATAL_ERROR "Cannot set compile options for target common")
endif()
Expand Down
2 changes: 1 addition & 1 deletion common/cmake/GenerateVersion.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include(../../cmake/Utils.cmake)
include(@CMAKE_SOURCE_DIR@/cmake/Utils.cmake)

get_git_describe("@GIT_EXECUTABLE@" "@CMAKE_SOURCE_DIR@" GIT_DESCRIBE)
get_app_version(GIT_DESCRIBE APP_VERSION_YEAR APP_VERSION_NUMBER)
Expand Down
2 changes: 1 addition & 1 deletion common/src/View/ViewPreferencePane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ namespace TrenchBroom {


void ViewPreferencePane::layoutChanged(const int index) {
assert(index >= 0 && index < static_cast<int>(NumFrameLayouts));
assert(index >= 0 && index < 4);

auto& prefs = PreferenceManager::instance();
prefs.set(Preferences::MapViewLayout, index);
Expand Down
4 changes: 2 additions & 2 deletions lib/glew/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ set(LIB_GLEW_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIB_GLEW_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(LIB_GLEW_SOURCE "${LIB_GLEW_SOURCE_DIR}/glew.c")

add_library(glew ${LIB_GLEW_SOURCE})
add_library(glew STATIC ${LIB_GLEW_SOURCE})
target_compile_options(glew PRIVATE -w) # supress all warnings
target_compile_definitions(glew PRIVATE GLEW_STATIC)
target_compile_definitions(glew PUBLIC GLEW_STATIC)
target_include_directories(glew
SYSTEM PUBLIC
$<BUILD_INTERFACE:${LIB_GLEW_INCLUDE_DIR}>
Expand Down
2 changes: 1 addition & 1 deletion lib/miniz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(LIB_MINIZ_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIB_MINIZ_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(LIB_MINIZ_SOURCE "${LIB_MINIZ_SOURCE_DIR}/miniz.c")

add_library(miniz ${LIB_MINIZ_SOURCE})
add_library(miniz STATIC ${LIB_MINIZ_SOURCE})
target_compile_options(miniz PRIVATE -w) # supress all warnings
target_include_directories(miniz
PRIVATE ${LIB_MINIZ_INCLUDE_DIR}/miniz
Expand Down
2 changes: 1 addition & 1 deletion lib/stackwalker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if (COMPILER_IS_MSVC)
set(LIB_STACKWALKER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(LIB_STACKWALKER_SOURCE "${LIB_STACKWALKER_SOURCE_DIR}/StackWalker.cpp")

add_library(stackwalker ${LIB_STACKWALKER_SOURCE})
add_library(stackwalker STATIC ${LIB_STACKWALKER_SOURCE})
target_compile_options(stackwalker PRIVATE -w) # supress all warnings
target_include_directories(stackwalker
PRIVATE ${LIB_STACKWALKER_INCLUDE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion lib/tinyxml2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(LIB_TINYXML2_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIB_TINYXML2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(LIB_TINYXML2_SOURCE "${LIB_TINYXML2_SOURCE_DIR}/tinyxml2.cpp")

add_library(tinyxml2 ${LIB_TINYXML2_SOURCE})
add_library(tinyxml2 STATIC ${LIB_TINYXML2_SOURCE})
target_compile_options(tinyxml2 PRIVATE -w) # supress all warnings
target_include_directories(tinyxml2
PRIVATE ${LIB_TINYXML2_INCLUDE_DIR}/tinyxml2
Expand Down

0 comments on commit fd5e095

Please sign in to comment.