Commit Graph

138 Commits

Author SHA1 Message Date
Igor Gnatenko 971a3a3cd9 tree-wide: remove trailing whitespaces
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:34:02 +01:00
Igor Gnatenko e611b6748b tree-wide: remove unused variables
./mesonbuild/scripts/regen_checker.py:35:5: F841 local variable 'scriptdir' is assigned to but never used
    scriptdir = os.path.split(__file__)[0]
    ^
./mesonbuild/scripts/yelphelper.py:84:13: F841 local variable 'symfile' is assigned to but never used
            symfile = os.path.join(install_dir, m)
            ^
./mesonbuild/backend/backends.py:164:13: F841 local variable 'lang' is assigned to but never used
            lang = comp.get_language()
            ^
./mesonbuild/backend/ninjabackend.py:1286:9: F841 local variable 'scriptdir' is assigned to but never used
        scriptdir = self.environment.get_script_dir()
        ^
./mesonbuild/backend/vs2010backend.py:736:9: F841 local variable 'additional_options_set' is assigned to but never used
        additional_options_set = True
        ^

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:22:20 +01:00
Igor Gnatenko 8268eb4959 tree-wide: remove unused imports
./setup.py:17:1: F401 'os' imported but unused
import os
^
./setup.py:37:1: F401 'stat.ST_MODE' imported but unused
from stat import ST_MODE
^
./run_tests.py:17:1: F401 'os' imported but unused
import subprocess, sys, os
^
./run_tests.py:18:1: F401 'shutil' imported but unused
import shutil
^
./run_unittests.py:23:1: F401 'mesonbuild.dependencies.Qt5Dependency' imported but unused
from mesonbuild.dependencies import PkgConfigDependency, Qt5Dependency
^
./mesonbuild/build.py:15:1: F401 '.coredata' imported but unused
from . import coredata
^
./mesonbuild/interpreter.py:32:1: F401 'subprocess' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/interpreter.py:32:1: F401 're' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/dependencies.py:23:1: F401 'subprocess' imported but unused
import os, stat, glob, subprocess, shutil
^
./mesonbuild/mesonlib.py:17:1: F401 'sys' imported but unused
import platform, subprocess, operator, os, shutil, re, sys
^
./mesonbuild/modules/qt5.py:15:1: F401 'subprocess' imported but unused
import os, subprocess
^
./mesonbuild/modules/pkgconfig.py:15:1: F401 '..coredata' imported but unused
from .. import coredata, build
^
./mesonbuild/scripts/scanbuild.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/meson_exe.py:20:1: F401 'subprocess' imported but unused
import subprocess
^
./mesonbuild/scripts/meson_exe.py:22:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/symbolextractor.py:23:1: F401 'subprocess' imported but unused
import os, sys, subprocess
^
./mesonbuild/scripts/symbolextractor.py:25:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/meson_install.py:19:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/yelphelper.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/yelphelper.py:20:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException
^
./mesonbuild/backend/vs2010backend.py:17:1: F401 're' imported but unused
import re
^
./test cases/vala/8 generated sources/src/copy_file.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/107 postconf/postconf.py:3:1: F401 'sys' imported but unused
import sys, os
^
./test cases/common/129 object only target/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^
./test cases/common/57 custom target chain/usetarget/subcomp.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/95 dep fallback/subprojects/boblib/genbob.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/98 gen extra/srcgen.py:4:1: F401 'os' imported but unused
import os
^
./test cases/common/113 generatorcustom/gen.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/113 generatorcustom/catter.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/59 object generator/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:19:35 +01:00
Nirbheek Chauhan d5f7ba862b gnome.mkenums: Use absolute paths for all commandline args
Closes #973

test cases/vala/8 generated sources/ tests this.
2016-12-15 14:58:43 +05:30
Jussi Pakkanen f62f730821 Merge pull request #1126 from mesonbuild/sharedmodule
Support for shared modules
2016-12-07 21:49:16 +02:00
Jussi Pakkanen dc1f537fb3 Skip shared module test on VS because it fails for some reason nobody understands. 2016-12-07 00:30:28 +02:00
Jussi Pakkanen 59fdb1b9ff Add unresolved symbol arg to link line in VS backends. For some
reason VS does not pick it up even though it is visible in the linker
option box.
2016-12-06 21:35:31 +02:00
Nirbheek Chauhan b9a7c0cf39 misc: Use relative imports everywhere
Using 'mesonbuild' as the module can cause it to use the
system-installed module and can also break if we rename the directory,
so avoid that by always using relative imports.
2016-12-07 00:24:17 +05:30
Thibault Saunier 85a0cd7635 Add new add_project_[link]_args functions
Fixes 979
2016-11-12 17:34:06 -05:00
Nirbheek Chauhan 00dc929b62 vs: Properly split per-compiler args into per-file options
Previously we were just dumping all defines and include directories into
the target-wide list of defines and include directories. Now we have
separate per-target and per-file (actually per-language) arguments,
defines, and include directories.
2016-11-10 00:40:16 +05:30
Nirbheek Chauhan 419b84784f CustomTarget: Use get_outputs() instead of get_filename()
get_filename() made no sense for CustomTarget since it can have multiple
outputs. Also use get_outputs() for GeneratedList since it has the same
meaning and remove unused set_generated().

As a side-effect, we now install all the outputs of a CustomTarget.
2016-10-19 20:42:11 +05:30
Elliott Sales de Andrade 4c71695e41 Use context manager for file I/O.
There are a few cases where a context manager cannot be used, such as
the logger.
2016-08-27 18:29:55 -04:00
Nirbheek Chauhan 2d05008956 vs: Fix quoting and escaping of compiler options
Target-specific compiler options should be split into pre-processor
defines, include directories, and additional options, then
escaped/quoted and added to the appropriate portions of the project
file.

The "115 spaces backslash" test now checks that backslashes and spaces
now work properly in all three places.
2016-07-29 19:51:10 +05:30
Nirbheek Chauhan 129ce6800c vs: Fix visual studio version in solution file (#648) 2016-07-18 23:59:09 +03:00
Nirbheek Chauhan 6660837953 vs: Target platform is not always Win32
It depends on the target machine. Without this building for 64-bit fails
when using external dependencies.
2016-07-11 17:11:49 +05:30
Nirbheek Chauhan 6bb9805749 vs: Don't re-add pre-existing include dirs
Reduces noise in the vcxproj files
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan afca987e94 vs: Fix usage of mesonlib.File.rel_to_builddir with generated files
It should always be passed build_to_src otherwise the path for generated
files will always be wrong. Passing the vcxproj path as the build_to_src
only works for files in the source tree.
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 2535364751 vs: Explain path-conversion variables
It's not easy to understand what these variables mean and what they're
used for without some comments
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 761ac8d8c4 vs: Add support for the 'vs_module_defs' shared_library kwarg 2016-07-01 20:50:47 +05:30
Nirbheek Chauhan f54e07bcd8 vs: Fix the path of customtarget generated sources
The path is relative to the vcxproj file, not relative to the build root
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 23d29ffb14 vs: Set all compiler/linker options correctly
These need to be set via XML tags and not passed directly as
AdditionalOptions. Otherwise the project will end up with inconsistent
compiler options and the build will fail.

Since Meson internals assume that these will be set via a command-line
invocation, we need to detect the presence of various flags in
buildtype_args and buildtype_link_args and set the correct options in
the vcxproj file.

Note that this means different configurations (debug/release/etc) cannot
be enumerated in the vcxproj/sln files and chosen by the user at build
time because arbitrary build characteristics can depend on that. The
only way to support that is by doing a full parse and conversion of
Meson build files (for all build options) to vcxproj files.
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 2f8eaa6ed4 vs: Fix paths of internal library dependencies
They are relative to the path of the vcxproj file, not relative to build root
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 1481715618 vs: Add libraries, library paths, and link args needed by dependencies
The link arguments for each dependency are split into these three and
added to the vcxproj file. Without this targets cannot find the external
dependencies.
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan f564bf9af0 vs: Add include dirs required by dependencies
Also ensure that they're translated from UNIX to native as required
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 80486563bf vs: Set TargetName/TargetExt correctly
Without this the filename set by the user and Meson is completely ignored
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan 0143c32c7c Overhaul versioning and naming of libraries
This commit contains several changes to the naming and versioning of
shared and static libraries. The details are documented at:
https://github.com/mesonbuild/meson/pull/417

Here's a brief summary:

* The results of binary and compiler detection via environment functions
  are now cached so that they can be called repeatedly without
  performance penalty. This is necessary because every
  build.SharedLibrary object has to know whether the compiler is MSVC or
  not (output filenames depend on that), and so the compiler detection
  has to be called for each object instantiation.

* Linux shared libraries don't always have a library version. Sometimes
  only soversions are specified (and vice-versa), so support both.

* Don't use versioned filenames when generating DLLs, DLLs are never
  versioned using the suffix in the way that .so libraries are. Hence,
  they don't use "aliases". Only Linux shared libraries use those.

* OS X dylibs do not use filename aliases at all. They only use the
  soversion in the dylib name (libfoo.X.dylib), and that's it. If
  there's no soversion specified, the dylib is called libfoo.dylib.
  Further versioning in dylibs is supposed to be done with the
  -current_version argument to clang, but this is TBD.

  https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23

* Install DLLs into bindir and import libraries into libdir

* Static libraries are now always called libfoo.a, even with MSVC

* .lib import libraries are always generated when building with MSVC

* .dll.a import libraries are always generated when building with
  MinGW/GCC or MinGW/clang

* TODO: Use dlltool if available to generate .dll.a when .lib is
  generated and vice-versa.

* Library and executable suffix/prefixes are now always correctly
  overriden by the values of the 'name_prefix' and 'name_suffix' keyword
  arguments.
2016-07-01 20:50:47 +05:30
Nirbheek Chauhan b1077dded7 vs backends: Translate unix link and compile flags (#603) 2016-06-17 22:24:43 +03:00
Nicolas Schneider fba749fcb7 extract vs2015backend into own file 2016-05-30 22:00:20 +02:00
Nicolas Schneider d34d85b0f5 vs2015: fix object generators 2016-05-30 21:49:37 +02:00
Nicolas Schneider 3bedca0257 add vs2015 backend 2016-05-30 21:49:35 +02:00
Nicolas Schneider a29d9c2c33 vs: fix generators that use indexed output replacements (like @OUTPUT0@) 2016-05-26 13:08:33 +02:00
Jussi Pakkanen 2e2df70dd0 Merge branch 'centricular-customtarget-path-windows' 2016-05-01 18:39:45 +03:00
Nicolas Schneider 985ea50944 vs2010: add object files from custom_target to project
Object files from a custom_target are like external objects and must be
added to the project.
Object files from a generator are automatically used by MSBuild, since they
are part of the CustomBuildStep and thus part of the same project as the
current build target.
2016-04-19 23:25:45 +02:00
Nicolas Schneider 060f195fe0 vs2010: add generated libs as link dependencies 2016-04-19 23:25:45 +02:00
Nicolas Schneider 1ccb4b3a51 vs2010: add dirs of custom_target generated files to include dirs 2016-04-19 23:25:45 +02:00
Nirbheek Chauhan 86aa51232e backends: Don't duplicate test setup data file name
Instead, return the values of the test and benchmark setup data files so
that the ninja/osx/vs backends can use those filenames instead of
hard-coding them.
2016-04-15 05:49:42 +05:30
Jussi Pakkanen cab5ce4fc0 Merge pull request #438 from trhd/testing_options
New options for controlling test output.
2016-04-06 23:10:20 +03:00
Nicolas Schneider 536edb65d6 vs2010: replace " with \" in /D command line args
The /D switch strips any quotes except when they are escaped.
2016-04-06 22:10:29 +03:00
Hemmo Nieminen 336904b553 Move MesonException from coredata to mesonlib. 2016-04-01 00:52:45 +03:00
Jussi Pakkanen 5bb94b901d Merge pull request #486 from nioncode/vs-transitivedeps
vs2010: fix transitive dependencies
2016-03-31 22:20:19 +03:00
Nicolas Schneider b970ef692f vs2010: add extra_files to project 2016-03-30 12:38:28 +02:00
Nicolas Schneider 33e842e50a vs2010: fix transitive dependencies 2016-03-30 00:35:07 +02:00
Jussi Pakkanen f3386d10c3 Merge branch 'vs-privinc' 2016-03-29 22:50:15 +03:00
Jussi Pakkanen 833520afb5 Merge branch 'vs-fixinclude' 2016-03-29 22:45:45 +03:00
Jussi Pakkanen 1d89d091f8 Merge branch 'vs-extraargs' 2016-03-29 22:32:48 +03:00
Jussi Pakkanen 5ea24bafdd Merge branch 'samename' 2016-03-29 22:25:16 +03:00
Nicolas Schneider a33d9d56cf vs2010: support EXTRA_ARGS for generators 2016-03-29 12:08:34 +02:00
Nicolas Schneider c2a9f81b68 vs2010: fix generated files' path
Generated files should always come with the correct relative path set,
so we don't have to modify it at all.
2016-03-29 12:08:34 +02:00
Nicolas Schneider ba8b650cda vs2010: fix relative path to target private dir for generators
backend.get_target_private_dir() includes the target directory in the path.
However, we want to treat all paths relative from the target directory,
because that's where our VS project file lives in.
2016-03-29 12:08:34 +02:00
Nicolas Schneider 330be891c1 vs2010: fix generator command
A shebang line on Windows will be resolved to [binary, script_path].
Thus, we need to use both instead of just taking the first element of the
command.
2016-03-29 12:08:09 +02:00
Nicolas Schneider 30e2a5feae vs2010: fix include directories
Everything in the VS project file is relative to the project file itself.
The project file gets put in the target.subdir, so to include files from
there we just need to use '.'. To include from the private dir, we
need to use the relative path from the target dir to the target private
dir.
2016-03-29 11:50:50 +02:00
Nicolas Schneider 9c17f0cd93 vs2010: support private include dirs 2016-03-29 11:49:40 +02:00
Nicolas Schneider fd8180ddcb move source file conflict detection into Vs2010 backend 2016-03-28 14:42:52 +02:00
Nicolas Schneider 84804fc531 vs2010: use copy of buildtype_args to not change global state
We do not want the modifications of general_args to propagate to the
global buildtype_args.
2016-03-25 11:01:07 +01:00
Nicolas Schneider 8787ec3ea2 vs2010: fix object extraction with same source file name
This also refactors determine_ext_objs() to use inheritance instead of a
method flag for determining the object output name.
2016-03-25 09:49:30 +01:00
Nicolas Schneider 0c4aab6eed vs2010: support same source file names in different subdirs 2016-03-24 23:44:44 +01:00
Jussi Pakkanen 9071c8fc45 Merge branch 'Custom target absolute paths'. 2016-03-20 21:39:49 +02:00
Jussi Pakkanen c1a0bd9a52 Merge pull request #441 from nioncode/vs-compile-args
vs2010: fix compile args
2016-03-20 21:24:48 +02:00
Jussi Pakkanen a3d49ca1ce Merge pull request #453 from nioncode/vs-customTargetDependencies
vs2010: fix dependencies of CustomTarget
2016-03-20 18:49:53 +02:00
Nicolas Schneider 147b7aa356 vs2010: add explicit objects as 'Object' ItemGroup instead of link dependency
This has two effects:
1. It makes targets with only object files work (test case 88).
2. It adds the object files to the project in the VS IDE.
2016-03-17 13:13:28 +01:00
Nicolas Schneider d72cc6e6f8 vs2010: fix object extraction
1. Dependencies must be set up with the target's id instead of its
basename.
2. Extracted object output file names must not include the directory
prefix, because MSBuild puts all object files into the same directory
and names them srcfilename.obj instead of dir/filename.obj or
dir_filename.obj.
2016-03-17 12:37:38 +01:00
Nicolas Schneider 4d9db21039 vs2010: fix dependencies of CustomTarget 2016-03-16 00:00:39 +01:00
Nicolas Schneider 3871f22cc3 remove unnecessary os.path.join() calls
ofilenames and srcs are already absolute paths.
2016-03-15 23:37:50 +01:00
Nicolas Schneider 2761f96fe9 vs2010: give each target an own temp dir
The 'Rebuild' target fails in mysterious ways if multiple targets use
the same directories because of output files being deleted between two
build steps (e.g. test case 78 fails on Rebuild, whereas Clean + Build
work just fine).
2016-03-14 09:56:42 +01:00
Nicolas Schneider 2511ff0970 check is_header() first, since it is a subset of is_source() 2016-03-14 00:03:16 +01:00
Nicolas Schneider 1f907e75da add everything that is not an object or source file to headers list 2016-03-13 23:08:37 +01:00
Nicolas Schneider c72cefaac4 only include known source file extensions into sources list 2016-03-13 19:07:44 +01:00
Nicolas Schneider baa639031b not all dependencies have a compile_args attribute 2016-03-13 19:01:46 +01:00
Nicolas Schneider e366631e9e don't fail if we don't compile anything (we might just bundle object files) 2016-03-13 18:58:41 +01:00
Nicolas Schneider 5503939866 only guess language for source files, not for header or object files 2016-03-13 18:03:14 +01:00
Nicolas Schneider 8eac78b861 vs2010: support language specific extra_args 2016-03-13 17:08:30 +01:00
Jussi Pakkanen 0d5eaa2721 Merge pull request #442 from nioncode/vs-linker-args
vs2010: fix linker args
2016-03-12 16:44:33 +02:00
Nicolas Schneider 17f1323aca vs2010: fix linker args 2016-03-12 14:18:51 +01:00
Nicolas Schneider 49418cfe8a vs2010: support multiple precompiled headers (one per language)
This creates the PrecompiledHeader properties for every source file in the
project if multiple languages are present. Otherwise, the global pch
settings are used.
The pch to use is determined by checking the suffix of the source file.
2016-03-12 02:02:36 +01:00
Nicolas Schneider 5ba7680a0d vs2010: fail on multiple precompiled headers 2016-03-12 00:41:04 +01:00
Nicolas Schneider 18ae344be4 vs2010: support precompiled headers 2016-03-11 19:33:53 +01:00
Nicolas Schneider 40a7287a59 vs2010: properly check whether solution needs to be regenerated 2016-02-25 23:13:29 +01:00
Nicolas Schneider bffc84e77e vs2010: write regen.rule in gen_regenproj 2016-02-25 23:13:14 +01:00
Nicolas Schneider 4651ec8f77 vs2010: fix REGEN project input files 2016-02-25 23:12:56 +01:00
Jussi Pakkanen 003696fc27 Merge VS2010 path fix branch. 2016-02-25 22:49:44 +02:00
Nicolas Schneider c5001a3a5a call os.path.normpath before splitting a file path into its components
This makes sure that any '/' are converted to native directory separators
on Windows.
2016-02-25 21:36:57 +01:00
Nicolas Schneider 6de2fd6ab5 vs2010: fix target_to_build_root method
Python's os.path.split() does not split the path into its components.
Instead, split the path with str.split() using the OS's file system
separator.
2016-02-24 00:40:14 +01:00
Nicolas Schneider 78551ae242 vs2010: do not add generated object files to project
MSBuild automatically includes the output objects of the CustomBuildStep
in the link command. If the objects are additionally added to the project,
they will be put twice on the linker command, which leads to LNK4042
warning.
2016-02-23 23:46:34 +01:00
Nicolas Schneider 2dcac38624 vs2010: write CustomBuildStep only if there is at least 1 command to be run 2016-02-23 22:55:13 +01:00
Nicolas Schneider ed6c0e1fa6 vs2010: merge all generators into single command invocation
MSBuild does not allow multiple CustomBuildStep elements. Therefore, all
input / output files and generator commands must be concatenated and put
into a single CustomBuildStep.
2016-02-23 01:04:27 +01:00
Nicolas Schneider d79f402769 vs2010: fix including a precompiled / generated object file in compilation
MSBuild uses the <Object Include='FILE'/> syntax to add prebuilt object
files to the project.
2016-02-23 01:04:27 +01:00
Nicolas Schneider c2e406295e vs2010: fix wrong generator command concatenation 2016-02-23 01:03:52 +01:00
Jussi Pakkanen 7435df8399 Moved backends to their own module. 2016-01-23 20:02:52 +02:00