From 5f8ba6b5df140b55e52ab9f562d9cf14ee0fd8b0 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Thu, 18 May 2023 11:14:44 +0300 Subject: [PATCH 01/11] minor rewrites to CMakeLists.txt --- source/compiler/CMakeLists.txt | 82 ++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 5bf3173..6469bbc 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -1,50 +1,56 @@ -project(pawnc C) -cmake_minimum_required(VERSION 2.8) - -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake) - +#==============================================================================# +cmake_minimum_required(VERSION 3.24 FATAL_ERROR) +cmake_policy(SET CMP0115 NEW) +#==============================================================================# set(VERSION_MAJOR 3) set(VERSION_MINOR 10) set(VERSION_BUILD 11) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}) set(VERSION_STR ${VERSION}) math(EXPR VERSION_INT "${VERSION_MAJOR} << 8 | ${VERSION_MINOR}") +#==============================================================================# +project(pawncc + LANGUAGES C + VERSION ${VERSION} + DESCRIPTION "OpenMultiplayer's fork of Compuphase's Pawn Language Compiler'" +) -# check for optional include files +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake) +#==============================================================================# include(CheckIncludeFile) -check_include_file("unistd.h" HAVE_UNISTD_H) -if(HAVE_UNISTD_H) - add_definitions(-DHAVE_UNISTD_H) -endif() -check_include_file("inttypes.h" HAVE_INTTYPES_H) -if(HAVE_INTTYPES_H) - add_definitions(-DHAVE_INTTYPES_H) -endif() -check_include_file("stdint.h" HAVE_STDINT_H) -if(HAVE_STDINT_H) - add_definitions(-DHAVE_STDINT_H) -endif() -check_include_file("alloca.h" HAVE_ALLOCA_H) -if(HAVE_ALLOCA_H) - add_definitions(-DHAVE_ALLOCA_H) -endif() -check_include_file("endian.h" HAVE_ENDIAN_H) -if(HAVE_ENDIAN_H) - add_definitions(-DHAVE_ENDIAN_H) -endif() +include(CheckFunctionExists) + +# check for optional include files +set(REQUIRED_INCLUDE_FILES + "inttypes.h" + "stdint.h" + "alloca.h" + "malloc.h" + "unistd.h" + "endian.h" +) +foreach(INCLUDE_FILE ${REQUIRED_INCLUDE_FILES}) + string(REGEX REPLACE "\\.|/" "_" DEFINITION_NAME "HAVE_${INCLUDE_FILE}") + string(TOUPPER ${DEFINITION_NAME} DEFINITION_NAME) + check_include_files("${INCLUDE_FILE}" ${DEFINITION_NAME}) + if(${DEFINITION_NAME}) + add_definitions(-D${DEFINITION_NAME}) + endif() +endforeach() # check for optional library functions -include(CheckFunctionExists) -check_function_exists(strlcpy HAVE_STRLCPY) -if(HAVE_STRLCPY) - add_definitions(-DHAVE_STRLCPY) -endif() -check_function_exists(strlcat HAVE_STRLCAT) -if(HAVE_STRLCAT) - add_definitions(-DHAVE_STRLCAT) -endif() +set(REQUIRED_INCLUDE_FILES + strlcpy + strlcat +) +foreach(FUNCTION_NAME ${REQUIRED_FUNCTIONS}) + set(DEFINITION_NAME "HAVE_${FUNCTION_NAME}") + check_function_exists(${FUNCTION_NAME} ${DEFINITION_NAME}) + if(${DEFINITION_NAME}) + add_definitions(-D${DEFINITION_NAME}) + endif() +endforeach() if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) @@ -63,7 +69,7 @@ endif() if(APPLE) set(CMAKE_MACOSX_RPATH ON) endif() - +#==============================================================================# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) From 310db9eb80005cd2031c2608c4909830a6c1d0d1 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Thu, 18 May 2023 11:26:47 +0300 Subject: [PATCH 02/11] correcting project name --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 6469bbc..944cd95 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -9,7 +9,7 @@ set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}) set(VERSION_STR ${VERSION}) math(EXPR VERSION_INT "${VERSION_MAJOR} << 8 | ${VERSION_MINOR}") #==============================================================================# -project(pawncc +project(pawnc LANGUAGES C VERSION ${VERSION} DESCRIPTION "OpenMultiplayer's fork of Compuphase's Pawn Language Compiler'" From 399fe4b071fecc2098d9d5af2978605f34a437b4 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Thu, 18 May 2023 11:44:30 +0300 Subject: [PATCH 03/11] adding optional CMake variable which defines sNAMEMAX preprocessor C variable (default value for that CMake var is 63 incase it is not defined) --- source/compiler/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 944cd95..05c63ec 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -69,6 +69,14 @@ endif() if(APPLE) set(CMAKE_MACOSX_RPATH ON) endif() + +if(DEFINED PAWN_MAX_FUNC_NAME + AND PAWN_MAX_FUNC_NAME MATCHES "^[0-9]+$" + AND NOT PAWN_MAX_FUNC_NAME LESS 31) + add_definitions(-DsNAMEMAX=${PAWN_MAX_FUNC_NAME}) +else() + add_definitions(-DsNAMEMAX=63) +endif() #==============================================================================# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) From ce6592ef670332f6cf5ea8a69a0a238162efab45 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Thu, 18 May 2023 11:45:44 +0300 Subject: [PATCH 04/11] whatever --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 05c63ec..c167b54 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -71,7 +71,7 @@ if(APPLE) endif() if(DEFINED PAWN_MAX_FUNC_NAME - AND PAWN_MAX_FUNC_NAME MATCHES "^[0-9]+$" + AND PAWN_MAX_FUNC_NAME MATCHES "^[0-9]+$" AND NOT PAWN_MAX_FUNC_NAME LESS 31) add_definitions(-DsNAMEMAX=${PAWN_MAX_FUNC_NAME}) else() From a62c751ec29b6e431d41880d4cd195bff8f28942 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Thu, 18 May 2023 11:54:45 +0300 Subject: [PATCH 05/11] whatever --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index c167b54..17f00d6 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -45,7 +45,7 @@ set(REQUIRED_INCLUDE_FILES strlcat ) foreach(FUNCTION_NAME ${REQUIRED_FUNCTIONS}) - set(DEFINITION_NAME "HAVE_${FUNCTION_NAME}") + set(DEFINITION_NAME "HAVE_${FUNCTION_NAME}") check_function_exists(${FUNCTION_NAME} ${DEFINITION_NAME}) if(${DEFINITION_NAME}) add_definitions(-D${DEFINITION_NAME}) From af65074b748e2d52ce3dbb013ffd542003867508 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Thu, 18 May 2023 12:50:39 +0300 Subject: [PATCH 06/11] reverting minimum version change --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 17f00d6..d71db13 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -1,5 +1,5 @@ #==============================================================================# -cmake_minimum_required(VERSION 3.24 FATAL_ERROR) +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) cmake_policy(SET CMP0115 NEW) #==============================================================================# set(VERSION_MAJOR 3) From d9b92bf7feefb13a9e3f843f6de287b81421bc07 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Thu, 18 May 2023 12:53:16 +0300 Subject: [PATCH 07/11] change variable name to sNAMEMAX --- source/compiler/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index d71db13..40ba79b 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -70,10 +70,10 @@ if(APPLE) set(CMAKE_MACOSX_RPATH ON) endif() -if(DEFINED PAWN_MAX_FUNC_NAME - AND PAWN_MAX_FUNC_NAME MATCHES "^[0-9]+$" - AND NOT PAWN_MAX_FUNC_NAME LESS 31) - add_definitions(-DsNAMEMAX=${PAWN_MAX_FUNC_NAME}) +if(DEFINED sNAMEMAX + AND sNAMEMAX MATCHES "^[0-9]+$" + AND NOT sNAMEMAX LESS 31) + add_definitions(-DsNAMEMAX=${sNAMEMAX}) else() add_definitions(-DsNAMEMAX=63) endif() From 9284a494637ac4c0996b0f14a93d073a59c6178e Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Fri, 19 May 2023 06:14:37 +0300 Subject: [PATCH 08/11] correcting REQUIRED_FUNCTIONS variable name --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 40ba79b..b8d6532 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -40,7 +40,7 @@ foreach(INCLUDE_FILE ${REQUIRED_INCLUDE_FILES}) endforeach() # check for optional library functions -set(REQUIRED_INCLUDE_FILES +set(REQUIRED_FUNCTIONS strlcpy strlcat ) From 04e7858af8a9545a2f80f51d0ec241902979f2e8 Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:26:19 +0300 Subject: [PATCH 09/11] VERSION not allowed unless CMP0048 is set to NEW --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index b8d6532..49501b7 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -11,7 +11,7 @@ math(EXPR VERSION_INT "${VERSION_MAJOR} << 8 | ${VERSION_MINOR}") #==============================================================================# project(pawnc LANGUAGES C - VERSION ${VERSION} + #VERSION ${VERSION} DESCRIPTION "OpenMultiplayer's fork of Compuphase's Pawn Language Compiler'" ) From 80e29a7300db33e17a572b7ccf7b25b945dab253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Szczepa=C5=84ski?= <19861700+mysy00@users.noreply.github.com> Date: Fri, 1 Sep 2023 01:16:14 +0200 Subject: [PATCH 10/11] Include correct macro to check for files --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 49501b7..af500d7 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -18,7 +18,7 @@ project(pawnc set_property(GLOBAL PROPERTY USE_FOLDERS ON) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake) #==============================================================================# -include(CheckIncludeFile) +include(CheckIncludeFiles) include(CheckFunctionExists) # check for optional include files From 352706f99d16ad7811cdd4ad96af5198e41b4bbf Mon Sep 17 00:00:00 2001 From: John Magdy Lotfy Kamel <19735243+Zorono@users.noreply.github.com> Date: Sun, 28 Apr 2024 19:11:19 +0300 Subject: [PATCH 11/11] Update CMakeLists.txt --- source/compiler/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index af500d7..dc95be2 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -12,7 +12,7 @@ math(EXPR VERSION_INT "${VERSION_MAJOR} << 8 | ${VERSION_MINOR}") project(pawnc LANGUAGES C #VERSION ${VERSION} - DESCRIPTION "OpenMultiplayer's fork of Compuphase's Pawn Language Compiler'" + DESCRIPTION "OpenMultiplayer's fork of Compuphase's Pawn Language Compiler" ) set_property(GLOBAL PROPERTY USE_FOLDERS ON)