Skip to content

Commit

Permalink
Rename include directories consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Jan 25, 2024
1 parent 82f2065 commit 3a6e852
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 36 deletions.
16 changes: 8 additions & 8 deletions Modelica/Resources/BuildProjects/CMake/Modelica_utilities.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
if(DEFINED MODELICA_UTILITIES_INCLUDE)
if(NOT MODELICA_UTILITIES_INCLUDE STREQUAL "")
include_directories(${MODELICA_UTILITIES_INCLUDE})
if(DEFINED MODELICA_UTILITIES_INCLUDE_DIR)
if(NOT MODELICA_UTILITIES_INCLUDE_DIR STREQUAL "")
include_directories(${MODELICA_UTILITIES_INCLUDE_DIR})
else()
message(FATAL_ERROR "MODELICA_UTILITIES_INCLUDE is an empty string.")
message(FATAL_ERROR "MODELICA_UTILITIES_INCLUDE_DIR is an empty string.")
endif()
else()
set(MODELICA_UTILITIES_INCLUDE "" CACHE PATH "Include directory of the (tool-vendor specific) ModelicaUtilities.h header file")
if(NOT MODELICA_UTILITIES_INCLUDE STREQUAL "")
include_directories(${MODELICA_UTILITIES_INCLUDE})
set(MODELICA_UTILITIES_INCLUDE_DIR "" CACHE PATH "Include directory of the (tool-vendor specific) ModelicaUtilities.h header file")
if(NOT MODELICA_UTILITIES_INCLUDE_DIR STREQUAL "")
include_directories(${MODELICA_UTILITIES_INCLUDE_DIR})
else()
message(FATAL_ERROR "MODELICA_UTILITIES_INCLUDE is an empty string.")
message(FATAL_ERROR "MODELICA_UTILITIES_INCLUDE_DIR is an empty string.")
endif()
endif()
15 changes: 6 additions & 9 deletions Modelica/Resources/BuildProjects/CMake/compiler_options.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
include(CheckSymbolExists)
check_symbol_exists(memcpy "string.h" HAVE_MEMCPY)
check_symbol_exists(_open "io.h" HAVE__OPEN)
check_symbol_exists(_read "io.h" HAVE__READ)
check_symbol_exists(_write "io.h" HAVE__WRITE)
check_symbol_exists(_close "io.h" HAVE__CLOSE)

include(CheckIncludeFile)
check_include_file("dirent.h" HAVE_DIRENT_H)
check_include_file("io.h" HAVE_IO_H)
check_include_file("locale.h" HAVE_LOCALE_H)
check_include_file("pthread.h" HAVE_PTHREAD_H)
check_include_file("stdarg.h" HAVE_STDARG_H)
Expand All @@ -25,10 +22,10 @@ check_c_source_compiles(
)
if (HAVE_UNISTD_H)
check_c_source_compiles(
"
#include <unistd.h>
int main(void) {getpid(); return 0;}
"
HAVE_GETPID
"
#include <unistd.h>
int main(void) {getpid(); return 0;}
"
HAVE_GETPID
)
endif()
4 changes: 2 additions & 2 deletions Modelica/Resources/BuildProjects/CMake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ option(MODELICA_COPY_TABLE_DATA "Deep-copy table arrays (passed as array)" ON)
# Option to add a dummy function "usertab"
option(MODELICA_DUMMY_FUNCTION_USERTAB "Add a dummy usertab function" OFF)

# Option to use an externally provided zlib
option(MODELICA_BUILD_ZLIB "Build zlib from sources in this project, otherwise provide ZLIB_HEADER_LOCATION" ON)
# Option to build zlib from sources
option(MODELICA_BUILD_ZLIB "Build zlib from sources in this project, otherwise provide ZLIB_INCLUDE_DIR" ON)

# Option whether to install ModelicaExternalC
option(MODELICA_INSTALL_EXTC "Install ModelicaExternalC library" OFF)
40 changes: 23 additions & 17 deletions Modelica/Resources/BuildProjects/CMake/src.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ endif()
if(NOT HAVE_TIME_H)
add_definitions(-DNO_TIME)
endif()
if(HAVE_UNISTD_H)
if(NOT HAVE_GETPID)
add_definitions(-DNO_PID)
endif()
if(HAVE_UNISTD_H AND NOT HAVE_GETPID)
add_definitions(-DNO_PID)
endif()
if(HAVE_MEMCPY)
add_definitions(-DHAVE_MEMCPY)
Expand All @@ -32,13 +30,23 @@ elseif(MSVC)
endif()

if(MODELICA_BUILD_ZLIB)
set(ZLIB_HEADER_LOCATION "${MODELICA_RESOURCES_DIR}/C-Sources/zlib")
elseif(NOT DEFINED ZLIB_HEADER_LOCATION)
message(FATAL_ERROR "MODELICA_BUILD_ZLIB was turned off, but ZLIB_HEADER_LOCATION was not provided.")
set(ZLIB_INCLUDE_DIR "${MODELICA_RESOURCES_DIR}/C-Sources/zlib")
include_directories(${ZLIB_INCLUDE_DIR})
elseif(DEFINED ZLIB_INCLUDE_DIR)
if(NOT ZLIB_INCLUDE_DIR STREQUAL "")
include_directories(${ZLIB_INCLUDE_DIR})
else()
message(FATAL_ERROR "ZLIB_INCLUDE_DIR is an empty string.")
endif()
else()
set(ZLIB_INCLUDE_DIR "" CACHE PATH "Include directory of the zlib.h header file")
if(NOT ZLIB_INCLUDE_DIR STREQUAL "")
include_directories(${ZLIB_INCLUDE_DIR})
else()
message(FATAL_ERROR "ZLIB_INCLUDE_DIR is an empty string.")
endif()
endif()

include_directories("${ZLIB_HEADER_LOCATION}")

set(EXTC_SOURCES
"${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaFFT.c"
"${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaFFT.h"
Expand All @@ -54,7 +62,7 @@ set(EXTC_SOURCES
"${MODELICA_RESOURCES_DIR}/C-Sources/uthash.h"
"${MODELICA_RESOURCES_DIR}/C-Sources/win32_dirent.c"
"${MODELICA_RESOURCES_DIR}/C-Sources/win32_dirent.h"
"${MODELICA_UTILITIES_INCLUDE}/ModelicaUtilities.h"
"${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h"
)

set(TABLES_SOURCES
Expand All @@ -66,27 +74,25 @@ set(TABLES_SOURCES
"${MODELICA_RESOURCES_DIR}/C-Sources/stdint_msvc.h"
"${MODELICA_RESOURCES_DIR}/C-Sources/stdint_wrap.h"
"${MODELICA_RESOURCES_DIR}/C-Sources/uthash.h"
"${MODELICA_UTILITIES_INCLUDE}/ModelicaUtilities.h"
"${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h"
)



set(MATIO_SOURCES
"${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaMatIO.c"
"${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaMatIO.h"
"${MODELICA_RESOURCES_DIR}/C-Sources/read_data_impl.h"
"${MODELICA_RESOURCES_DIR}/C-Sources/safe-math.h"
"${MODELICA_RESOURCES_DIR}/C-Sources/snprintf.c"
"${MODELICA_RESOURCES_DIR}/C-Sources/stdint_msvc.h"
"${ZLIB_HEADER_LOCATION}/zlib.h"
"${MODELICA_UTILITIES_INCLUDE}/ModelicaUtilities.h"
"${ZLIB_INCLUDE_DIR}/zlib.h"
"${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h"
)

set(IO_SOURCES
"${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaIO.c"
"${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaIO.h"
"${MODELICA_RESOURCES_DIR}/C-Sources/ModelicaMatIO.h"
"${MODELICA_UTILITIES_INCLUDE}/ModelicaUtilities.h"
"${MODELICA_UTILITIES_INCLUDE_DIR}/ModelicaUtilities.h"
)

if(MODELICA_BUILD_ZLIB)
Expand Down Expand Up @@ -117,7 +123,7 @@ endif()
if(MODELICA_DUMMY_FUNCTION_USERTAB)
target_compile_definitions(ModelicaStandardTables PUBLIC -DDUMMY_FUNCTION_USERTAB=1)
endif()
if(MODELICA_BUILD_ZLIB AND (HAVE_WINAPIFAMILY_H OR (HAVE__OPEN AND HAVE__READ AND HAVE__WRITE AND HAVE__CLOSE)))
if(MODELICA_BUILD_ZLIB AND (HAVE_WINAPIFAMILY_H OR HAVE_IO_H))
target_compile_definitions(zlib PUBLIC -DWINAPI_FAMILY=100)
endif()
target_compile_definitions(ModelicaMatIO PUBLIC -DHAVE_ZLIB=1)
Expand Down

0 comments on commit 3a6e852

Please sign in to comment.