Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMake issues with Program Files (x86) escaping + recursively called message func #191

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/**********************************************************\
#/**********************************************************\
#Original Author: Richard Bateman (taxilian)
#
#Created: Nov 20, 2009
Expand All @@ -8,7 +8,7 @@
# - or -
# GNU Lesser General Public License, version 2.1
# http://www.gnu.org/licenses/lgpl-2.1.html
#
#
#Copyright 2009 PacketPass, Inc and the Firebreath development team
#\**********************************************************/

Expand All @@ -21,6 +21,14 @@ if (CMAKE_MAJOR_VERSION GREATER 2)
cmake_policy(SET CMP0045 OLD)
endif()

# Output of messages will cause Jenkins to mistake it as an error and the build will fail
if(DEFINED SUPPRESS_MESSAGES AND SUPPRESS_MESSAGES)
function(message)

endfunction()
endif()


Project (FireBreath)

# Allow super-projects to disable firebreath-specific git operations.
Expand Down Expand Up @@ -49,9 +57,9 @@ file(REMOVE ${FB_EXPORT_FILE})
add_subdirectory(${FB_ROOT}/cmake ${FB_BUILD_DIR}/cmake_common)

#Visual Studio Express editions don't want Solution Folders enabled.
if(NOT ATL_LIBRARY)
if(NOT ATL_LIBRARY)
set_property(GLOBAL PROPERTY USE_FOLDERS On)
endif()
endif()

if (APPLE)
clear_xcode_patches()
Expand Down Expand Up @@ -131,7 +139,7 @@ if (NOT FB_RELEASE)
add_firebreath_plugin(${CURPROJECT} ${PROJNAME})
else()
# search the project src dir for plugin project directories
file (GLOB PLUGIN_PROJECTS
file (GLOB PLUGIN_PROJECTS
${FB_PROJECTS_DIR}/[^.]*
)

Expand Down
36 changes: 19 additions & 17 deletions cmake/Win.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/**********************************************************\
#/**********************************************************\
#Original Author: Richard Bateman (taxilian)
#
#Created: Jan 11, 2010
Expand All @@ -8,14 +8,16 @@
# - or -
# GNU Lesser General Public License, version 2.1
# http://www.gnu.org/licenses/lgpl-2.1.html
#
#
#Copyright 2009 PacketPass, Inc and the Firebreath development team
#\**********************************************************/

# Find ATL stuff

if (NOT VC_DIR)
if (MSVC12)
if (MSVC14)
GET_FILENAME_COMPONENT(VS_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\Setup\\VS;ProductDir]" REALPATH CACHE)
elseif (MSVC12)
GET_FILENAME_COMPONENT(VS_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VS;ProductDir]" REALPATH CACHE)
elseif (MSVC11)
GET_FILENAME_COMPONENT(VS_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir]" REALPATH CACHE)
Expand All @@ -32,7 +34,7 @@ if (NOT VC_DIR)
message("-- Visual Studio dir: ${VS_DIR}")
endif()
if (NOT ATL_INCLUDE_DIR)
set (DDK_SEARCH_PATHS
set (DDK_SEARCH_PATHS
"$ENV{DDK_PATH}"
"$ENV{SystemDrive}/WinDDK"
"$ENV{ProgramFiles}/WinDDK"
Expand Down Expand Up @@ -86,7 +88,7 @@ if (NOT ATL_INCLUDE_DIR)
NO_DEFAULT_PATH
)

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ATLLIB_GUESSES "${VC_DIR}/atlmfc/lib/amd64" ${ATLLIB_GUESSES})
else()
set(ATLLIB_GUESSES "${VC_DIR}/atlmfc/lib" ${ATLLIB_GUESSES})
Expand Down Expand Up @@ -270,27 +272,27 @@ function (add_wix_installer PROJNAME WIX_SOURCEFILES WIX_COMPGROUP WIX_OUTDIR WI
WIX_LINK(${PROJNAME}${FB_WIX_SUFFIX} ${WIX_DEST} WIX_FULLOBJLIST NONE)

ADD_DEPENDENCIES(${PROJNAME}${FB_WIX_SUFFIX} ${WIX_PROJDEP})

# Create the EXE wrapper

if (FB_WIX_EXEDEST)
SET (WIX_EXEDEST ${FB_WIX_EXEDEST})
else()
SET (WIX_EXEDEST ${WIX_OUTDIR}/${PROJNAME}.exe)
endif()

if (NOT FB_WIX_EXE_SUFFIX)
set (FB_WIX_EXE_SUFFIX _WiXInstallExe)
endif()

set (WIX_EXESOURCES
${FB_ROOT}/cmake/dummy.cpp
${WIX_DEST}
)
ADD_LIBRARY(${PROJNAME}${FB_WIX_EXE_SUFFIX} STATIC ${WIX_EXESOURCES})

WIX_SETUPBLD(${PROJNAME}${FB_WIX_EXE_SUFFIX} ${WIX_EXEDEST} ${WIX_DEST})

ADD_DEPENDENCIES(${PROJNAME}${FB_WIX_EXE_SUFFIX} ${PROJNAME}${FB_WIX_SUFFIX})
endif()
endfunction(add_wix_installer)
Expand All @@ -300,34 +302,34 @@ function (create_cab PROJNAME DDF CAB_SOURCEFILES CAB_OUTDIR PROJDEP)
configure_file(${DDF} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
message("Configuring ${DDF} -> ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File}")
set(CAB_DDF ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})

set(SOURCELIST ${CAB_DDF})
FOREACH(_curFile ${CAB_SOURCEFILES})
GET_FILENAME_COMPONENT(_tmp_File ${_curFile} NAME)
configure_file(${_curFile} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
message("Configuring ${_curFile} -> ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File}")
set(SOURCELIST ${SOURCELIST} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
ENDFOREACH()

set (WIX_SOURCES
${FB_ROOT}/cmake/dummy.cpp
${DDF}
${CAB_SOURCEFILES}
${SOURCELIST}
)

if (FB_CAB_DEST)
SET (CAB_DEST ${FB_CAB_DEST})
else()
SET (CAB_DEST ${CAB_OUTDIR}/${PROJNAME}.cab)
endif()

FILE(RELATIVE_PATH CAB_NAME ${CAB_OUTDIR} ${CAB_DEST})

if (NOT FB_CAB_SUFFIX)
set (FB_CAB_SUFFIX _Cab)
endif()

ADD_LIBRARY(${PROJNAME}${FB_CAB_SUFFIX} STATIC ${WIX_SOURCES})
ADD_CUSTOM_COMMAND( TARGET ${PROJNAME}${FB_CAB_SUFFIX} POST_BUILD
COMMAND ${CMAKE_MAKECAB}
Expand Down
15 changes: 10 additions & 5 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/**********************************************************\
#/**********************************************************\
#Original Author: Richard Bateman (taxilian)
#
#Created: Nov 20, 2009
Expand All @@ -8,10 +8,16 @@
# - or -
# GNU Lesser General Public License, version 2.1
# http://www.gnu.org/licenses/lgpl-2.1.html
#
#
#Copyright 2009 PacketPass, Inc and the Firebreath development team
#\**********************************************************/

# cmake --help-policy CMP0045
# Would require rewriting all expressions like **`get_target_property(VAR)` if (NOT VAR)**
# I'm not sure how to make it work with new cmake
cmake_policy(SET CMP0045 OLD)
set(_program_files_x86 "ProgramFiles(x86)")

# Previously we included this file all over the place; we should never
# do that anymore.
if (NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${FB_ROOT}")
Expand Down Expand Up @@ -112,7 +118,6 @@ macro (add_boost_library BOOST_LIB)
else()
list(APPEND Boost_INCLUDE_DIRS ${FB_BOOST_SOURCE_DIR})
list(REMOVE_DUPLICATES Boost_INCLUDE_DIRS)

list(APPEND Boost_LIBRARIES boost_${BOOST_LIB})
list(REMOVE_DUPLICATES Boost_LIBRARIES)
get_target_property(_BL_EXISTS boost_${BOOST_LIB} TYPE)
Expand Down Expand Up @@ -201,7 +206,7 @@ function(proxy_setup)
message("!!!! WARNING: HTTP_PROXY env var set, but we need HTTPS_PROXY. Attempting to use HTTP_PROXY FOR HTTPS_PROXY")
set(ENV{HTTPS_PROXY} ${HTTP_PROXY})
endif()

if(http_proxy AND NOT https_proxy)
message("!!!! WARNING: http_proxy env var set, but we need https_proxy. Attempting to use http_proxy FOR https_proxy")
set(ENV{https_proxy} ${http_proxy})
Expand Down Expand Up @@ -269,7 +274,7 @@ function (fb_check_boost)
WORKING_DIRECTORY "${FB_BOOST_SOURCE_DIR}"
OUTPUT_QUIET
)
file (GLOB TAR_FILE
file (GLOB TAR_FILE
${FB_BOOST_SOURCE_DIR}/*.tar
)
execute_process(
Expand Down
30 changes: 15 additions & 15 deletions cmake/wix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# The follwoing variables are optionally searched for defaults
# WIX_ROOT_DIR: Base directory of WIX2 tree to use.
#
# The following are set after configuration is done:
# The following are set after configuration is done:
# WIX_FOUND
# WIX_ROOT_DIR
# WIX_CANDLE
# WIX_LIGHT
#
#
# 2009/02 Petr Pytelka (pyta at lightcomp.cz)
#

Expand All @@ -33,23 +33,23 @@ if (WIN32)
"$ENV{ProgramFiles}/Windows Installer XML v3.6"
"$ENV{ProgramFiles}/WiX Toolset v3.6"
"$ENV{ProgramFiles}/WiX Toolset v3.7"
"$ENV{ProgramFiles(x86)}/Windows Installer XML"
"$ENV{ProgramFiles(x86)}/Windows Installer XML v3"
"$ENV{ProgramFiles(x86)}/Windows Installer XML v3.5"
"$ENV{ProgramFiles(x86)}/Windows Installer XML v3.6"
"$ENV{ProgramFiles(x86)}/WiX Toolset v3.6"
"$ENV{ProgramFiles(x86)}/WiX Toolset v3.7"
"$ENV{${_program_files_x86}}/Windows Installer XML"
"$ENV{${_program_files_x86}}/Windows Installer XML v3"
"$ENV{${_program_files_x86}}/Windows Installer XML v3.5"
"$ENV{${_program_files_x86}}/Windows Installer XML v3.6"
"$ENV{${_program_files_x86}}/WiX Toolset v3.6"
"$ENV{${_program_files_x86}}/WiX Toolset v3.7"
)


#DBG_MSG("DBG (WIX_POSSIBLE_ROOT_DIRS=${WIX_POSSIBLE_ROOT_DIRS}")

#
# select exactly ONE WIX base directory/tree
# select exactly ONE WIX base directory/tree
# to avoid mixing different version headers and libs
#
FIND_PATH(WIX_ROOT_DIR
NAMES
FIND_PATH(WIX_ROOT_DIR
NAMES
bin/candle.exe
bin/light.exe
bin/heat.exe
Expand Down Expand Up @@ -116,7 +116,7 @@ if (WIN32)
SET(EXT_FLAGS -ext WixUtilExtension)
SET(EXT_FLAGS ${EXT_FLAGS} -ext WixUIExtension)

ADD_CUSTOM_COMMAND(
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_WIXOBJ}
COMMAND ${WIX_CANDLE}
ARGS ${WIX_CANDLE_FLAGS} ${EXT_FLAGS} ${SOURCE_WIX_FILE}
Expand Down Expand Up @@ -153,7 +153,7 @@ if (WIN32)
DBG_MSG("WIX output: ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_WIXOBJ}")
DBG_MSG("WIX command: ${WIX_HEAT}")

ADD_CUSTOM_COMMAND(
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_WIXOBJ}
COMMAND ${WIX_HEAT}
ARGS file ${SOURCE_WIX_FILE}
Expand All @@ -179,7 +179,7 @@ if (WIN32)
SET(EXT_FLAGS -ext WixUtilExtension)
SET(EXT_FLAGS ${EXT_FLAGS} -ext WixUIExtension)

ADD_CUSTOM_COMMAND(
ADD_CUSTOM_COMMAND(
OUTPUT ${_target}
COMMAND ${WIX_CANDLE}
ARGS ${WIX_CANDLE_FLAGS} ${EXT_FLAGS} -out "${_target}" ${${_sources}}
Expand Down Expand Up @@ -219,7 +219,7 @@ if (WIN32)
)

ENDMACRO(WIX_LINK)

#
# Create
#
Expand Down
7 changes: 7 additions & 0 deletions prep2015.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off & setlocal enableextensions enabledelayedexpansion

set _FB_GEN="Visual Studio 14"

call "%~d0%~p0\common.cmd" %*
if %errorlevel% == 2 exit /b 1
call "%~d0%~p0\winprep.cmd"
7 changes: 7 additions & 0 deletions prep2015x64.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off & setlocal enableextensions enabledelayedexpansion

set _FB_GEN="Visual Studio 14 Win64"

call "%~d0%~p0\common.cmd" %*
if %errorlevel% == 2 exit /b 1
call "%~d0%~p0\winprep.cmd"
7 changes: 7 additions & 0 deletions prep2017.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off & setlocal enableextensions enabledelayedexpansion

set _FB_GEN="Visual Studio 15"

call "%~d0%~p0\common.cmd" %*
if %errorlevel% == 2 exit /b 1
call "%~d0%~p0\winprep.cmd"
7 changes: 7 additions & 0 deletions prep2017x64.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off & setlocal enableextensions enabledelayedexpansion

set _FB_GEN="Visual Studio 15 Win64"

call "%~d0%~p0\common.cmd" %*
if %errorlevel% == 2 exit /b 1
call "%~d0%~p0\winprep.cmd"