Skip to content

Commit

Permalink
windows: fix define magic for static builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Totto16 committed Oct 15, 2024
1 parent 0a1bb66 commit 04d1cb6
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 11 deletions.
17 changes: 16 additions & 1 deletion src/helper/graphic_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,28 @@ namespace utils {

// this needs some special handling, so the macro is defined here
#if defined(_MSC_VER)
#if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0

#else

#endif
#else

#endif


#if defined(_MSC_VER)
#if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0
#if defined(OOPETRIS_LIBRARY_GRAPHICS_EXPORT)
#define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __declspec(dllexport, noreturn)
#else
#define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __declspec(dllimport, noreturn)
#endif
#else
#define OOPETRIS_GRAPHICS_EXPORTED_NORETURN
#define OOPETRIS_GRAPHICS_EXPORTED_NORETURN __declspec(noreturn)
#endif
#else
#define OOPETRIS_GRAPHICS_EXPORTED_NORETURN [[noreturn]]
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/helper/windows.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#if defined(_MSC_VER)
#if defined(OOPETRIS_LIBRARY_GRAPHICS_COMPILATION)
#if defined(OOPETRIS_LIBRARY_GRAPHICS_TYPE) && OOPETRIS_LIBRARY_GRAPHICS_TYPE == 0
#if defined(OOPETRIS_LIBRARY_GRAPHICS_EXPORT)
#define OOPETRIS_GRAPHICS_EXPORTED __declspec(dllexport)
#else
Expand Down
4 changes: 2 additions & 2 deletions src/libs/core/hash-library/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;

#if defined(HASH_LIBRARY_COMPILATION)
#if defined(HASH_LIBRARY_EXPORT)
#if defined(OOPETRIS_LIBRARY_CORE_TYPE) && OOPETRIS_LIBRARY_CORE_TYPE == 0
#if defined(OOPETRIS_LIBRARY_CORE_EXPORT)
#define HASH_LIBRARY_EXPORTED __declspec(dllexport)
#else
#define HASH_LIBRARY_EXPORTED __declspec(dllimport)
Expand Down
2 changes: 1 addition & 1 deletion src/libs/core/helper/windows.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#if defined(_MSC_VER)
#if defined(OOPETRIS_LIBRARY_CORE_COMPILATION)
#if defined(OOPETRIS_LIBRARY_CORE_TYPE) && OOPETRIS_LIBRARY_CORE_TYPE == 0
#if defined(OOPETRIS_LIBRARY_CORE_EXPORT)
#define OOPETRIS_CORE_EXPORTED __declspec(dllexport)
#else
Expand Down
10 changes: 8 additions & 2 deletions src/libs/core/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ subdir('game')
subdir('hash-library')
subdir('helper')

temp = core_lib.get('compile_args')
temp += '-DOOPETRIS_LIBRARY_CORE_TYPE='+ (get_option('default_library') == 'static' ? '1' : '0')
core_lib += {'compile_args': temp}
temp = 0


liboopetris_core = library(
'oopetris_core',
core_src_files,
core_header_files,
include_directories: core_lib.get('inc_dirs'),
dependencies: core_lib.get('deps'),
cpp_args: [core_lib.get('compile_args'),'-DOOPETRIS_LIBRARY_CORE_COMPILATION','-DHASH_LIBRARY_COMPILATION'],
cpp_shared_args: ['-DOOPETRIS_LIBRARY_CORE_EXPORT', '-DHASH_LIBRARY_EXPORT'],
cpp_args: core_lib.get('compile_args'),
cpp_shared_args: ['-DOOPETRIS_LIBRARY_CORE_EXPORT'],
override_options: {
'warning_level': '3',
'werror': true,
Expand Down
10 changes: 8 additions & 2 deletions src/libs/recordings/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ recordings_include_dir = include_dir / 'oopetris' / 'recordings'

subdir('utility')

temp = recordings_lib.get('compile_args')
temp += '-DOOPETRIS_LIBRARY_RECORDINGS_TYPE='+ (get_option('default_library') == 'static' ? '1' : '0')
recordings_lib += {'compile_args': temp}
temp = 0


recordings_lib += {
'deps': [recordings_lib.get('deps'), liboopetris_core_dep],
'inc_dirs': [recordings_lib.get('inc_dirs'), include_directories('.')],
'inc_dirs': [recordings_lib.get('inc_dirs'), include_directories('.')]
}

liboopetris_recordings = library(
Expand All @@ -16,7 +22,7 @@ liboopetris_recordings = library(
recordings_header_files,
include_directories: recordings_lib.get('inc_dirs'),
dependencies: recordings_lib.get('deps'),
cpp_args: [recordings_lib.get('compile_args'),'-DOOPETRIS_LIBRARY_RECORDINGS_COMPILATION'],
cpp_args: recordings_lib.get('compile_args'),
cpp_shared_args: ['-DOOPETRIS_LIBRARY_RECORDINGS_EXPORT'],
override_options: {
'warning_level': '3',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/recordings/utility/windows.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#if defined(_MSC_VER)
#if defined(OOPETRIS_LIBRARY_RECORDINGS_COMPILATION)
#if defined(OOPETRIS_LIBRARY_RECORDINGS_TYPE) && OOPETRIS_LIBRARY_RECORDINGS_TYPE == 0
#if defined(OOPETRIS_LIBRARY_RECORDINGS_EXPORT)
#define OOPETRIS_RECORDINGS_EXPORTED __declspec(dllexport)
#else
Expand Down
5 changes: 4 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ if build_application
graphics_lib += {
'deps': [graphics_lib.get('deps'), liboopetris_recordings_dep],
'inc_dirs': [graphics_lib.get('inc_dirs'), include_directories('.')],
'compile_args' : [graphics_lib.get('compile_args'),
'-DOOPETRIS_LIBRARY_GRAPHICS_TYPE='+
(get_option('default_library') == 'static' ? '1' : '0')]
}

liboopetris_graphics = library(
'oopetris_graphics',
graphics_src_files,
include_directories: graphics_lib.get('inc_dirs'),
dependencies: graphics_lib.get('deps'),
cpp_args: [graphics_lib.get('compile_args'),'-DOOPETRIS_LIBRARY_GRAPHICS_COMPILATION'],
cpp_args: graphics_lib.get('compile_args'),
cpp_shared_args: ['-DOOPETRIS_LIBRARY_GRAPHICS_EXPORT'],
override_options: {
'warning_level': '3',
Expand Down

0 comments on commit 04d1cb6

Please sign in to comment.