Replace CMake build system with Meson
No I will not try and keep both systems working. CMake should GTFO.
This commit is contained in:
parent
bae77d38e8
commit
685b1b947d
44 changed files with 490 additions and 2347 deletions
280
CMakeLists.txt
280
CMakeLists.txt
|
@ -1,280 +0,0 @@
|
|||
project(taisei C)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
|
||||
set(PYTHON_VERSION_REQUIRED "3.4")
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(PythonInterp ${PYTHON_VERSION_REQUIRED})
|
||||
|
||||
if(PYTHON_VERSION_STRING AND PYTHON_VERSION_STRING VERSION_LESS ${PYTHON_VERSION_REQUIRED})
|
||||
# workaround for cmake retardation: if there's a bad entry in the cache, it won't bother trying to replace it.
|
||||
unset(PYTHON_EXECUTABLE CACHE)
|
||||
find_package(PythonInterp ${PYTHON_VERSION_REQUIRED})
|
||||
endif()
|
||||
|
||||
set(BUILDSCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/scripts")
|
||||
set(MISC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/misc")
|
||||
set(ICONS_DIR "${MISC_DIR}/icons")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${BUILDSCRIPTS_DIR}/cmake-modules")
|
||||
list(APPEND CMAKE_MODULE_PATH "${BUILDSCRIPTS_DIR}/cmake-modules/git")
|
||||
|
||||
include(GetGitRevisionDescription)
|
||||
|
||||
#
|
||||
# Set up version variables
|
||||
#
|
||||
|
||||
set(TAISEI_VERSION_FALLBACK "1.1.1")
|
||||
|
||||
function(taisei_parse_version version_string)
|
||||
string(STRIP ${version_string} version_string)
|
||||
set(version_string_orig ${version_string})
|
||||
string(SUBSTRING ${version_string} 0 1 first_char)
|
||||
|
||||
if(first_char STREQUAL "v")
|
||||
string(SUBSTRING ${version_string} 1 -1 version_string)
|
||||
endif()
|
||||
|
||||
string(REPLACE "+" "-" version_string ${version_string})
|
||||
string(REGEX REPLACE "-.*" "" version_string_tmp ${version_string})
|
||||
string(REGEX MATCH "-[0-9]+" version_string_extra ${version_string})
|
||||
|
||||
set(TAISEI_VERSION ${version_string} PARENT_SCOPE)
|
||||
set(TAISEI_VERSION_FULL_STR "Taisei v${version_string}" PARENT_SCOPE)
|
||||
|
||||
set(version_string ${version_string_tmp})
|
||||
|
||||
string(REPLACE "." ";" version_string_tmp ${version_string})
|
||||
|
||||
list(LENGTH version_string_tmp version_numelems)
|
||||
|
||||
if(version_numelems GREATER 3)
|
||||
message(FATAL_ERROR "Too many dot-separated elements in version string ${version_string_orig}, please use the following format: [v]major[.minor[.patch]][-tweak[extrainfo]]")
|
||||
endif()
|
||||
|
||||
while(version_numelems LESS 3)
|
||||
list(APPEND version_string_tmp 0)
|
||||
list(LENGTH version_string_tmp version_numelems)
|
||||
endwhile()
|
||||
|
||||
list(GET version_string_tmp 0 major)
|
||||
list(GET version_string_tmp 1 minor)
|
||||
list(GET version_string_tmp 2 patch)
|
||||
|
||||
set(TAISEI_VERSION_SIMPLE ${major}.${minor}.${patch} PARENT_SCOPE)
|
||||
|
||||
set(TAISEI_VERSION_MAJOR ${major} PARENT_SCOPE)
|
||||
set(TAISEI_VERSION_MINOR ${minor} PARENT_SCOPE)
|
||||
set(TAISEI_VERSION_PATCH ${patch} PARENT_SCOPE)
|
||||
set(TAISEI_VERSION_TWEAK 0 PARENT_SCOPE)
|
||||
|
||||
if(version_string_extra)
|
||||
string(SUBSTRING ${version_string_extra} 1 -1 version_string_extra)
|
||||
set(TAISEI_VERSION_TWEAK ${version_string_extra} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(TAISEI_VERSION_OVERRIDE)
|
||||
taisei_parse_version(${TAISEI_VERSION_OVERRIDE})
|
||||
message(STATUS "Version information manually overriden: v${TAISEI_VERSION}")
|
||||
else()
|
||||
git_describe(TAISEI_VERSION --tags --match "v[0-9]*[!a-z]")
|
||||
|
||||
if(TAISEI_VERSION STREQUAL "GIT-NOTFOUND")
|
||||
message(WARNING "Git is not installed. Version information will be less accurate.")
|
||||
set(TAISEI_VERSION ${TAISEI_VERSION_FALLBACK})
|
||||
elseif(TAISEI_VERSION STREQUAL "HEAD-HASH-NOTFOUND")
|
||||
message(WARNING "Source tree doesn't seem to be in a git repository. Version information will be less accurate.")
|
||||
set(TAISEI_VERSION ${TAISEI_VERSION_FALLBACK})
|
||||
endif()
|
||||
|
||||
taisei_parse_version(${TAISEI_VERSION})
|
||||
endif()
|
||||
|
||||
#
|
||||
# End of the version insanity
|
||||
#
|
||||
|
||||
if(DEFINED TAISEI_DEBUG)
|
||||
message(WARNING "You have TAISEI_DEBUG set, which overrides CMAKE_BUILD_TYPE. This is a deprecated option and you should not use it, unless maybe your cross-toolchain has a cmake wrapper that is doing something idiotic. Consider unsetting it with cmake -UTAISEI_DEBUG.")
|
||||
|
||||
# XXX: avoid using this unless you absolutely have to
|
||||
if(TAISEI_DEBUG)
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
message(STATUS ${TAISEI_VERSION_FULL_STR})
|
||||
message(STATUS "Build configuration: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
set(RELATIVE_DEFAULT ON)
|
||||
else()
|
||||
set(RELATIVE_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
option(RELATIVE "Use only relative paths to the executable and install everything in the same directory." ${RELATIVE_DEFAULT})
|
||||
option(USE_AUDIO "Build with audio support (SDL2_mixer)." ON)
|
||||
option(USE_ZIP "Build with .zip package support." ON)
|
||||
option(USE_CPACK "Add a 'package' target, used to prepare a release for binary distribution. Currently only used to create Windows installers. Requires CPack and NSIS." OFF)
|
||||
option(USE_INTEL_INTRIN "Use some x86-specific intrinsics for optimizations where appropriate (if possible). Note that this is not equivalent to e.g. supplying -march in CFLAGS." ON)
|
||||
option(DEBUG_USE_UBSAN "Enable the Undefined Behaviour Sanitizer (UBSan) in debug builds. Only disable if the compiler or target platform doesn't support it." ON)
|
||||
option(DEBUG_USE_ASAN "Enable the Address Sanitizer (ASan) and leak detection in debug builds." OFF)
|
||||
option(RELWITHDEBINFO_USE_DEBUG_FLAGS "Use debug flags in RelWithDebInfo builds (e.g. sanitizers)." OFF)
|
||||
option(RELEASE_USE_LTO "Enable Link Time Optimization in release builds." ON)
|
||||
option(PACKAGE_DATA "Package the game's assets into a compressed archive instead of bundling plain files. Requires USE_ZIP=ON." ON)
|
||||
option(PACKAGE_DATA_LEANIFY "Optimize the assets archive for size. This process can be very slow. Requires Leanify (https://github.com/JayXon/Leanify) and PACKAGE_DATA=ON." OFF)
|
||||
option(LINK_TO_LIBGL "Link to the OpenGL library instead of loading it at runtime. This is strongly discouraged, as it is not portable, and may not even work on some systems." OFF)
|
||||
option(WERROR "Treat compiler warnings as errors." OFF)
|
||||
option(FATALERRS "Abort compilation after first error is encountered." OFF)
|
||||
|
||||
if(APPLE)
|
||||
set(OSX_LIB_PATH "" CACHE STRING "Colon-separated list of paths from where required runtime libraries will be copied into the bundle.")
|
||||
set(OSX_TOOL_PATH "" CACHE STRING "Colon-separated list of paths from where macOS-specific library utilities (such as otool) can be found. This is prepended to PATH.")
|
||||
set(OSX_TOOL_PREFIX "" CACHE STRING "Names of macOS-specific tools are prefixed with this string (useful for cross-compiling).")
|
||||
endif()
|
||||
|
||||
if(LINK_TO_LIBGL)
|
||||
find_package(OpenGL REQUIRED)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(SDL2 sdl2>=2.0.5 REQUIRED)
|
||||
pkg_check_modules(SDL2_TTF SDL2_ttf REQUIRED)
|
||||
pkg_check_modules(ZLIB zlib REQUIRED)
|
||||
pkg_check_modules(PNG libpng>=1.5 REQUIRED)
|
||||
|
||||
if(USE_AUDIO)
|
||||
pkg_check_modules(SDL2_MIXER SDL2_mixer REQUIRED)
|
||||
endif()
|
||||
|
||||
# PACKAGE_DATA means we requested packaging; PACKAGE_DATA_SUPPORTED means it is supported at all.
|
||||
# So we should package if we requested it AND it is supported.
|
||||
# We will not check for support if packaging is not requested.
|
||||
set(PACKAGE_DATA_SUPPORTED ON)
|
||||
if(PACKAGE_DATA)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.3)
|
||||
message(WARNING "Your version of CMake is too old, so packaging of data will not be used. Upgrade CMake to at least version 3.3 to enable packaging or specify PACKAGE_DATA=OFF to avoid this warning.")
|
||||
set(PACKAGE_DATA_SUPPORTED OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# USE_ZIP means we would like to link to libzip; ZIP_SUPPORTED means libzip functionality is supported at all.
|
||||
# So we shouldn't use ZIP in code if we disabled it OR it is not supported.
|
||||
# We will not check for support if ZIP is disabled.
|
||||
set(ZIP_SUPPORTED ON)
|
||||
if(USE_ZIP)
|
||||
pkg_check_modules(ZIP libzip>=1.0)
|
||||
if(NOT ZIP_FOUND)
|
||||
message(WARNING "You have no suitable libzip, so packaging of data will not be used and ZIP support will be disabled. Install at least libzip 1.0 to enable ZIP support or specify USE_ZIP=ON to avoid this warning.")
|
||||
set(ZIP_SUPPORTED OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Obviously, we should not package data if we're compiling without ZIP support.
|
||||
if(NOT USE_ZIP OR NOT ZIP_SUPPORTED)
|
||||
if(NOT USE_ZIP AND PACKAGE_DATA AND PACKAGE_DATA_SUPPORTED)
|
||||
# It is not a hazardous situation, so we would not issue a warning, only status message.
|
||||
message(STATUS "You have disabled ZIP support, packaging of data will not be used.")
|
||||
endif()
|
||||
set(PACKAGE_DATA_SUPPORTED OFF)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(RELATIVE)
|
||||
add_definitions(-DRELATIVE)
|
||||
set(DOC_DIR .)
|
||||
|
||||
if(APPLE)
|
||||
set(RES_DIR "Taisei.app/Contents/Resources")
|
||||
set(DATA_DIR "${RES_DIR}/data")
|
||||
install(FILES "${ICONS_DIR}/taisei.icns" DESTINATION "${RES_DIR}" RENAME "Taisei.icns")
|
||||
else()
|
||||
set(DATA_DIR "data")
|
||||
endif()
|
||||
else()
|
||||
set(DATA_DIR "share/taisei")
|
||||
set(DOC_DIR "share/doc/taisei")
|
||||
|
||||
install(DIRECTORY "xdg/" DESTINATION ".")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(DOC_FILES "STORY.txt" "GAME.md" "COPYING" "misc/README_installed.txt")
|
||||
set(DOC_TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/win32docs")
|
||||
|
||||
configure_file(
|
||||
"${BUILDSCRIPTS_DIR}/Win32FixDocs.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Win32FixDocs.cmake"
|
||||
@ONLY)
|
||||
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/Win32FixDocs.cmake")
|
||||
set(DOC_SRC_DIR "${DOC_TMP_DIR}")
|
||||
else()
|
||||
set(DOC_SRC_DIR ".")
|
||||
endif()
|
||||
|
||||
install(FILES "${DOC_SRC_DIR}/STORY.txt" DESTINATION "${DOC_DIR}")
|
||||
install(FILES "${DOC_SRC_DIR}/GAME.md" DESTINATION "${DOC_DIR}" RENAME "GAME.txt")
|
||||
install(FILES "${DOC_SRC_DIR}/COPYING" DESTINATION "${DOC_DIR}" RENAME "COPYING.txt")
|
||||
install(FILES "${DOC_SRC_DIR}/misc/README_installed.txt" DESTINATION "${DOC_DIR}" RENAME "README.txt")
|
||||
|
||||
if(PACKAGE_DATA AND PACKAGE_DATA_SUPPORTED)
|
||||
message(STATUS "Packaging of data enabled")
|
||||
set(GAME_RESOURCES_ZIP "${CMAKE_CURRENT_BINARY_DIR}/00-taisei.zip")
|
||||
|
||||
configure_file(
|
||||
"${BUILDSCRIPTS_DIR}/package_data.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/package_data.cmake"
|
||||
@ONLY)
|
||||
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/package_data.cmake")
|
||||
|
||||
if(PACKAGE_DATA_LEANIFY)
|
||||
find_program(LEANIFY_COMMAND "leanify")
|
||||
|
||||
if(NOT LEANIFY_COMMAND)
|
||||
message(FATAL_ERROR "'leanify' not found. Either install it from https://github.com/JayXon/Leanify or pass -DPACKAGE_DATA_LEANIFY=OFF to CMake.")
|
||||
else()
|
||||
configure_file(
|
||||
"${BUILDSCRIPTS_DIR}/leanify_data.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/leanify_data.cmake"
|
||||
@ONLY)
|
||||
|
||||
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/leanify_data.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(FILES ${GAME_RESOURCES_ZIP} DESTINATION ${DATA_DIR})
|
||||
else()
|
||||
message(STATUS "Packaging of data disabled")
|
||||
install(DIRECTORY "resources/" DESTINATION ${DATA_DIR})
|
||||
endif()
|
||||
|
||||
install(FILES ${MISC_DIR}/gamecontrollerdb/gamecontrollerdb.txt DESTINATION ${DATA_DIR})
|
||||
|
||||
if(WIN32)
|
||||
# XXX: this is supposedly for dynamic-link builds, untested due to MXE being an ass
|
||||
include(InstallRequiredSystemLibraries)
|
||||
endif()
|
||||
|
||||
if(USE_CPACK)
|
||||
include("${BUILDSCRIPTS_DIR}/CPackSettings.cmake")
|
||||
endif()
|
||||
|
||||
# uninstall target
|
||||
configure_file(
|
||||
"${BUILDSCRIPTS_DIR}/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
@ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
12
README.md
12
README.md
|
@ -13,7 +13,7 @@ Dependencies:
|
|||
* libzip >= 1.0
|
||||
* libpng >= 1.5.0
|
||||
* OpenGL >= 2.1
|
||||
* CMake >= 3.1 (build system)
|
||||
* meson >= 0.38.0 (build system)
|
||||
* pkg-config (build dependency)
|
||||
|
||||
To build and install Taisei just follow these steps.
|
||||
|
@ -21,15 +21,15 @@ To build and install Taisei just follow these steps.
|
|||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$yourprefix ..
|
||||
make
|
||||
make install
|
||||
meson --prefix=$yourprefix ..
|
||||
ninja
|
||||
ninja install
|
||||
```
|
||||
|
||||
This will install game data to `$prefix/share/taisei/` and build this path
|
||||
_statically_ into the executable. This might be a package maintainer’s choice.
|
||||
Alternatively you may want to add `-DRELATIVE=TRUE` to get a relative structure
|
||||
like
|
||||
Alternatively you may want to add `-Drelative_install=true --bindir=`
|
||||
to get a relative structure like
|
||||
|
||||
```
|
||||
$prefix/taisei
|
||||
|
|
16
doc/meson.build
Normal file
16
doc/meson.build
Normal file
|
@ -0,0 +1,16 @@
|
|||
doc_files = [
|
||||
'ENVIRON.md',
|
||||
'GAME.md',
|
||||
'README.txt',
|
||||
'STORY.txt',
|
||||
]
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
foreach f : doc_files
|
||||
custom_target(f, command : [unix2dos, '@INPUT@', '@OUTPUT@'],
|
||||
input : f, output : f.strip('../').split('.')[0] + '.txt',
|
||||
install : true, install_dir : doc_path)
|
||||
endforeach
|
||||
else
|
||||
install_data(doc_files, install_dir : doc_path)
|
||||
endif
|
161
meson.build
Normal file
161
meson.build
Normal file
|
@ -0,0 +1,161 @@
|
|||
project('taisei', 'c', license : 'MIT', version : 'v1.1.0-9999',
|
||||
meson_version : '>=0.38.0',
|
||||
default_options : ['c_std=c11', 'b_lto=true'])
|
||||
|
||||
config = configuration_data()
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
taisei_c_args = []
|
||||
foreach flag : [
|
||||
'-Wpedantic',
|
||||
'-Wparentheses',
|
||||
'-Wtype-limits',
|
||||
'-Wstrict-prototypes',
|
||||
'-Wlong-long',
|
||||
'-Winit-self',
|
||||
'-Wnull-dereference',
|
||||
'-Wformat-pedantic',
|
||||
'-Wgcc-compat',
|
||||
'-Wfloat-overflow-conversion',
|
||||
'-Wfloat-zero-conversion',
|
||||
'-Wfor-loop-analysis',
|
||||
'-Wimplicit-fallthrough',
|
||||
'-Wsometimes-uninitialized',
|
||||
'-Wunneeded-internal-declaration',
|
||||
'-Wunreachable-code',
|
||||
'-Wunreachable-code-loop-increment',
|
||||
'-Wgnu'
|
||||
]
|
||||
if cc.has_argument(flag)
|
||||
taisei_c_args += flag
|
||||
endif
|
||||
endforeach
|
||||
|
||||
static = get_option('static')
|
||||
|
||||
dep_sdl2 = dependency('sdl2', version : '>=2.0.5', required : true, static : static)
|
||||
dep_sdl2_ttf = dependency('SDL2_ttf', required : true, static: static)
|
||||
dep_zlib = dependency('zlib', required : true, static: static)
|
||||
dep_png = dependency('libpng', version : '>=1.5', required : true, static: static)
|
||||
dep_m = cc.find_library('m', required : false)
|
||||
|
||||
taisei_deps = [dep_sdl2, dep_sdl2_ttf, dep_zlib, dep_png, dep_m]
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
taisei_deps += cc.find_library('shlwapi')
|
||||
endif
|
||||
|
||||
dep_sdl2_mixer = dependency('SDL2_mixer', required : false, static: static)
|
||||
if dep_sdl2_mixer.found() and get_option('enable_audio') != 'false'
|
||||
taisei_deps += dep_sdl2_mixer
|
||||
elif get_option('enable_audio') == 'true'
|
||||
error('Audio support enabled but SDL2_mixer not found')
|
||||
endif
|
||||
|
||||
dep_zip = dependency('libzip', version : '>=1.0', required : false, static: static)
|
||||
if dep_zip.found() and get_option('package_data') != 'false'
|
||||
taisei_deps += dep_zip
|
||||
elif get_option('package_data') == 'true'
|
||||
error('Data packaging enabled but libzip not found')
|
||||
endif
|
||||
|
||||
config.set('DISABLE_ZIP', not taisei_deps.contains(dep_zip))
|
||||
|
||||
have_posix = cc.has_header_symbol('unistd.h', '_POSIX_VERSION')
|
||||
have_vla = not cc.has_header_symbol('unistd.h', '__STDC_NO_VLA__')
|
||||
have_complex = not cc.has_header_symbol('unistd.h', '__STDC_NO_COMPLEX__')
|
||||
have_backtrace = cc.has_header_symbol('execinfo.h', 'backtrace')
|
||||
|
||||
if not (have_vla and have_complex)
|
||||
error('Your C implementation needs to support complex numbers and variable-length arrays.')
|
||||
endif
|
||||
|
||||
|
||||
if get_option('install_relative') == 'auto'
|
||||
config.set('RELATIVE', host_machine.system() == 'windows' or host_machine.system() == 'darwin')
|
||||
else
|
||||
config.set('RELATIVE', get_option('install_relative') == 'true')
|
||||
endif
|
||||
|
||||
if config.get('RELATIVE')
|
||||
if host_machine.system() == 'darwin'
|
||||
data_path = join_paths(get_option('datadir'), 'data')
|
||||
config.set('DATA_PATH', '"@0@"'.format(join_paths('../..', data_path)))
|
||||
else
|
||||
data_path = 'data'
|
||||
|
||||
# HACK
|
||||
rel_dpath = []
|
||||
foreach p : get_option('bindir').split('/')
|
||||
if p != ''
|
||||
rel_dpath += '..'
|
||||
endif
|
||||
endforeach
|
||||
rel_dpath += data_path
|
||||
|
||||
config.set('DATA_PATH', '"@0@"'.format(join_paths(rel_dpath)))
|
||||
endif
|
||||
doc_path = ''
|
||||
else
|
||||
data_path = join_paths(get_option('datadir'), 'taisei')
|
||||
config.set('DATA_PATH', '"@0@"'.format(join_paths(get_option('prefix'), data_path)))
|
||||
doc_path = join_paths(get_option('datadir'), 'doc', 'taisei')
|
||||
endif
|
||||
|
||||
|
||||
systype = have_posix ? 'POSIX' : host_machine.system()
|
||||
|
||||
if get_option('buildtype').startswith('debug')
|
||||
add_global_arguments('-DDEBUG', language: 'c')
|
||||
if have_backtrace
|
||||
add_global_arguments('-DLOG_ENABLE_BACKTRACE', language : 'c')
|
||||
endif
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'windows' or host_machine.system() == 'darwin'
|
||||
add_global_arguments('-DLOG_FATAL_MSGBOX', language : 'c')
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
unix2dos = find_program('scripts/unix2dos.py')
|
||||
custom_target('COPYING.txt', command : [unix2dos, '@INPUT@', '@OUTPUT@'],
|
||||
input : 'COPYING', output : 'COPYING.txt',
|
||||
install : true, install_dir : doc_path)
|
||||
else
|
||||
install_data('COPYING', install_dir : doc_path)
|
||||
endif
|
||||
|
||||
summary = '''
|
||||
|
||||
Summary:
|
||||
System type: @0@
|
||||
Audio enabled: @1@
|
||||
Package data: @2@
|
||||
|
||||
Relative install paths: @3@
|
||||
Prefix: @4@
|
||||
Executables: @5@
|
||||
Data: @6@
|
||||
Documentation: @7@
|
||||
|
||||
Build type: @8@
|
||||
'''.format(
|
||||
systype,
|
||||
taisei_deps.contains(dep_sdl2_mixer),
|
||||
taisei_deps.contains(dep_zip),
|
||||
config.get('RELATIVE'),
|
||||
get_option('prefix'),
|
||||
get_option('bindir'),
|
||||
data_path,
|
||||
doc_path,
|
||||
get_option('buildtype')
|
||||
)
|
||||
|
||||
message(summary)
|
||||
|
||||
subdir('src')
|
||||
subdir('resources')
|
||||
subdir('misc')
|
||||
subdir('doc')
|
||||
subdir('xdg')
|
6
meson_options.txt
Normal file
6
meson_options.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
option('version_fallback', type : 'string', description : 'Overrides the version string when not building in a git repository')
|
||||
option('enable_audio', type : 'combo', choices : ['auto', 'true', 'false'], description : 'Enable audio support (needs SDL2_mixer)')
|
||||
option('package_data', type : 'combo', choices : ['auto', 'true', 'false'], description : 'Package the game’s assets into a compressed archive instead of bundling plain files (needs libzip)')
|
||||
option('install_relative', type : 'combo', choices : ['auto', 'true', 'false'], description : 'Use only relative paths to the executable and install everything in the same directory')
|
||||
option('win_console', type : 'boolean', value : false, description : 'Use the console subsystem on Windows')
|
||||
option('static', type : 'boolean', value : false, description : 'Build statically linked executable')
|
5
misc/meson.build
Normal file
5
misc/meson.build
Normal file
|
@ -0,0 +1,5 @@
|
|||
install_data('gamecontrollerdb/gamecontrollerdb.txt', install_dir : data_path)
|
||||
|
||||
if host_machine.system() == 'darwin'
|
||||
install_data('icons/Taisei.icns', install_dir : get_option('datadir'))
|
||||
endif
|
20
resources/meson.build
Normal file
20
resources/meson.build
Normal file
|
@ -0,0 +1,20 @@
|
|||
dirs = ['bgm', 'gfx', 'models', 'sfx', 'shader']
|
||||
|
||||
if taisei_deps.contains(dep_zip)
|
||||
archive = '00-taisei.zip'
|
||||
pack_exe = find_program('../scripts/pack.py')
|
||||
pack = custom_target('packed data files',
|
||||
command : [pack_exe, '@OUTPUT@',
|
||||
meson.current_source_dir(),
|
||||
'@DEPFILE@',
|
||||
'@INPUT@'],
|
||||
input : dirs,
|
||||
output : archive,
|
||||
depfile : 'pack.d',
|
||||
install : true,
|
||||
install_dir : data_path)
|
||||
else
|
||||
foreach dir : dirs
|
||||
install_subdir(dir, install_dir : data_path)
|
||||
endforeach
|
||||
endif
|
|
@ -1,63 +0,0 @@
|
|||
|
||||
###############################
|
||||
# #
|
||||
# CCC PPPP A CCC K K #
|
||||
# C C P P A A C C K K #
|
||||
# C PPPP AAAAA C KKK #
|
||||
# C C P A A C C K K #
|
||||
# CCC P A A CCC K K #
|
||||
# #
|
||||
# SSSS U U CCC K K SSSS #
|
||||
# S U U C C K K S #
|
||||
# SSS U U C KKK SSS #
|
||||
# S U U C C K K S #
|
||||
# SSSS UUU CCC K K SSSS #
|
||||
# #
|
||||
###############################
|
||||
|
||||
set(CLEANUP_COMMANDS "
|
||||
DeleteRegKey HKCR \".tsr\"
|
||||
DeleteRegKey HKCR \"TaiseiProject.tsr\"
|
||||
DeleteRegKey HKCR \"TaiseiProject.tsr\\DefaultIcon\"
|
||||
DeleteRegKey HKCR \"TaiseiProject.tsr\\Shell\"
|
||||
DeleteRegKey HKCR \"TaiseiProject.tsr\\Shell\\Open\"
|
||||
DeleteRegKey HKCR \"TaiseiProject.tsr\\Shell\\Open\\Command\"
|
||||
DeleteRegKey HKCR \"Applications\\taisei.exe\"
|
||||
DeleteRegKey HKCR \"Applications\\taisei.exe\\DefaultIcon\"
|
||||
DeleteRegKey HKCR \"Applications\\taisei.exe\\Shell\"
|
||||
DeleteRegKey HKCR \"Applications\\taisei.exe\\Shell\\Open\"
|
||||
DeleteRegKey HKCR \"Applications\\taisei.exe\\Shell\\Open\\Command\"
|
||||
")
|
||||
|
||||
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
|
||||
${CLEANUP_COMMANDS}
|
||||
WriteRegStr HKCR \".tsr\" \"\" \"TaiseiProject.tsr\"
|
||||
WriteRegStr HKCR \".tsr\" \"Content Type\" \"application/x-taisei-replay\"
|
||||
WriteRegStr HKCR \"TaiseiProject.tsr\" \"\" \"Taisei Project replay\"
|
||||
WriteRegStr HKCR \"TaiseiProject.tsr\" \"FriendlyTypeName\" \"@$INSTDIR\\taisei.exe,-2\"
|
||||
WriteRegStr HKCR \"TaiseiProject.tsr\\DefaultIcon\" \"\" \"$INSTDIR\\taisei.exe,1\"
|
||||
WriteRegStr HKCR \"TaiseiProject.tsr\\Shell\\Open\\Command\" \"\" \"$\\\"$INSTDIR\\taisei.exe$\\\" --replay $\\\"%1$\\\"\"
|
||||
WriteRegStr HKCR \"Applications\\taisei.exe\" \"\" \"Taisei Project\"
|
||||
WriteRegStr HKCR \"Applications\\taisei.exe\" \"FriendlyAppName\" \"@$INSTDIR\\taisei.exe,-1\"
|
||||
WriteRegStr HKCR \"Applications\\taisei.exe\\DefaultIcon\" \"\" \"$INSTDIR\\taisei.exe,1\"
|
||||
WriteRegStr HKCR \"Applications\\taisei.exe\\Shell\\Open\\Command\" \"\" \"$\\\"$INSTDIR\\taisei.exe$\\\" --replay $\\\"%1$\\\"\"
|
||||
")
|
||||
|
||||
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CLEANUP_COMMANDS}")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "@_CPACK_RESOURCE_FILE_LICENSE@")
|
||||
|
||||
###############################
|
||||
# #
|
||||
# CCC M M A K K EEEEE #
|
||||
# C C MM MM A A K K E #
|
||||
# C M M M AAAAA KKK EEEE #
|
||||
# C C M M A A K K E #
|
||||
# CCC M M A A K K EEEEE #
|
||||
# #
|
||||
# SSSS U U CCC K K SSSS #
|
||||
# S U U C C K K S #
|
||||
# SSS U U C KKK SSS #
|
||||
# S U U C C K K S #
|
||||
# SSSS UUU CCC K K SSSS #
|
||||
# #
|
||||
###############################
|
|
@ -1,43 +0,0 @@
|
|||
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
# XXX: not a huge issue, but this seems to have no effect
|
||||
# at least on my system, it still creates a 32-bit installer
|
||||
set(NSIS "NSIS64")
|
||||
else()
|
||||
set(NSIS "NSIS")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(CPACK_GENERATOR "${NSIS};7Z")
|
||||
set(_CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/win32docs/COPYING")
|
||||
else()
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
set(_CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_NAME "Taisei")
|
||||
set(CPACK_PACKAGE_VENDOR "Taisei Project")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A free and open-source Tōhō Project fangame")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${TAISEI_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${TAISEI_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${TAISEI_VERSION_PATCH}")
|
||||
set(CPACK_PACKAGE_VERSION "${TAISEI_VERSION}")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Taisei Project")
|
||||
set(CPACK_PACKAGE_ICON "${ICONS_DIR}/taisei.ico")
|
||||
set(CPACK_MONOLITHIC_INSTALL TRUE)
|
||||
set(CPACK_PACKAGE_EXECUTABLES "taisei" "Taisei")
|
||||
|
||||
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
|
||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "taisei.exe")
|
||||
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "taisei.exe")
|
||||
set(CPACK_NSIS_HELP_LINK "https://taisei-project.org/")
|
||||
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL TRUE)
|
||||
|
||||
configure_file(
|
||||
"${BUILDSCRIPTS_DIR}/CPackRuntimeSettings.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CPackRuntimeSettings.cmake"
|
||||
@ONLY)
|
||||
|
||||
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/CPackRuntimeSettings.cmake")
|
||||
|
||||
include(CPack)
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
message(STATUS "Installing dynamic libraries")
|
||||
|
||||
if("@OSX_LIB_PATH@" STREQUAL "")
|
||||
message(FATAL_ERROR "You must set at least OSX_LIB_PATH to use the install rule.")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "@PROJECT_SOURCE_DIR@/scripts/osx-install-dylibs.sh"
|
||||
"--iknowwhatimdoing"
|
||||
"@OSX_BINARY@"
|
||||
"@DYLIBS_DIR_FINAL@"
|
||||
"@DYLIBS_DIR_INTERMEDIATE@"
|
||||
"@DYLIBS_DIR_NAME@"
|
||||
"@OSX_LIB_PATH@"
|
||||
"@OSX_TOOL_PATH@"
|
||||
"@OSX_TOOL_PREFIX@"
|
||||
WORKING_DIRECTORY "$ENV{DESTDIR}@CMAKE_INSTALL_PREFIX@"
|
||||
RESULT_VARIABLE ERRCODE
|
||||
)
|
||||
|
||||
if(NOT ERRCODE EQUAL 0)
|
||||
message(FATAL_ERROR "OSX install script failed: ${ERRCODE}")
|
||||
endif()
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
message(STATUS "Stripping: @TAISEI_BINARY@")
|
||||
|
||||
execute_process(
|
||||
COMMAND "@CMAKE_STRIP@" -s "@TAISEI_BINARY@"
|
||||
RESULT_VARIABLE ERRCODE
|
||||
WORKING_DIRECTORY "$ENV{DESTDIR}@CMAKE_INSTALL_PREFIX@"
|
||||
)
|
||||
|
||||
if(NOT ERRCODE EQUAL 0)
|
||||
message(FATAL_ERROR "@CMAKE_STRIP@ failed: ${ERRCODE}")
|
||||
endif()
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
set(DOC_PREFIX "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||
set(DOC_FILES "@DOC_FILES@")
|
||||
|
||||
message(STATUS "Fixing line breaks in documentation")
|
||||
|
||||
file(MAKE_DIRECTORY "@DOC_TMP_DIR@/misc")
|
||||
|
||||
foreach(FILE IN LISTS DOC_FILES)
|
||||
execute_process(
|
||||
COMMAND "@PYTHON_EXECUTABLE@" "@BUILDSCRIPTS_DIR@/fix-win32-doc.py" "${DOC_PREFIX}/${FILE}" "@DOC_TMP_DIR@/${FILE}"
|
||||
WORKING_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@"
|
||||
RESULT_VARIABLE ERRCODE
|
||||
)
|
||||
|
||||
if(NOT ERRCODE EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to process file ${DOC_PREFIX}/${FILE}")
|
||||
endif()
|
||||
endforeach()
|
|
@ -1,88 +0,0 @@
|
|||
#.rst:
|
||||
# CheckAndSetFlags
|
||||
# ------------------
|
||||
#
|
||||
# Check whether the C compiler supports a given flag pair: one to compiler,
|
||||
# and the another one to linker.
|
||||
#
|
||||
# CHECK_AND_SET_FLAGS
|
||||
# (
|
||||
# <test name>
|
||||
# <compiler flag> <destination for compiler flag>
|
||||
# [<linker flag> [<destination for linker flag>]]
|
||||
# )
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# <test name> - for diagnostic purposes, will be shown in CMake log
|
||||
# <compiler flag> - compiler flag
|
||||
# <destination for compiler flag> - if test succeeds, this flag will go here
|
||||
# <linker flag> - corresponding linker flag, if needed
|
||||
# <destination for linker flag> - if specified and test succeeds, this flag
|
||||
# will go here
|
||||
#
|
||||
# Example:
|
||||
# CHECK_AND_SET_FLAGS(NDR_SUP "-Wnull-dereference" DBG_CFLAGS)
|
||||
# - adds "-Wnull-dereference" to DBG_CFLAGS if build of test source
|
||||
# succeeds with this flags passed to compile stage call of cc.
|
||||
#
|
||||
# CHECK_AND_SET_FLAGS(ST_SUP "-fsanitize=thread -fPIE" DBG_CF "-pie" DBG_LDF)
|
||||
# - adds "-fsanitize=thread -fPIE" to DBG_CF and "-pie" to DBG_LDF
|
||||
# if build of test source succeeds with these flags passed to cc
|
||||
# for compile and link stage, respectively.
|
||||
#
|
||||
# CHECK_AND_SET_FLAGS(ST_SUP "-fsanitize=address" DBG_F "-fsanitize=address")
|
||||
# - adds "-fsanitize=address" to DBG_F if build of test source succeeds
|
||||
# with this flag passed to cc for both compile and link stages.
|
||||
#
|
||||
# This does the following things:
|
||||
# - calls CHECK_C_COMPILER_AND_LINKER_FLAG macro to check if compiler
|
||||
# (and, possibly, linker) supports specified flags. If linker flag
|
||||
# is omitted, no additional flag is passed to linker; if you need to pass
|
||||
# the same flag both to compiler and linker, simply repeat it
|
||||
# as fourth parameter of this macro.
|
||||
# - if check succeeds, compiler flag goes to specified variable. In addition,
|
||||
# if another variable is specified for linker flag, linker flag goes there.
|
||||
# if no such variable specified, linker flag will not go anywhere.
|
||||
# It is suitable for cases when there is a flag for both compiler
|
||||
# and linker and only one variable being used for it.
|
||||
|
||||
include(CheckCCompilerAndLinkerFlag)
|
||||
|
||||
macro(CHECK_AND_SET_FLAGS _TESTNAME _CFLAG _CPARAMSTRING)
|
||||
# Forbid reentry to this macro
|
||||
if (DEFINED _CASF_LD_ARGS OR DEFINED _CASF_NUM_LD_ARGS
|
||||
OR DEFINED _CASF_LDFLAG OR DEFINED _CASF_LDPARAMSTRING)
|
||||
message(ERROR "CHECK_AND_SET_FLAGS reentry detected!")
|
||||
endif()
|
||||
|
||||
# Get optional arguments _LDFLAG and _LDPARAMSTRING from _LD_ARGS if they exist
|
||||
set (_CASF_LD_ARGS ${ARGN})
|
||||
list(LENGTH _CASF_LD_ARGS _CASF_NUM_LD_ARGS)
|
||||
if (${_CASF_NUM_LD_ARGS} GREATER 0)
|
||||
list(GET _CASF_LD_ARGS 0 _CASF_LDFLAG)
|
||||
else()
|
||||
set(_CASF_LDFLAG "")
|
||||
endif ()
|
||||
if (${_CASF_NUM_LD_ARGS} GREATER 1)
|
||||
list(GET _CASF_LD_ARGS 1 _CASF_LDPARAMSTRING)
|
||||
endif ()
|
||||
|
||||
# If check succeeded, set _CPARAMSTRING (and _LDPARAMSTRING, if needed)
|
||||
CHECK_C_COMPILER_AND_LINKER_FLAG("${_CFLAG}" "${_CASF_LDFLAG}" "${_TESTNAME}")
|
||||
if(${${_TESTNAME}})
|
||||
set(${_CPARAMSTRING} "${${_CPARAMSTRING}} ${_CFLAG}")
|
||||
if(DEFINED _CASF_LDPARAMSTRING)
|
||||
set(${_CASF_LDPARAMSTRING}
|
||||
"${${_CASF_LDPARAMSTRING}} ${_CASF_LDFLAG}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS " ${_CFLAG} not supported, will not be used.")
|
||||
endif()
|
||||
|
||||
# Unset working variables
|
||||
unset(_CASF_LD_ARGS)
|
||||
unset(_CASF_NUM_LD_ARGS)
|
||||
unset(_CASF_LDFLAG)
|
||||
unset(_CASF_LDPARAMSTRING)
|
||||
endmacro()
|
|
@ -1,75 +0,0 @@
|
|||
#.rst:
|
||||
# CheckCCompilerAndLinkerFlag
|
||||
# ------------------
|
||||
#
|
||||
# Check whether the C compiler supports a given flag pair: one to compiler,
|
||||
# and the another one to linker.
|
||||
#
|
||||
# CHECK_C_COMPILER_AND_LINKER_FLAG(<compiler flag> <linker flag> <var>)
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# <compiler flag> - the compiler flag
|
||||
# <linker flag> - corresponding linker flag
|
||||
# <var> - variable to store the result
|
||||
#
|
||||
# Example:
|
||||
# CHECK_C_COMPILER_AND_LINKER_FLAG("-fsanitize=thread -fPIE" "-pie" ST_SUP)
|
||||
#
|
||||
# This internally calls the check_c_source_compiles macro and sets
|
||||
# CMAKE_REQUIRED_DEFINITIONS to compiler flag, and CMAKE_REQUIRED_LIBRARIES
|
||||
# to linker flag. See help for CheckCSourceCompiles for a listing of
|
||||
# variables that can otherwise modify the build. The result only tells that
|
||||
# the compiler and linker do not give an error message when they encounter
|
||||
# such flags. If the flag has any effect or even a specific one is beyond
|
||||
# the scope of this module.
|
||||
|
||||
#=============================================================================
|
||||
# Based on CheckCCompilerFlag.cmake by:
|
||||
# Copyright 2006-2011 Kitware, Inc.
|
||||
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
|
||||
# Copyright 2011 Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CMakeCheckCompilerFlagCommonPatterns OPTIONAL)
|
||||
|
||||
macro (CHECK_C_COMPILER_AND_LINKER_FLAG _CFLAG _LDFLAG _RESULT)
|
||||
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
|
||||
set(SAFE_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "${_CFLAG}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${_LDFLAG}")
|
||||
|
||||
# Normalize locale during test compilation.
|
||||
set(_CheckCCompilerAndLinkerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
|
||||
foreach(v ${_CheckCCompilerAndLinkerFlag_LOCALE_VARS})
|
||||
set(_CheckCCompilerAndLinkerFlag_SAVED_${v} "$ENV{${v}}")
|
||||
set(ENV{${v}} C)
|
||||
endforeach()
|
||||
if(COMMAND CHECK_COMPILER_FLAG_COMMON_PATTERNS)
|
||||
CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerAndLinkerFlag_COMMON_PATTERNS)
|
||||
endif()
|
||||
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT}
|
||||
# Some compilers do not fail with a bad flag
|
||||
FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU
|
||||
${_CheckCCompilerFlag_COMMON_PATTERNS}
|
||||
)
|
||||
foreach(v ${_CheckCCompilerAndLinkerFlag_LOCALE_VARS})
|
||||
set(ENV{${v}} ${_CheckCCompilerAndLinkerFlag_SAVED_${v}})
|
||||
unset(_CheckCCompilerAndLinkerFlag_SAVED_${v})
|
||||
endforeach()
|
||||
unset(_CheckCCompilerAndLinkerFlag_LOCALE_VARS)
|
||||
unset(_CheckCCompilerAndLinkerFlag_COMMON_PATTERNS)
|
||||
|
||||
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
|
||||
set (CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}")
|
||||
endmacro ()
|
|
@ -1,975 +0,0 @@
|
|||
; I had to copy the entire default template just to insert this directive here.
|
||||
Unicode true
|
||||
|
||||
; CPack install script designed for a nmake build
|
||||
|
||||
;--------------------------------
|
||||
; You must define these values
|
||||
|
||||
!define VERSION "@CPACK_PACKAGE_VERSION@"
|
||||
!define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
|
||||
!define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
|
||||
|
||||
;--------------------------------
|
||||
;Variables
|
||||
|
||||
Var MUI_TEMP
|
||||
Var STARTMENU_FOLDER
|
||||
Var SV_ALLUSERS
|
||||
Var START_MENU
|
||||
Var DO_NOT_ADD_TO_PATH
|
||||
Var ADD_TO_PATH_ALL_USERS
|
||||
Var ADD_TO_PATH_CURRENT_USER
|
||||
Var INSTALL_DESKTOP
|
||||
Var IS_DEFAULT_INSTALLDIR
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI.nsh"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
;Name and file
|
||||
Name "@CPACK_NSIS_PACKAGE_NAME@"
|
||||
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
|
||||
|
||||
;Set compression
|
||||
SetCompressor @CPACK_NSIS_COMPRESSOR@
|
||||
|
||||
;Require administrator access
|
||||
RequestExecutionLevel admin
|
||||
|
||||
@CPACK_NSIS_DEFINES@
|
||||
|
||||
!include Sections.nsh
|
||||
|
||||
;--- Component support macros: ---
|
||||
; The code for the add/remove functionality is from:
|
||||
; http://nsis.sourceforge.net/Add/Remove_Functionality
|
||||
; It has been modified slightly and extended to provide
|
||||
; inter-component dependencies.
|
||||
Var AR_SecFlags
|
||||
Var AR_RegFlags
|
||||
@CPACK_NSIS_SECTION_SELECTED_VARS@
|
||||
|
||||
; Loads the "selected" flag for the section named SecName into the
|
||||
; variable VarName.
|
||||
!macro LoadSectionSelectedIntoVar SecName VarName
|
||||
SectionGetFlags ${${SecName}} $${VarName}
|
||||
IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
|
||||
!macroend
|
||||
|
||||
; Loads the value of a variable... can we get around this?
|
||||
!macro LoadVar VarName
|
||||
IntOp $R0 0 + $${VarName}
|
||||
!macroend
|
||||
|
||||
; Sets the value of a variable
|
||||
!macro StoreVar VarName IntValue
|
||||
IntOp $${VarName} 0 + ${IntValue}
|
||||
!macroend
|
||||
|
||||
!macro InitSection SecName
|
||||
; This macro reads component installed flag from the registry and
|
||||
;changes checked state of the section on the components page.
|
||||
;Input: section index constant name specified in Section command.
|
||||
|
||||
ClearErrors
|
||||
;Reading component status from registry
|
||||
ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
|
||||
IfErrors "default_${SecName}"
|
||||
;Status will stay default if registry value not found
|
||||
;(component was never installed)
|
||||
IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
|
||||
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
|
||||
IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
|
||||
IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
|
||||
|
||||
; Note whether this component was installed before
|
||||
!insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
|
||||
IntOp $R0 $AR_RegFlags & $AR_RegFlags
|
||||
|
||||
;Writing modified flags
|
||||
SectionSetFlags ${${SecName}} $AR_SecFlags
|
||||
|
||||
"default_${SecName}:"
|
||||
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
|
||||
!macroend
|
||||
|
||||
!macro FinishSection SecName
|
||||
; This macro reads section flag set by user and removes the section
|
||||
;if it is not selected.
|
||||
;Then it writes component installed flag to registry
|
||||
;Input: section index constant name specified in Section command.
|
||||
|
||||
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
|
||||
;Checking lowest bit:
|
||||
IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
|
||||
IntCmp $AR_SecFlags 1 "leave_${SecName}"
|
||||
;Section is not selected:
|
||||
;Calling Section uninstall macro and writing zero installed flag
|
||||
!insertmacro "Remove_${${SecName}}"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
|
||||
"Installed" 0
|
||||
Goto "exit_${SecName}"
|
||||
|
||||
"leave_${SecName}:"
|
||||
;Section is selected:
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
|
||||
"Installed" 1
|
||||
|
||||
"exit_${SecName}:"
|
||||
!macroend
|
||||
|
||||
!macro RemoveSection_CPack SecName
|
||||
; This macro is used to call section's Remove_... macro
|
||||
;from the uninstaller.
|
||||
;Input: section index constant name specified in Section command.
|
||||
|
||||
!insertmacro "Remove_${${SecName}}"
|
||||
!macroend
|
||||
|
||||
; Determine whether the selection of SecName changed
|
||||
!macro MaybeSelectionChanged SecName
|
||||
!insertmacro LoadVar ${SecName}_selected
|
||||
SectionGetFlags ${${SecName}} $R1
|
||||
IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
|
||||
|
||||
; See if the status has changed:
|
||||
IntCmp $R0 $R1 "${SecName}_unchanged"
|
||||
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
|
||||
|
||||
IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
|
||||
!insertmacro "Deselect_required_by_${SecName}"
|
||||
goto "${SecName}_unchanged"
|
||||
|
||||
"${SecName}_was_selected:"
|
||||
!insertmacro "Select_${SecName}_depends"
|
||||
|
||||
"${SecName}_unchanged:"
|
||||
!macroend
|
||||
;--- End of Add/Remove macros ---
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;----------------------------------------
|
||||
; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
|
||||
;----------------------------------------
|
||||
!verbose 3
|
||||
!include "WinMessages.NSH"
|
||||
!verbose 4
|
||||
;====================================================
|
||||
; get_NT_environment
|
||||
; Returns: the selected environment
|
||||
; Output : head of the stack
|
||||
;====================================================
|
||||
!macro select_NT_profile UN
|
||||
Function ${UN}select_NT_profile
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
|
||||
DetailPrint "Selected environment for all users"
|
||||
Push "all"
|
||||
Return
|
||||
environment_single:
|
||||
DetailPrint "Selected environment for current user only."
|
||||
Push "current"
|
||||
Return
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro select_NT_profile ""
|
||||
!insertmacro select_NT_profile "un."
|
||||
;----------------------------------------------------
|
||||
!define NT_current_env 'HKCU "Environment"'
|
||||
!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
!ifndef WriteEnvStr_RegKey
|
||||
!ifdef ALL_USERS
|
||||
!define WriteEnvStr_RegKey \
|
||||
'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
!else
|
||||
!define WriteEnvStr_RegKey 'HKCU "Environment"'
|
||||
!endif
|
||||
!endif
|
||||
|
||||
; AddToPath - Adds the given dir to the search path.
|
||||
; Input - head of the stack
|
||||
; Note - Win9x systems requires reboot
|
||||
|
||||
Function AddToPath
|
||||
Exch $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
|
||||
# don't add if the path doesn't exist
|
||||
IfFileExists "$0\*.*" "" AddToPath_done
|
||||
|
||||
ReadEnvStr $1 PATH
|
||||
; if the path is too long for a NSIS variable NSIS will return a 0
|
||||
; length string. If we find that, then warn and skip any path
|
||||
; modification as it will trash the existing path.
|
||||
StrLen $2 $1
|
||||
IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
|
||||
CheckPathLength_ShowPathWarning:
|
||||
Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
|
||||
Goto AddToPath_done
|
||||
CheckPathLength_Done:
|
||||
Push "$1;"
|
||||
Push "$0;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
Push "$1;"
|
||||
Push "$0\;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
GetFullPathName /SHORT $3 $0
|
||||
Push "$1;"
|
||||
Push "$3;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
Push "$1;"
|
||||
Push "$3\;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
|
||||
Call IsNT
|
||||
Pop $1
|
||||
StrCmp $1 1 AddToPath_NT
|
||||
; Not on NT
|
||||
StrCpy $1 $WINDIR 2
|
||||
FileOpen $1 "$1\autoexec.bat" a
|
||||
FileSeek $1 -1 END
|
||||
FileReadByte $1 $2
|
||||
IntCmp $2 26 0 +2 +2 # DOS EOF
|
||||
FileSeek $1 -1 END # write over EOF
|
||||
FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
|
||||
FileClose $1
|
||||
SetRebootFlag true
|
||||
Goto AddToPath_done
|
||||
|
||||
AddToPath_NT:
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
|
||||
ReadRegStr $1 ${NT_current_env} "PATH"
|
||||
Goto DoTrim
|
||||
ReadAllKey:
|
||||
ReadRegStr $1 ${NT_all_env} "PATH"
|
||||
DoTrim:
|
||||
StrCmp $1 "" AddToPath_NTdoIt
|
||||
Push $1
|
||||
Call Trim
|
||||
Pop $1
|
||||
StrCpy $0 "$1;$0"
|
||||
AddToPath_NTdoIt:
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
|
||||
WriteRegExpandStr ${NT_current_env} "PATH" $0
|
||||
Goto DoSend
|
||||
WriteAllKey:
|
||||
WriteRegExpandStr ${NT_all_env} "PATH" $0
|
||||
DoSend:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
AddToPath_done:
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
; RemoveFromPath - Remove a given dir from the path
|
||||
; Input: head of the stack
|
||||
|
||||
Function un.RemoveFromPath
|
||||
Exch $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
|
||||
IntFmt $6 "%c" 26 # DOS EOF
|
||||
|
||||
Call un.IsNT
|
||||
Pop $1
|
||||
StrCmp $1 1 unRemoveFromPath_NT
|
||||
; Not on NT
|
||||
StrCpy $1 $WINDIR 2
|
||||
FileOpen $1 "$1\autoexec.bat" r
|
||||
GetTempFileName $4
|
||||
FileOpen $2 $4 w
|
||||
GetFullPathName /SHORT $0 $0
|
||||
StrCpy $0 "SET PATH=%PATH%;$0"
|
||||
Goto unRemoveFromPath_dosLoop
|
||||
|
||||
unRemoveFromPath_dosLoop:
|
||||
FileRead $1 $3
|
||||
StrCpy $5 $3 1 -1 # read last char
|
||||
StrCmp $5 $6 0 +2 # if DOS EOF
|
||||
StrCpy $3 $3 -1 # remove DOS EOF so we can compare
|
||||
StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
|
||||
StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
|
||||
StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
|
||||
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
|
||||
FileWrite $2 $3
|
||||
Goto unRemoveFromPath_dosLoop
|
||||
unRemoveFromPath_dosLoopRemoveLine:
|
||||
SetRebootFlag true
|
||||
Goto unRemoveFromPath_dosLoop
|
||||
|
||||
unRemoveFromPath_dosLoopEnd:
|
||||
FileClose $2
|
||||
FileClose $1
|
||||
StrCpy $1 $WINDIR 2
|
||||
Delete "$1\autoexec.bat"
|
||||
CopyFiles /SILENT $4 "$1\autoexec.bat"
|
||||
Delete $4
|
||||
Goto unRemoveFromPath_done
|
||||
|
||||
unRemoveFromPath_NT:
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
|
||||
ReadRegStr $1 ${NT_current_env} "PATH"
|
||||
Goto unDoTrim
|
||||
unReadAllKey:
|
||||
ReadRegStr $1 ${NT_all_env} "PATH"
|
||||
unDoTrim:
|
||||
StrCpy $5 $1 1 -1 # copy last char
|
||||
StrCmp $5 ";" +2 # if last char != ;
|
||||
StrCpy $1 "$1;" # append ;
|
||||
Push $1
|
||||
Push "$0;"
|
||||
Call un.StrStr ; Find `$0;` in $1
|
||||
Pop $2 ; pos of our dir
|
||||
StrCmp $2 "" unRemoveFromPath_done
|
||||
; else, it is in path
|
||||
# $0 - path to add
|
||||
# $1 - path var
|
||||
StrLen $3 "$0;"
|
||||
StrLen $4 $2
|
||||
StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
|
||||
StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
|
||||
StrCpy $3 $5$6
|
||||
|
||||
StrCpy $5 $3 1 -1 # copy last char
|
||||
StrCmp $5 ";" 0 +2 # if last char == ;
|
||||
StrCpy $3 $3 -1 # remove last char
|
||||
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
|
||||
WriteRegExpandStr ${NT_current_env} "PATH" $3
|
||||
Goto unDoSend
|
||||
unWriteAllKey:
|
||||
WriteRegExpandStr ${NT_all_env} "PATH" $3
|
||||
unDoSend:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
unRemoveFromPath_done:
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Uninstall sutff
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
###########################################
|
||||
# Utility Functions #
|
||||
###########################################
|
||||
|
||||
;====================================================
|
||||
; IsNT - Returns 1 if the current system is NT, 0
|
||||
; otherwise.
|
||||
; Output: head of the stack
|
||||
;====================================================
|
||||
; IsNT
|
||||
; no input
|
||||
; output, top of the stack = 1 if NT or 0 if not
|
||||
;
|
||||
; Usage:
|
||||
; Call IsNT
|
||||
; Pop $R0
|
||||
; ($R0 at this point is 1 or 0)
|
||||
|
||||
!macro IsNT un
|
||||
Function ${un}IsNT
|
||||
Push $0
|
||||
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
|
||||
StrCmp $0 "" 0 IsNT_yes
|
||||
; we are not NT.
|
||||
Pop $0
|
||||
Push 0
|
||||
Return
|
||||
|
||||
IsNT_yes:
|
||||
; NT!!!
|
||||
Pop $0
|
||||
Push 1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro IsNT ""
|
||||
!insertmacro IsNT "un."
|
||||
|
||||
; StrStr
|
||||
; input, top of stack = string to search for
|
||||
; top of stack-1 = string to search in
|
||||
; output, top of stack (replaces with the portion of the string remaining)
|
||||
; modifies no other variables.
|
||||
;
|
||||
; Usage:
|
||||
; Push "this is a long ass string"
|
||||
; Push "ass"
|
||||
; Call StrStr
|
||||
; Pop $R0
|
||||
; ($R0 at this point is "ass string")
|
||||
|
||||
!macro StrStr un
|
||||
Function ${un}StrStr
|
||||
Exch $R1 ; st=haystack,old$R1, $R1=needle
|
||||
Exch ; st=old$R1,haystack
|
||||
Exch $R2 ; st=old$R1,old$R2, $R2=haystack
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
StrLen $R3 $R1
|
||||
StrCpy $R4 0
|
||||
; $R1=needle
|
||||
; $R2=haystack
|
||||
; $R3=len(needle)
|
||||
; $R4=cnt
|
||||
; $R5=tmp
|
||||
loop:
|
||||
StrCpy $R5 $R2 $R3 $R4
|
||||
StrCmp $R5 $R1 done
|
||||
StrCmp $R5 "" done
|
||||
IntOp $R4 $R4 + 1
|
||||
Goto loop
|
||||
done:
|
||||
StrCpy $R1 $R2 "" $R4
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro StrStr ""
|
||||
!insertmacro StrStr "un."
|
||||
|
||||
Function Trim ; Added by Pelaca
|
||||
Exch $R1
|
||||
Push $R2
|
||||
Loop:
|
||||
StrCpy $R2 "$R1" 1 -1
|
||||
StrCmp "$R2" " " RTrim
|
||||
StrCmp "$R2" "$\n" RTrim
|
||||
StrCmp "$R2" "$\r" RTrim
|
||||
StrCmp "$R2" ";" RTrim
|
||||
GoTo Done
|
||||
RTrim:
|
||||
StrCpy $R1 "$R1" -1
|
||||
Goto Loop
|
||||
Done:
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
|
||||
Function ConditionalAddToRegisty
|
||||
Pop $0
|
||||
Pop $1
|
||||
StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
|
||||
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
|
||||
"$1" "$0"
|
||||
;MessageBox MB_OK "Set Registry: '$1' to '$0'"
|
||||
DetailPrint "Set install registry entry: '$1' to '$0'"
|
||||
ConditionalAddToRegisty_EmptyString:
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
!ifdef CPACK_USES_DOWNLOAD
|
||||
Function DownloadFile
|
||||
IfFileExists $INSTDIR\* +2
|
||||
CreateDirectory $INSTDIR
|
||||
Pop $0
|
||||
|
||||
; Skip if already downloaded
|
||||
IfFileExists $INSTDIR\$0 0 +2
|
||||
Return
|
||||
|
||||
StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
|
||||
|
||||
try_again:
|
||||
NSISdl::download "$1/$0" "$INSTDIR\$0"
|
||||
|
||||
Pop $1
|
||||
StrCmp $1 "success" success
|
||||
StrCmp $1 "Cancelled" cancel
|
||||
MessageBox MB_OK "Download failed: $1"
|
||||
cancel:
|
||||
Return
|
||||
success:
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
;--------------------------------
|
||||
; Installation types
|
||||
@CPACK_NSIS_INSTALLATION_TYPES@
|
||||
|
||||
;--------------------------------
|
||||
; Component sections
|
||||
@CPACK_NSIS_COMPONENT_SECTIONS@
|
||||
|
||||
;--------------------------------
|
||||
; Define some macro setting for the gui
|
||||
@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
|
||||
@CPACK_NSIS_INSTALLER_ICON_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
|
||||
@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
|
||||
Page custom InstallOptionsPage
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
|
||||
;Start Menu Folder Page Configuration
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
|
||||
|
||||
@CPACK_NSIS_PAGE_COMPONENTS@
|
||||
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
||||
!insertmacro MUI_LANGUAGE "Albanian"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Basque"
|
||||
!insertmacro MUI_LANGUAGE "Belarusian"
|
||||
!insertmacro MUI_LANGUAGE "Bosnian"
|
||||
!insertmacro MUI_LANGUAGE "Breton"
|
||||
!insertmacro MUI_LANGUAGE "Bulgarian"
|
||||
!insertmacro MUI_LANGUAGE "Croatian"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "Danish"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "Estonian"
|
||||
!insertmacro MUI_LANGUAGE "Farsi"
|
||||
!insertmacro MUI_LANGUAGE "Finnish"
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Greek"
|
||||
!insertmacro MUI_LANGUAGE "Hebrew"
|
||||
!insertmacro MUI_LANGUAGE "Hungarian"
|
||||
!insertmacro MUI_LANGUAGE "Icelandic"
|
||||
!insertmacro MUI_LANGUAGE "Indonesian"
|
||||
!insertmacro MUI_LANGUAGE "Irish"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "Korean"
|
||||
!insertmacro MUI_LANGUAGE "Kurdish"
|
||||
!insertmacro MUI_LANGUAGE "Latvian"
|
||||
!insertmacro MUI_LANGUAGE "Lithuanian"
|
||||
!insertmacro MUI_LANGUAGE "Luxembourgish"
|
||||
!insertmacro MUI_LANGUAGE "Macedonian"
|
||||
!insertmacro MUI_LANGUAGE "Malay"
|
||||
!insertmacro MUI_LANGUAGE "Mongolian"
|
||||
!insertmacro MUI_LANGUAGE "Norwegian"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_LANGUAGE "Russian"
|
||||
!insertmacro MUI_LANGUAGE "Serbian"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "Slovak"
|
||||
!insertmacro MUI_LANGUAGE "Slovenian"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "Swedish"
|
||||
!insertmacro MUI_LANGUAGE "Thai"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
!insertmacro MUI_LANGUAGE "Turkish"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Welsh"
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Reserve Files
|
||||
|
||||
;These files should be inserted before other files in the data block
|
||||
;Keep these lines before any File command
|
||||
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
|
||||
|
||||
ReserveFile "NSIS.InstallOptions.ini"
|
||||
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "-Core installation"
|
||||
;Use the entire tree produced by the INSTALL target. Keep the
|
||||
;list of directories here in sync with the RMDir commands below.
|
||||
SetOutPath "$INSTDIR"
|
||||
@CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
|
||||
@CPACK_NSIS_FULL_INSTALL@
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
Push "DisplayName"
|
||||
Push "@CPACK_NSIS_DISPLAY_NAME@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "DisplayVersion"
|
||||
Push "@CPACK_PACKAGE_VERSION@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "Publisher"
|
||||
Push "@CPACK_PACKAGE_VENDOR@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "UninstallString"
|
||||
Push "$INSTDIR\Uninstall.exe"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "NoRepair"
|
||||
Push "1"
|
||||
Call ConditionalAddToRegisty
|
||||
|
||||
!ifdef CPACK_NSIS_ADD_REMOVE
|
||||
;Create add/remove functionality
|
||||
Push "ModifyPath"
|
||||
Push "$INSTDIR\AddRemove.exe"
|
||||
Call ConditionalAddToRegisty
|
||||
!else
|
||||
Push "NoModify"
|
||||
Push "1"
|
||||
Call ConditionalAddToRegisty
|
||||
!endif
|
||||
|
||||
; Optional registration
|
||||
Push "DisplayIcon"
|
||||
Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "HelpLink"
|
||||
Push "@CPACK_NSIS_HELP_LINK@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "URLInfoAbout"
|
||||
Push "@CPACK_NSIS_URL_INFO_ABOUT@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "Contact"
|
||||
Push "@CPACK_NSIS_CONTACT@"
|
||||
Call ConditionalAddToRegisty
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
|
||||
;Create shortcuts
|
||||
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
||||
@CPACK_NSIS_CREATE_ICONS@
|
||||
@CPACK_NSIS_CREATE_ICONS_EXTRA@
|
||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
|
||||
;Read a value from an InstallOptions INI file
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
|
||||
|
||||
; Write special uninstall registry entries
|
||||
Push "StartMenu"
|
||||
Push "$STARTMENU_FOLDER"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "DoNotAddToPath"
|
||||
Push "$DO_NOT_ADD_TO_PATH"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "AddToPathAllUsers"
|
||||
Push "$ADD_TO_PATH_ALL_USERS"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "AddToPathCurrentUser"
|
||||
Push "$ADD_TO_PATH_CURRENT_USER"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "InstallToDesktop"
|
||||
Push "$INSTALL_DESKTOP"
|
||||
Call ConditionalAddToRegisty
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "-Add to path"
|
||||
Push $INSTDIR\bin
|
||||
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
|
||||
StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
|
||||
Call AddToPath
|
||||
doNotAddToPath:
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
; Create custom pages
|
||||
Function InstallOptionsPage
|
||||
!insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
|
||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
; determine admin versus local install
|
||||
Function un.onInit
|
||||
|
||||
ClearErrors
|
||||
UserInfo::GetName
|
||||
IfErrors noLM
|
||||
Pop $0
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
StrCmp $1 "Admin" 0 +3
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Admin group'
|
||||
Goto done
|
||||
StrCmp $1 "Power" 0 +3
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Power Users group'
|
||||
Goto done
|
||||
|
||||
noLM:
|
||||
;Get installation folder from registry if available
|
||||
|
||||
done:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--- Add/Remove callback functions: ---
|
||||
!macro SectionList MacroName
|
||||
;This macro used to perform operation on multiple sections.
|
||||
;List all of your components in following manner here.
|
||||
@CPACK_NSIS_COMPONENT_SECTION_LIST@
|
||||
!macroend
|
||||
|
||||
Section -FinishComponents
|
||||
;Removes unselected components and writes component status to registry
|
||||
!insertmacro SectionList "FinishSection"
|
||||
|
||||
!ifdef CPACK_NSIS_ADD_REMOVE
|
||||
; Get the name of the installer executable
|
||||
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
|
||||
StrCpy $R3 $R0
|
||||
|
||||
; Strip off the last 13 characters, to see if we have AddRemove.exe
|
||||
StrLen $R1 $R0
|
||||
IntOp $R1 $R0 - 13
|
||||
StrCpy $R2 $R0 13 $R1
|
||||
StrCmp $R2 "AddRemove.exe" addremove_installed
|
||||
|
||||
; We're not running AddRemove.exe, so install it
|
||||
CopyFiles $R3 $INSTDIR\AddRemove.exe
|
||||
|
||||
addremove_installed:
|
||||
!endif
|
||||
SectionEnd
|
||||
;--- End of Add/Remove callback functions ---
|
||||
|
||||
;--------------------------------
|
||||
; Component dependencies
|
||||
Function .onSelChange
|
||||
!insertmacro SectionList MaybeSelectionChanged
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
ReadRegStr $START_MENU SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
|
||||
;MessageBox MB_OK "Start menu is in: $START_MENU"
|
||||
ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
|
||||
ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
|
||||
ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
|
||||
;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
|
||||
ReadRegStr $INSTALL_DESKTOP SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
|
||||
;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
|
||||
|
||||
@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
|
||||
|
||||
;Remove files we installed.
|
||||
;Keep the list of directories here in sync with the File commands above.
|
||||
@CPACK_NSIS_DELETE_FILES@
|
||||
@CPACK_NSIS_DELETE_DIRECTORIES@
|
||||
|
||||
!ifdef CPACK_NSIS_ADD_REMOVE
|
||||
;Remove the add/remove program
|
||||
Delete "$INSTDIR\AddRemove.exe"
|
||||
!endif
|
||||
|
||||
;Remove the uninstaller itself.
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
|
||||
;Remove the installation directory if it is empty.
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
; Remove the registry entries.
|
||||
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
|
||||
; Removes all optional components
|
||||
!insertmacro SectionList "RemoveSection_CPack"
|
||||
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
||||
|
||||
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
||||
@CPACK_NSIS_DELETE_ICONS@
|
||||
@CPACK_NSIS_DELETE_ICONS_EXTRA@
|
||||
|
||||
;Delete empty start menu parent diretories
|
||||
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
|
||||
|
||||
startMenuDeleteLoop:
|
||||
ClearErrors
|
||||
RMDir $MUI_TEMP
|
||||
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
|
||||
|
||||
IfErrors startMenuDeleteLoopDone
|
||||
|
||||
StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
|
||||
startMenuDeleteLoopDone:
|
||||
|
||||
; If the user changed the shortcut, then untinstall may not work. This should
|
||||
; try to fix it.
|
||||
StrCpy $MUI_TEMP "$START_MENU"
|
||||
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
||||
@CPACK_NSIS_DELETE_ICONS_EXTRA@
|
||||
|
||||
;Delete empty start menu parent diretories
|
||||
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
|
||||
|
||||
secondStartMenuDeleteLoop:
|
||||
ClearErrors
|
||||
RMDir $MUI_TEMP
|
||||
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
|
||||
|
||||
IfErrors secondStartMenuDeleteLoopDone
|
||||
|
||||
StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
|
||||
secondStartMenuDeleteLoopDone:
|
||||
|
||||
DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
|
||||
Push $INSTDIR\bin
|
||||
StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
|
||||
Call un.RemoveFromPath
|
||||
doNotRemoveFromPath:
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
; determine admin versus local install
|
||||
; Is install for "AllUsers" or "JustMe"?
|
||||
; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
|
||||
; This function is used for the very first "custom page" of the installer.
|
||||
; This custom page does not show up visibly, but it executes prior to the
|
||||
; first visible page and sets up $INSTDIR properly...
|
||||
; Choose different default installation folder based on SV_ALLUSERS...
|
||||
; "Program Files" for AllUsers, "My Documents" for JustMe...
|
||||
|
||||
Function .onInit
|
||||
StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst
|
||||
|
||||
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString"
|
||||
StrCmp $0 "" inst
|
||||
|
||||
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
|
||||
"@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \
|
||||
/SD IDYES IDYES uninst IDNO inst
|
||||
Abort
|
||||
|
||||
;Run the uninstaller
|
||||
uninst:
|
||||
ClearErrors
|
||||
StrLen $2 "\Uninstall.exe"
|
||||
StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path
|
||||
ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file
|
||||
|
||||
IfErrors uninst_failed inst
|
||||
uninst_failed:
|
||||
MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
|
||||
Abort
|
||||
|
||||
|
||||
inst:
|
||||
; Reads components status for registry
|
||||
!insertmacro SectionList "InitSection"
|
||||
|
||||
; check to see if /D has been used to change
|
||||
; the install directory by comparing it to the
|
||||
; install directory that is expected to be the
|
||||
; default
|
||||
StrCpy $IS_DEFAULT_INSTALLDIR 0
|
||||
StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
|
||||
StrCpy $IS_DEFAULT_INSTALLDIR 1
|
||||
|
||||
StrCpy $SV_ALLUSERS "JustMe"
|
||||
; if default install dir then change the default
|
||||
; if it is installed for JustMe
|
||||
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
|
||||
StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
|
||||
ClearErrors
|
||||
UserInfo::GetName
|
||||
IfErrors noLM
|
||||
Pop $0
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
StrCmp $1 "Admin" 0 +4
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Admin group'
|
||||
StrCpy $SV_ALLUSERS "AllUsers"
|
||||
Goto done
|
||||
StrCmp $1 "Power" 0 +4
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Power Users group'
|
||||
StrCpy $SV_ALLUSERS "AllUsers"
|
||||
Goto done
|
||||
|
||||
noLM:
|
||||
StrCpy $SV_ALLUSERS "AllUsers"
|
||||
;Get installation folder from registry if available
|
||||
|
||||
done:
|
||||
StrCmp $SV_ALLUSERS "AllUsers" 0 +3
|
||||
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
|
||||
StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
|
||||
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
|
||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
|
||||
|
||||
noOptionsPage:
|
||||
FunctionEnd
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 3d63330c99fde1844e3ad63c98025d18d38019f2
|
|
@ -1,202 +0,0 @@
|
|||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# git_local_changes(<var>)
|
||||
#
|
||||
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||
# Does not regard untracked files.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
# Modified for Taisei
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
endwhile()
|
||||
# check if this is a submodule
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${GIT_DIR}/HEAD")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake"
|
||||
@ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_local_changes _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var} "CLEAN" PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var} "DIRTY" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(git_revision _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
rev-list --count ${hash}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var} "0" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
|
@ -1,41 +0,0 @@
|
|||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
else()
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
|
@ -1,23 +0,0 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
|
@ -1 +0,0 @@
|
|||
https://github.com/rpavlik/cmake-modules
|
|
@ -1,21 +0,0 @@
|
|||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach (file ${files})
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(
|
||||
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval
|
||||
)
|
||||
if(NOT ${rm_retval} EQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif (NOT ${rm_retval} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
message(STATUS "Optimizing game data")
|
||||
message(STATUS "Note: this will take a long time. Pass -DPACKAGE_DATA_LEANIFY=OFF to CMake if you want to skip this step.")
|
||||
|
||||
execute_process(
|
||||
COMMAND @LEANIFY_COMMAND@ @GAME_RESOURCES_ZIP@
|
||||
WORKING_DIRECTORY @CMAKE_CURRENT_SOURCE_DIR@
|
||||
RESULT_VARIABLE ERR
|
||||
)
|
||||
|
||||
if(NOT ${ERR} EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to optimize \"@GAME_RESOURCES_ZIP@\" (error code: ${ERR})")
|
||||
endif()
|
23
scripts/pack.py
Executable file
23
scripts/pack.py
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
from zipfile import ZipFile, ZIP_DEFLATED
|
||||
|
||||
assert(len(sys.argv) > 4)
|
||||
archive = sys.argv[1]
|
||||
sourcedir = sys.argv[2]
|
||||
depfile = sys.argv[3]
|
||||
directories = sys.argv[4:]
|
||||
|
||||
with ZipFile(archive, "w", ZIP_DEFLATED) as zf:
|
||||
for directory in directories:
|
||||
for root, dirs, files in os.walk(directory):
|
||||
for fn in files:
|
||||
abspath = os.path.join(root, fn)
|
||||
rel = os.path.join(os.path.basename(directory), os.path.relpath(abspath, directory))
|
||||
zf.write(abspath, rel)
|
||||
|
||||
with open(depfile, "w") as df:
|
||||
l = [archive + ":"] + [os.path.join(sourcedir, x) for x in zf.namelist()]
|
||||
df.write(" \\\n ".join(l))
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
message(STATUS "Compressing game data")
|
||||
|
||||
execute_process(
|
||||
COMMAND @CMAKE_COMMAND@ -E tar vcf @GAME_RESOURCES_ZIP@ --format=zip .
|
||||
WORKING_DIRECTORY "@CMAKE_CURRENT_SOURCE_DIR@/resources"
|
||||
RESULT_VARIABLE ERR
|
||||
)
|
||||
|
||||
if(NOT ${ERR} EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to package \"@GAME_RESOURCES_ZIP@\" (error code: ${ERR})")
|
||||
endif()
|
64
scripts/version.py
Executable file
64
scripts/version.py
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
from subprocess import check_output
|
||||
from collections import OrderedDict
|
||||
|
||||
assert(len(sys.argv) == 6)
|
||||
|
||||
root = sys.argv[1]
|
||||
inpath = sys.argv[2]
|
||||
outpath = sys.argv[3]
|
||||
buildtype = sys.argv[4].strip()
|
||||
v_fallback = sys.argv[5].strip()
|
||||
|
||||
try:
|
||||
git = check_output(['git', 'describe', '--tags', '--match', 'v[0-9]*[!asz]'], cwd=root, universal_newlines=True)
|
||||
version_str = git.strip()
|
||||
except:
|
||||
print("Warning: git not found or not a git repository; using fallback version {0}".format(v_fallback), file=sys.stderr)
|
||||
version_str = v_fallback
|
||||
|
||||
version_str = version_str.lstrip("v")
|
||||
vparts = version_str.split("-")[0].split(".")
|
||||
vextra = version_str.replace("+", "-").split("-")
|
||||
if len(vextra) > 1:
|
||||
vextra = vextra[1]
|
||||
else:
|
||||
vextra = "0"
|
||||
|
||||
if len(vparts) > 3:
|
||||
print("Error: Too many dot-separated elements in version string '{0}'. Please use the following format: [v]major[.minor[.patch]][-tweak[-extrainfo]]".format(version_str), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
elif len(vparts[0]) == 0 or not vextra.isnumeric():
|
||||
print("Error: Invalid version string '{0}'. Please use the following format: [v]major[.minor[.patch]][-tweak[-extrainfo]]".format(version_str), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if buildtype.lower().startswith("debug"):
|
||||
buildtype_def = "#define DEBUG_BUILD"
|
||||
else:
|
||||
buildtype_def = "#define RELEASE_BUILD"
|
||||
|
||||
version = [("${TAISEI_VERSION_MAJOR}", 0),
|
||||
("${TAISEI_VERSION_MINOR}", 0),
|
||||
("${TAISEI_VERSION_PATCH}", 0),
|
||||
("${TAISEI_VERSION_TWEAK}", vextra),
|
||||
("${TAISEI_VERSION}", version_str),
|
||||
("${TAISEI_VERSION_FULL_STR}", "Taisei v" + version_str),
|
||||
("${MESON_BUILD_TYPE}", buildtype),
|
||||
("${ICONS_DIR}", os.path.join(root, "misc", "icons")),
|
||||
("${BUILDTYPE_DEFINE}", buildtype_def)]
|
||||
|
||||
for p in vparts:
|
||||
c = version.pop(0)
|
||||
version.append((c[0], int(p)))
|
||||
|
||||
with open(inpath, "r") as infile:
|
||||
template = infile.read()
|
||||
|
||||
for k, v in version:
|
||||
template = template.replace(k, str(v))
|
||||
|
||||
with open(outpath, "w") as outfile:
|
||||
print(template, file=outfile)
|
|
@ -1,441 +0,0 @@
|
|||
include(CheckSymbolExists)
|
||||
include(CheckAndSetFlags)
|
||||
|
||||
if(LINK_TO_LIBGL)
|
||||
add_definitions(-DLINK_TO_LIBGL)
|
||||
endif()
|
||||
|
||||
if(NOT USE_ZIP OR NOT ZIP_SUPPORTED)
|
||||
message(STATUS "ZIP support disabled")
|
||||
add_definitions(-DDISABLE_ZIP)
|
||||
else()
|
||||
message(STATUS "ZIP support enabled")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/version_auto.c.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/version_auto.c"
|
||||
)
|
||||
|
||||
check_symbol_exists(_POSIX_VERSION "unistd.h" POSIX)
|
||||
check_symbol_exists(__STDC_NO_COMPLEX__ "unistd.h" COMPLEX_MISSING)
|
||||
check_symbol_exists(__STDC_NO_VLA__ "unistd.h" VLA_MISSING)
|
||||
|
||||
# This doesn't work on gcc...
|
||||
# check_symbol_exists(_mm_crc32_u8 "immintrin.h" HAVE_INTEL_INTRIN)
|
||||
|
||||
unset(HAVE_INTEL_INTRIN CACHE)
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <immintrin.h>
|
||||
__attribute__((target(\"sse4.2\")))
|
||||
int main(int argc, char **argv) {
|
||||
return _mm_crc32_u8(argc, 42);
|
||||
}
|
||||
" HAVE_INTEL_INTRIN)
|
||||
|
||||
if(COMPLEX_MISSING OR VLA_MISSING)
|
||||
message(FATAL_ERROR "Your C implementation needs to support complex numbers and variable length arrays.")
|
||||
endif()
|
||||
|
||||
set(SRCs
|
||||
main.c
|
||||
cli.c
|
||||
log.c
|
||||
util.c
|
||||
taiseigl.c
|
||||
random.c
|
||||
config.c
|
||||
color.c
|
||||
recolor.c
|
||||
gamepad.c
|
||||
stage.c
|
||||
stagedraw.c
|
||||
stagetext.c
|
||||
stageobjects.c
|
||||
replay.c
|
||||
global.c
|
||||
events.c
|
||||
player.c
|
||||
aniplayer.c
|
||||
projectile.c
|
||||
progress.c
|
||||
enemy.c
|
||||
item.c
|
||||
list.c
|
||||
refs.c
|
||||
hashtable.c
|
||||
objectpool.c
|
||||
# objectpool_fake.c
|
||||
objectpool_util.c
|
||||
boss.c
|
||||
plrmodes.c
|
||||
plrmodes/marisa.c
|
||||
plrmodes/marisa_a.c
|
||||
plrmodes/marisa_b.c
|
||||
plrmodes/youmu.c
|
||||
plrmodes/youmu_a.c
|
||||
plrmodes/youmu_b.c
|
||||
laser.c
|
||||
dialog.c
|
||||
fbo.c
|
||||
vbo.c
|
||||
stageutils.c
|
||||
matrix.c
|
||||
video.c
|
||||
transition.c
|
||||
color.c
|
||||
difficulty.c
|
||||
audio_common.c
|
||||
hirestime.c
|
||||
menu/menu.c
|
||||
menu/mainmenu.c
|
||||
menu/options.c
|
||||
menu/stageselect.c
|
||||
menu/replayview.c
|
||||
menu/ingamemenu.c
|
||||
menu/gameovermenu.c
|
||||
menu/savereplay.c
|
||||
menu/difficultyselect.c
|
||||
menu/charselect.c
|
||||
menu/stagepractice.c
|
||||
menu/submenus.c
|
||||
menu/spellpractice.c
|
||||
menu/common.c
|
||||
stages/stage1.c
|
||||
stages/stage1_events.c
|
||||
stages/stage2.c
|
||||
stages/stage2_events.c
|
||||
stages/stage3.c
|
||||
stages/stage3_events.c
|
||||
stages/stage4.c
|
||||
stages/stage4_events.c
|
||||
stages/stage5.c
|
||||
stages/stage5_events.c
|
||||
stages/stage6.c
|
||||
stages/stage6_events.c
|
||||
ending.c
|
||||
credits.c
|
||||
resource/resource.c
|
||||
resource/texture.c
|
||||
resource/animation.c
|
||||
resource/font.c
|
||||
resource/shader.c
|
||||
resource/model.c
|
||||
resource/postprocess.c
|
||||
rwops/rwops_dummy.c
|
||||
rwops/rwops_zlib.c
|
||||
rwops/rwops_segment.c
|
||||
rwops/rwops_autobuf.c
|
||||
vfs/private.c
|
||||
vfs/public.c
|
||||
vfs/setup.c
|
||||
vfs/pathutil.c
|
||||
vfs/union.c
|
||||
vfs/union_public.c
|
||||
vfs/vdir.c
|
||||
vfs/syspath_public.c
|
||||
vfs/zipfile_public.c
|
||||
version.c
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/version_auto.c"
|
||||
)
|
||||
|
||||
if(USE_INTEL_INTRIN AND HAVE_INTEL_INTRIN)
|
||||
set(SRCs ${SRCs}
|
||||
util_sse42.c
|
||||
)
|
||||
add_definitions(-DHAVE_INTEL_INTRIN)
|
||||
set_property(SOURCE util_sse42.c APPEND_STRING PROPERTY COMPILE_FLAGS "-msse4.2")
|
||||
endif()
|
||||
|
||||
if(USE_ZIP AND ZIP_SUPPORTED)
|
||||
set(SRCs ${SRCs}
|
||||
rwops/rwops_zipfile.c
|
||||
vfs/zipfile.c
|
||||
vfs/zippath.c
|
||||
)
|
||||
else()
|
||||
set(SRCs ${SRCs}
|
||||
vfs/zipfile_null.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(SRCs ${SRCs}
|
||||
windows_misc.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(POSIX)
|
||||
set(SRCs ${SRCs}
|
||||
vfs/syspath_posix.c
|
||||
rwops/rwops_pipe_posix.c
|
||||
)
|
||||
elseif(WIN32)
|
||||
set(SRCs ${SRCs}
|
||||
vfs/syspath_win32.c
|
||||
rwops/rwops_pipe_null.c
|
||||
)
|
||||
set(LIBs ${LIBs}
|
||||
shlwapi
|
||||
)
|
||||
else()
|
||||
set(SRCs ${SRCs}
|
||||
vfs/syspath_posix.c # eeehh, maybe it'll work ¯\_(ツ)_/¯
|
||||
rwops/rwops_pipe_null.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_AUDIO)
|
||||
set(SRCs ${SRCs}
|
||||
audio_mixer.c
|
||||
resource/bgm_mixer.c
|
||||
resource/sfx_mixer.c
|
||||
)
|
||||
else()
|
||||
set(SRCs ${SRCs}
|
||||
audio_null.c
|
||||
resource/bgm_null.c
|
||||
resource/sfx_null.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(DEBUG_FLAGS "-gstabs")
|
||||
else()
|
||||
set(DEBUG_FLAGS "-ggdb")
|
||||
endif()
|
||||
|
||||
set(DEBUG_FLAGS "${DEBUG_FLAGS} -fno-omit-frame-pointer")
|
||||
set(RELEASE_FLAGS "-DNDEBUG")
|
||||
|
||||
set(DEBUG_BUILD FALSE) # "Debug build" is a build where ${DEBUG_FLAGS} are used.
|
||||
set(RELEASE_BUILD FALSE) # "Release build" is a build where ${RELEASE_FLAGS} are used.
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" AND RELWITHDEBINFO_USE_DEBUG_FLAGS))
|
||||
set(DEBUG_BUILD TRUE)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
set(RELEASE_BUILD TRUE)
|
||||
endif()
|
||||
|
||||
if(DEBUG_USE_UBSAN)
|
||||
CHECK_AND_SET_FLAGS(COMPILER_SUPPORTS_UBSAN "-fsanitize=undefined" DEBUG_FLAGS "-fsanitize=undefined")
|
||||
endif()
|
||||
|
||||
if(DEBUG_USE_ASAN)
|
||||
CHECK_AND_SET_FLAGS(COMPILER_SUPPORTS_ASAN "-fsanitize=address" DEBUG_FLAGS "-fsanitize=address")
|
||||
endif()
|
||||
|
||||
if(RELEASE_USE_LTO)
|
||||
CHECK_AND_SET_FLAGS(COMPILER_SUPPORTS_LTO "-flto" RELEASE_FLAGS "-flto")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${DEBUG_FLAGS} -DDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${RELEASE_FLAGS} -O3")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${RELEASE_FLAGS} -O2")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${RELEASE_FLAGS} -Os")
|
||||
|
||||
if(RELWITHDEBINFO_USE_DEBUG_FLAGS)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${DEBUG_FLAGS}")
|
||||
endif()
|
||||
|
||||
check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE)
|
||||
if(${HAVE_BACKTRACE})
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLOG_ENABLE_BACKTRACE")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DLOG_ENABLE_BACKTRACE")
|
||||
endif()
|
||||
|
||||
set(WANT_WARNINGS
|
||||
"all"
|
||||
"pedantic"
|
||||
"parentheses"
|
||||
"type-limits"
|
||||
"strict-prototypes"
|
||||
"long-long"
|
||||
"init-self"
|
||||
"null-dereference"
|
||||
"format-pedantic"
|
||||
"gcc-compat"
|
||||
"float-overflow-conversion"
|
||||
"float-zero-conversion"
|
||||
"for-loop-analysis"
|
||||
"implicit-fallthrough"
|
||||
"sometimes-uninitialized"
|
||||
"unneeded-internal-declaration"
|
||||
"unreachable-code"
|
||||
"unreachable-code-loop-increment"
|
||||
"gnu"
|
||||
)
|
||||
|
||||
foreach(warning IN LISTS WANT_WARNINGS)
|
||||
CHECK_AND_SET_FLAGS(COMPILER_HAS_W${warning} "-W${warning}" WARNINGS)
|
||||
endforeach()
|
||||
|
||||
if(RELATIVE)
|
||||
add_definitions(-DRELATIVE)
|
||||
endif()
|
||||
|
||||
if(WERROR)
|
||||
set(WARNINGS "${WARNINGS} -Werror")
|
||||
endif()
|
||||
|
||||
if(FATALERRS)
|
||||
set(WARNINGS "${WARNINGS} -Wfatal-errors")
|
||||
endif()
|
||||
|
||||
add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}" -std=c11 ${WARNINGS})
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
add_definitions(-DLOG_FATAL_MSGBOX)
|
||||
endif()
|
||||
|
||||
set(LIBs ${LIBs}
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_TTF_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
m)
|
||||
|
||||
set(LIBDIRs
|
||||
${SDL2_LIBRARY_DIRS}
|
||||
${SDL2_TTF_LIBRARY_DIRS}
|
||||
${ZLIB_LIBRARY_DIRS}
|
||||
${PNG_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if(${WIN32})
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO)
|
||||
set(LIBs ${LIBs} -ldxguid -lwinmm)
|
||||
|
||||
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
|
||||
enable_language(RC)
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE>")
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/taisei.rc.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/taisei.rc"
|
||||
)
|
||||
|
||||
set(SRCs ${SRCs} "${CMAKE_CURRENT_BINARY_DIR}/taisei.rc")
|
||||
endif()
|
||||
|
||||
set(INCs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
${SDL2_TTF_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(LINK_TO_LIBGL)
|
||||
set(INCs ${INCs} ${OPENGL_INCLUDE_DIR})
|
||||
set(LIBs ${LIBs} ${OPENGL_gl_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(USE_ZIP AND ZIP_SUPPORTED)
|
||||
set(INCs ${INCs} ${ZIP_INCLUDE_DIRS})
|
||||
set(LIBs ${LIBs} ${ZIP_LIBRARIES})
|
||||
set(LIBDIRs ${LIBDIRs} ${ZIP_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
if(USE_AUDIO)
|
||||
set(INCs ${INCs} ${SDL2_MIXER_INCLUDE_DIRS})
|
||||
set(LIBs ${LIBs} ${SDL2_MIXER_LIBRARIES})
|
||||
set(LIBDIRs ${LIBDIRs} ${SDL2_MIXER_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${INCs})
|
||||
include_directories(${INCs})
|
||||
|
||||
if(POSIX)
|
||||
add_definitions(-D__POSIX__)
|
||||
endif()
|
||||
|
||||
if (CMAKE_GENERATOR STREQUAL "Ninja" AND
|
||||
((CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) OR
|
||||
(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.5)))
|
||||
# Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support.
|
||||
# Rationale in https://github.com/ninja-build/ninja/issues/814
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
|
||||
endif()
|
||||
|
||||
list(SORT SRCs)
|
||||
list(REMOVE_DUPLICATES SRCs)
|
||||
|
||||
link_directories(${LIBDIRs})
|
||||
|
||||
if(TAISEI_WIN32_CONSOLE)
|
||||
list(REMOVE_ITEM LIBs -mwindows)
|
||||
add_executable(taisei MACOSX_BUNDLE ${SRCs})
|
||||
else()
|
||||
add_executable(taisei MACOSX_BUNDLE WIN32 ${SRCs})
|
||||
endif()
|
||||
|
||||
target_link_libraries(taisei ${LIBs})
|
||||
|
||||
set(MACOSX_BUNDLE_BUNDLE_NAME "Taisei")
|
||||
|
||||
if(WIN32)
|
||||
set(TAISEI_BINARY_SUFFIX ".exe")
|
||||
else()
|
||||
set(TAISEI_BINARY_SUFFIX "")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(taisei PROPERTIES
|
||||
OUTPUT_NAME "${MACOSX_BUNDLE_BUNDLE_NAME}"
|
||||
MACOSX_BUNDLE_ICON_FILE "Taisei"
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "Taisei"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "org.taisei-project.taisei"
|
||||
MACOSX_BUNDLE_COPYRIGHT "© 2011-2017, Taisei Project"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION "${TAISEI_VERSION_SIMPLE}.${TAISEI_VERSION_TWEAK}"
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "${TAISEI_VERSION_SIMPLE}"
|
||||
)
|
||||
|
||||
install(TARGETS taisei BUNDLE DESTINATION .)
|
||||
|
||||
set(OSX_BINARY_DIR "./${MACOSX_BUNDLE_BUNDLE_NAME}.app/Contents/MacOS")
|
||||
set(OSX_BINARY "${OSX_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}")
|
||||
set(DYLIBS_DIR_NAME "dylibs")
|
||||
set(DYLIBS_DIR_FINAL "${OSX_BINARY_DIR}/${DYLIBS_DIR_NAME}")
|
||||
set(DYLIBS_DIR_INTERMEDIATE "${CMAKE_CURRENT_BINARY_DIR}/${DYLIBS_DIR_NAME}")
|
||||
set(TAISEI_BINARY "${OSX_BINARY}")
|
||||
|
||||
configure_file(
|
||||
"${BUILDSCRIPTS_DIR}/OSXInstallDylibs.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/OSXInstallDylibs.cmake"
|
||||
@ONLY)
|
||||
|
||||
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/OSXInstallDylibs.cmake")
|
||||
install(DIRECTORY "${DYLIBS_DIR_INTERMEDIATE}" DESTINATION "${OSX_BINARY_DIR}")
|
||||
|
||||
add_custom_target(dmg
|
||||
COMMAND "${BUILDSCRIPTS_DIR}/osx-gen-dmg.sh"
|
||||
"${CMAKE_INSTALL_PREFIX}"
|
||||
"${PROJECT_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}-${TAISEI_VERSION}-macOS.dmg"
|
||||
DEPENDS install
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
elseif(RELATIVE)
|
||||
install(TARGETS taisei RUNTIME DESTINATION .)
|
||||
set(TAISEI_BINARY "./taisei")
|
||||
else()
|
||||
install(TARGETS taisei RUNTIME DESTINATION bin)
|
||||
set(TAISEI_BINARY "bin/taisei")
|
||||
endif()
|
||||
|
||||
set(TAISEI_BINARY "${TAISEI_BINARY}${TAISEI_BINARY_SUFFIX}")
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT APPLE)
|
||||
configure_file(
|
||||
"${BUILDSCRIPTS_DIR}/PostInstallRelease.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/PostInstallRelease.cmake"
|
||||
@ONLY)
|
||||
|
||||
install(
|
||||
SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/PostInstallRelease.cmake"
|
||||
)
|
||||
endif()
|
173
src/meson.build
Normal file
173
src/meson.build
Normal file
|
@ -0,0 +1,173 @@
|
|||
ver_fb = get_option('version_fallback').strip()
|
||||
version_fallback = ver_fb != '' ? ver_fb : meson.project_version()
|
||||
|
||||
version_script = find_program('../scripts/version.py')
|
||||
version_command = [version_script, meson.source_root(), '@INPUT@', '@OUTPUT@', get_option('buildtype'), version_fallback]
|
||||
version_deps = [custom_target('version file',
|
||||
command : version_command,
|
||||
build_always : true,
|
||||
input : 'version_auto.c.in',
|
||||
output : 'version_auto.c')]
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
winmod = import('windows')
|
||||
# HACK: compile_resources only accepts strings, not generated dependencies.
|
||||
# We still want to generate this every time though.
|
||||
rcpath = join_paths(meson.current_build_dir(), 'taisei.rc')
|
||||
c = run_command(version_script, meson.source_root(), 'taisei.rc.in', rcpath, get_option('buildtype'), version_fallback)
|
||||
if c.returncode() != 0
|
||||
error('Failed to generate Windows resource file:\n' + c.stderr())
|
||||
endif
|
||||
version_deps += custom_target('Windows resource file',
|
||||
command : version_command,
|
||||
build_always : true,
|
||||
input : 'taisei.rc.in',
|
||||
output : 'taisei.rc')
|
||||
version_deps += winmod.compile_resources(rcpath)
|
||||
endif
|
||||
|
||||
configure_file(configuration : config, output : 'build_config.h')
|
||||
|
||||
src_base = [
|
||||
'main.c',
|
||||
'cli.c',
|
||||
'log.c',
|
||||
'util.c',
|
||||
'taiseigl.c',
|
||||
'random.c',
|
||||
'config.c',
|
||||
'color.c',
|
||||
'recolor.c',
|
||||
'gamepad.c',
|
||||
'stage.c',
|
||||
'stagedraw.c',
|
||||
'stagetext.c',
|
||||
'replay.c',
|
||||
'global.c',
|
||||
'events.c',
|
||||
'player.c',
|
||||
'aniplayer.c',
|
||||
'projectile.c',
|
||||
'progress.c',
|
||||
'enemy.c',
|
||||
'item.c',
|
||||
'list.c',
|
||||
'hashtable.c',
|
||||
'boss.c',
|
||||
'plrmodes.c',
|
||||
'plrmodes/marisa.c',
|
||||
'plrmodes/marisa_a.c',
|
||||
'plrmodes/marisa_b.c',
|
||||
'plrmodes/youmu.c',
|
||||
'plrmodes/youmu_a.c',
|
||||
'plrmodes/youmu_b.c',
|
||||
'laser.c',
|
||||
'dialog.c',
|
||||
'fbo.c',
|
||||
'vbo.c',
|
||||
'stageutils.c',
|
||||
'matrix.c',
|
||||
'video.c',
|
||||
'transition.c',
|
||||
'color.c',
|
||||
'difficulty.c',
|
||||
'audio_common.c',
|
||||
'hirestime.c',
|
||||
'menu/menu.c',
|
||||
'menu/mainmenu.c',
|
||||
'menu/options.c',
|
||||
'menu/stageselect.c',
|
||||
'menu/replayview.c',
|
||||
'menu/ingamemenu.c',
|
||||
'menu/gameovermenu.c',
|
||||
'menu/savereplay.c',
|
||||
'menu/difficultyselect.c',
|
||||
'menu/charselect.c',
|
||||
'menu/stagepractice.c',
|
||||
'menu/submenus.c',
|
||||
'menu/spellpractice.c',
|
||||
'menu/common.c',
|
||||
'stages/stage1.c',
|
||||
'stages/stage1_events.c',
|
||||
'stages/stage2.c',
|
||||
'stages/stage2_events.c',
|
||||
'stages/stage3.c',
|
||||
'stages/stage3_events.c',
|
||||
'stages/stage4.c',
|
||||
'stages/stage4_events.c',
|
||||
'stages/stage5.c',
|
||||
'stages/stage5_events.c',
|
||||
'stages/stage6.c',
|
||||
'stages/stage6_events.c',
|
||||
'ending.c',
|
||||
'credits.c',
|
||||
'resource/resource.c',
|
||||
'resource/texture.c',
|
||||
'resource/animation.c',
|
||||
'resource/font.c',
|
||||
'resource/shader.c',
|
||||
'resource/model.c',
|
||||
'resource/postprocess.c',
|
||||
'rwops/rwops_dummy.c',
|
||||
'rwops/rwops_zlib.c',
|
||||
'rwops/rwops_segment.c',
|
||||
'rwops/rwops_autobuf.c',
|
||||
'vfs/private.c',
|
||||
'vfs/public.c',
|
||||
'vfs/setup.c',
|
||||
'vfs/pathutil.c',
|
||||
'vfs/union.c',
|
||||
'vfs/union_public.c',
|
||||
'vfs/vdir.c',
|
||||
'vfs/syspath_public.c',
|
||||
'vfs/zipfile_public.c',
|
||||
'version.c',
|
||||
]
|
||||
|
||||
if taisei_deps.contains(dep_sdl2_mixer)
|
||||
src_base += [
|
||||
'audio_mixer.c',
|
||||
'resource/bgm_mixer.c',
|
||||
'resource/sfx_mixer.c',
|
||||
]
|
||||
else
|
||||
src_base += [
|
||||
'audio_null.c',
|
||||
'resource/bgm_null.c',
|
||||
'resource/sfx_null.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if taisei_deps.contains(dep_zip)
|
||||
src_base += [
|
||||
'rwops/rwops_zipfile.c',
|
||||
'vfs/zipfile.c',
|
||||
'vfs/zippath.c',
|
||||
]
|
||||
else
|
||||
src_base += ['vfs/zipfile_null.c']
|
||||
endif
|
||||
|
||||
if have_posix
|
||||
src_base += [
|
||||
'vfs/syspath_posix.c',
|
||||
'rwops/rwops_pipe_posix.c',
|
||||
]
|
||||
elif host_machine.system() == 'windows'
|
||||
src_base += [
|
||||
'windows_misc.c',
|
||||
'vfs/syspath_win32.c',
|
||||
'rwops/rwops_pipe_null.c',
|
||||
]
|
||||
else
|
||||
src_base += [
|
||||
'vfs/syspath_posix.c', # eeehh, maybe it'll work ¯\_(ツ)_/¯
|
||||
'rwops/rwops_pipe_null.c',
|
||||
]
|
||||
endif
|
||||
|
||||
taisei_exe = executable('taisei', src_base, version_deps,
|
||||
dependencies : taisei_deps,
|
||||
c_args : taisei_c_args,
|
||||
gui_app : not get_option('win_console'),
|
||||
install : true)
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright (c) 2012-2017, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#include "build_config.h"
|
||||
#include "rwops_zlib.h"
|
||||
#include "rwops_segment.h"
|
||||
#include "rwops_autobuf.h"
|
||||
|
|
|
@ -12,8 +12,7 @@ STRINGTABLE BEGIN
|
|||
IDS_REPLAY, "Taisei Project replay"
|
||||
END
|
||||
|
||||
#cmakedefine DEBUG_BUILD
|
||||
#cmakedefine RELEASE_BUILD
|
||||
${BUILDTYPE_DEFINE}
|
||||
|
||||
#ifdef DEBUG_BUILD
|
||||
#define F_DEBUG VS_FF_DEBUG
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
const char *const TAISEI_VERSION = "${TAISEI_VERSION}";
|
||||
const char *const TAISEI_VERSION_FULL = "${TAISEI_VERSION_FULL_STR}";
|
||||
const char *const TAISEI_VERSION_BUILD_TYPE = "${CMAKE_BUILD_TYPE}";
|
||||
const char *const TAISEI_VERSION_BUILD_TYPE = "${MESON_BUILD_TYPE}";
|
||||
|
||||
const uint8_t TAISEI_VERSION_MAJOR = ${TAISEI_VERSION_MAJOR};
|
||||
const uint8_t TAISEI_VERSION_MINOR = ${TAISEI_VERSION_MINOR};
|
||||
|
|
|
@ -6,19 +6,18 @@
|
|||
* Copyright (c) 2012-2017, Andrei Alexeyev <akari@alienslab.net>.
|
||||
*/
|
||||
|
||||
#include "build_config.h"
|
||||
#include "public.h"
|
||||
#include "setup.h"
|
||||
|
||||
#define STATIC_RESOURCE_PREFIX PREFIX "/share/taisei/"
|
||||
|
||||
static char* get_default_res_path(void) {
|
||||
char *res;
|
||||
|
||||
#ifdef RELATIVE
|
||||
res = SDL_GetBasePath();
|
||||
strappend(&res, "data/");
|
||||
strappend(&res, DATA_PATH);
|
||||
#else
|
||||
res = strdup(STATIC_RESOURCE_PREFIX);
|
||||
res = strdup(DATA_PATH);
|
||||
#endif
|
||||
|
||||
return res;
|
||||
|
|
10
xdg/meson.build
Normal file
10
xdg/meson.build
Normal file
|
@ -0,0 +1,10 @@
|
|||
if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
|
||||
install_data('taisei-replay-viewer.desktop', 'taisei.desktop',
|
||||
install_dir : join_paths(get_option('datadir'), 'applications'))
|
||||
install_data('taisei.png',
|
||||
install_dir : join_paths(get_option('datadir'), 'icons/hicolor/128x128/apps'))
|
||||
install_data('taisei-replay.png',
|
||||
install_dir : join_paths(get_option('datadir'), 'icons/hicolor/256x256/mimetypes'))
|
||||
install_data('taisei.xml',
|
||||
install_dir : join_paths(get_option('datadir'), 'mime/packages'))
|
||||
endif
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Loading…
Reference in a new issue