Ver a proveniência

Update CMake

Unify variables across the project.
master
ascendente
cometimento
885114605c
9 ficheiros alterados com 59 adições e 76 eliminações
  1. +1
    -1
      .gitignore
  2. +48
    -65
      CMakeLists.txt
  3. +1
    -1
      src/packages/asset-inv/main.c
  4. +1
    -1
      src/packages/compat/IZ_windows.h
  5. +1
    -1
      src/packages/game/IZ_app_input.c
  6. +2
    -2
      src/packages/io/IZ_io.c
  7. +1
    -1
      src/packages/log/IZ_log.c
  8. +3
    -3
      src/packages/stdinc/IZ_string.c
  9. +1
    -1
      src/packages/timer/IZ_timer.c

+ 1
- 1
.gitignore Ver ficheiro

@@ -58,7 +58,7 @@ $RECYCLE.BIN/
*.msp
*.lnk
.idea/
cmake-build-debug/
cmake-build-*/
/dependencies/
assets_wip/
Backup_*.cdr


+ 48
- 65
CMakeLists.txt Ver ficheiro

@@ -7,25 +7,31 @@ set(CMAKE_C_STANDARD 11)
#
if (WIN32)
# TODO set arch on target instead of generator
set(PLATFORM WINDOWS)
set(IZ_PLATFORM WINDOWS)
set(IZ_CRYPTO_LIBRARIES libcrypto libssl)
add_definitions(
-DIZ_WINDOWS
)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PROJECT_ARCH x64)
set(IZ_PROJECT_ARCH x64)
add_definitions(
-DIZ_WIN64
)
else ()
set(PROJECT_ARCH x86)
set(IZ_PROJECT_ARCH x86)
add_definitions(
-DIZ_WIN32
)
endif ()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(PLATFORM MACOS)
set(IZ_PLATFORM MACOS)
set(IZ_CRYPTO_LIBRARIES crypto ssl)
add_definitions(
-DIZ_MACOS
)
else()
set(PLATFORM UNIX)
set(IZ_PLATFORM UNIX)
set(IZ_CRYPTO_LIBRARIES crypto ssl)
add_definitions(
-DIZ_UNIX
)
@@ -64,20 +70,23 @@ include_directories(
"${PROJECT_SOURCE_DIR}/dependencies/spine-runtimes/spine-c/spine-c/include"
"${PROJECT_SOURCE_DIR}/dependencies/getopt-for-windows"
"${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/include"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/include"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${IZ_PROJECT_ARCH}/include"
"${PROJECT_SOURCE_DIR}/dependencies/sqlite"
)

if (WIN32)
if (IZ_PLATFORM STREQUAL "WINDOWS")
link_directories(
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${IZ_PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${IZ_PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${IZ_PROJECT_ARCH}"
"${PROJECT_SOURCE_DIR}/dependencies/portmidi/Release"
"${PROJECT_SOURCE_DIR}/dependencies/libwebsockets/build/lib/Release"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/lib"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${IZ_PROJECT_ARCH}/lib"
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(IZ_EXECUTABLE_TYPE WIN32)
endif()
elseif(IZ_PLATFORM STREQUAL "MACOS")
include_directories(
/usr/local/include
/usr/local/include/SDL2
@@ -94,6 +103,7 @@ endif()
#
add_executable(
game
${IZ_EXECUTABLE_TYPE}
dependencies/minIni/dev/minIni.h
dependencies/minIni/dev/minIni.c
dependencies/getopt-for-windows/getopt.h
@@ -163,31 +173,16 @@ add_executable(
src/packages/stdinc/IZ_stdlib.h
)

if (WIN32)
target_link_libraries(
game
SDL2main
SDL2
SDL2_image
SDL2_ttf
portmidi
libcrypto
libssl
websockets
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(
game
SDL2main
SDL2
SDL2_image
SDL2_ttf
portmidi
crypto
ssl
websockets
)
endif()
target_link_libraries(
game
SDL2main
SDL2
SDL2_image
SDL2_ttf
portmidi
${IZ_CRYPTO_LIBRARIES}
websockets
)

add_executable(
game-test-geometry
@@ -331,25 +326,13 @@ add_executable(
src/packages/timer/IZ_timer.h
)

if (WIN32)
target_link_libraries(
server
SDL2main
SDL2
libcrypto
libssl
websockets
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(
server
SDL2main
SDL2
crypto
ssl
websockets
)
endif()
target_link_libraries(
server
SDL2main
SDL2
${IZ_CRYPTO_LIBRARIES}
websockets
)

add_executable(
asset-inv
@@ -362,20 +345,20 @@ add_executable(
#
# Add DLLs and required assets to the build directory
#
if (WIN32)
if (IZ_PLATFORM STREQUAL "WINDOWS")
add_custom_command(TARGET game POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${IZ_PROJECT_ARCH}/SDL2.dll"
$<TARGET_FILE_DIR:game>)

add_custom_command(TARGET game POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${PROJECT_ARCH}/SDL2_image.dll"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_image/lib/${IZ_PROJECT_ARCH}/SDL2_image.dll"
$<TARGET_FILE_DIR:game>)

add_custom_command(TARGET game POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${PROJECT_ARCH}/SDL2_ttf.dll"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2_ttf/lib/${IZ_PROJECT_ARCH}/SDL2_ttf.dll"
$<TARGET_FILE_DIR:game>)

add_custom_command(TARGET game POST_BUILD
@@ -390,17 +373,17 @@ if (WIN32)

add_custom_command(TARGET game POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${IZ_PROJECT_ARCH}/bin/libssl-1_1-x64.dll"
$<TARGET_FILE_DIR:game>)

add_custom_command(TARGET game POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${IZ_PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll"
$<TARGET_FILE_DIR:game>)

add_custom_command(TARGET server POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${PROJECT_ARCH}/SDL2.dll"
"${PROJECT_SOURCE_DIR}/dependencies/SDL2/lib/${IZ_PROJECT_ARCH}/SDL2.dll"
$<TARGET_FILE_DIR:server>)

add_custom_command(TARGET server POST_BUILD
@@ -410,12 +393,12 @@ if (WIN32)

add_custom_command(TARGET server POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libssl-1_1-x64.dll"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${IZ_PROJECT_ARCH}/bin/libssl-1_1-x64.dll"
$<TARGET_FILE_DIR:server>)

add_custom_command(TARGET server POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll"
"${PROJECT_SOURCE_DIR}/dependencies/openssl/${IZ_PROJECT_ARCH}/bin/libcrypto-1_1-x64.dll"
$<TARGET_FILE_DIR:server>)
endif ()



+ 1
- 1
src/packages/asset-inv/main.c Ver ficheiro

@@ -3,7 +3,7 @@
#include "../common/IZ_common.h"
#include "../stdinc/IZ_string.h"

#ifdef IZ_WIN64
#ifdef IZ_WINDOWS
#include <windows.h>
#endif



+ 1
- 1
src/packages/compat/IZ_windows.h Ver ficheiro

@@ -1,7 +1,7 @@
#ifndef IZ_WINDOWS_H
#define IZ_WINDOWS_H

#ifndef IZ_WIN64
#ifndef IZ_WINDOWS
typedef int errno_t;
#else
#include <io.h>


+ 1
- 1
src/packages/game/IZ_app_input.c Ver ficheiro

@@ -1,6 +1,6 @@
#include "IZ_app_input.h"

#ifdef IZ_WIN64
#ifdef IZ_WINDOWS
#define IZ_DEBUG_CONNECT SDLK_PAGEUP
#define IZ_DEBUG_DISCONNECT SDLK_PAGEDOWN
#define IZ_DEBUG_SEND_MESSAGE SDLK_INSERT


+ 2
- 2
src/packages/io/IZ_io.c Ver ficheiro

@@ -1,7 +1,7 @@
#include "IZ_io.h"

int IZ_sprintf(char* buffer, size_t buffer_size, const char* format, ...) {
#if defined IZ_WIN64
#if defined IZ_WINDOWS
va_list args;
va_start(args, format);
int result = sprintf_s(buffer, buffer_size, format, args);
@@ -17,7 +17,7 @@ int IZ_sprintf(char* buffer, size_t buffer_size, const char* format, ...) {
}

errno_t IZ_fopen(FILE** file, const char* filename, const char* mode) {
#if defined IZ_WIN64
#if defined IZ_WINDOWS
return fopen_s(file, filename, mode);
#else
*file = fopen(filename, mode);


+ 1
- 1
src/packages/log/IZ_log.c Ver ficheiro

@@ -33,7 +33,7 @@ bool IZ_LogIsSupportedTerminal() {
}

bool IZ_LogIsSupportedColor() {
#ifdef IZ_WIN64
#ifdef IZ_WINDOWS
return _isatty(_fileno(stdout)) && IZ_LogIsSupportedTerminal();
#else
return isatty(fileno(stdout)) && IZ_LogIsSupportedTerminal();


+ 3
- 3
src/packages/stdinc/IZ_string.c Ver ficheiro

@@ -1,7 +1,7 @@
#include "IZ_string.h"

errno_t IZ_memcpy(void* const dest, const rsize_t dest_size, const void* const source, const rsize_t source_size) {
#if defined IZ_WIN64
#if defined IZ_WINDOWS
return memcpy_s(dest, dest_size, source, source_size);
#else
memcpy(dest, source, dest_size);
@@ -10,7 +10,7 @@ errno_t IZ_memcpy(void* const dest, const rsize_t dest_size, const void* const s
}

errno_t IZ_strcat(char* dest, rsize_t source_size, const char* source) {
#if defined IZ_WIN64
#if defined IZ_WINDOWS
return strcat_s(dest, source_size, source);
#else
strcat(dest, source);
@@ -19,7 +19,7 @@ errno_t IZ_strcat(char* dest, rsize_t source_size, const char* source) {
}

errno_t IZ_strlwr(char* dest, const char* str, rsize_t str_size) {
#if defined IZ_WIN64
#if defined IZ_WINDOWS
errno_t copy_result = memcpy_s(dest, str_size, str, str_size);
if (copy_result) {
return copy_result;


+ 1
- 1
src/packages/timer/IZ_timer.c Ver ficheiro

@@ -1,6 +1,6 @@
#include "IZ_timer.h"

#ifdef IZ_WIN64
#ifdef IZ_WINDOWS
typedef enum {
_CLOCK_REALTIME = 0,
#define CLOCK_REALTIME _CLOCK_REALTIME


Carregando…
Cancelar
Guardar